/**
 * ESTILOS DEL CHATBOT STUDIOMIX
 * 
 * Estilos para la interfaz del chatbot fake
 * 
 * @package StudioMix
 * @version 1.0.0
 */

/* ===========================================
   OCULTAR BOTÓN ANTIGUO DEL MÓDULO DE ESTILOS
   =========================================== */

#estilos-chatbot-btn {
    display: none !important;
}

.estilos-boton-container {
    display: none !important;
}

/* ===========================================
   BOTÓN FLOTANTE DEL CHATBOT
   =========================================== */

.chatbot-floating-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #000000 0%, #494949 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 9999;
    animation: chatbotPulse 2s infinite;
    display: none;
}

.chatbot-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.chatbot-floating-button:active {
    transform: scale(0.95);
}

.chatbot-icon {
    width: 35px;
    height: 35px;
    color: #ffffff;
}

.chatbot-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #e74c3c;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
    animation: chatbotBadgeBounce 1s ease-in-out infinite;
}

@keyframes chatbotPulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(0, 0, 0, 0.1);
    }
}

@keyframes chatbotBadgeBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* ===========================================
   MODAL DEL CHATBOT
   =========================================== */

.chatbot-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.chatbot-modal-container {
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================
   CONTENEDOR PRINCIPAL DEL CHATBOT
   =========================================== */

.studiomix-chatbot-container {
    max-width: 800px;
    margin: 0;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: 'Raleway', sans-serif;
}

/* ===========================================
   HEADER DEL CHATBOT
   =========================================== */

.chatbot-header {
    background: linear-gradient(135deg, #000000 0%, #494949 100%);
    color: #ffffff;
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
}

.chatbot-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #ffffff;
}

.chatbot-subtitle {
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
    color: #ecf0f1;
    opacity: 0.9;
}

.chatbot-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.chatbot-close-btn:active {
    transform: scale(0.95);
}

.close-icon {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
}

/* ===========================================
   ÁREA DE MENSAJES
   =========================================== */

.chatbot-messages {
    height: 400px;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeInUp 0.3s ease-out;
}

.chatbot-message--ai {
    align-self: flex-start;
}

.chatbot-message--user {
    align-self: flex-end;
}

.message-content {
    padding: 1rem 1.5rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message--ai .message-content {
    background: #ffffff;
    color: #2c3e50;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.chatbot-message--user .message-content {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #464646;
    margin-top: 0.25rem;
    text-align: right;
}

.chatbot-message--ai .message-time {
    text-align: left;
}

/* ===========================================
   ÁREA DE INPUT
   =========================================== */

.chatbot-input-container {
    padding: 1.5rem 2rem;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 0.95rem;
    font-family: 'Raleway', sans-serif;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input:focus {
    border-color: #3498db;
}

.chatbot-input::placeholder {
    color: #95a5a6;
}

.chatbot-send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #818181 0%, #525252 100%);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 93, 93, 0.3);
}

.chatbot-send-btn:active {
    transform: translateY(0);
}

.chatbot-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.send-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

/* ===========================================
   ÁREA DE PRODUCTOS RECOMENDADOS
   =========================================== */

.chatbot-products {
    padding: 1.5rem 2rem;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    animation: slideUp 0.3s ease-out;
}

.products-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.product-recommendation {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.product-recommendation:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #f8f9fa;
}

.product-info {
    padding: 1rem;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    /* Soporte para truncar texto a 2 líneas */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* Versión webkit (Chrome, Safari, Edge) */
    -webkit-line-clamp: 2;
    
    /* Versión estándar moderna (cuando esté disponible) */
    line-clamp: 2;
    
    /* Fallback para navegadores que no soportan line-clamp */
    max-height: 2.6em; /* 2 líneas * 1.3 line-height */
}

.product-brand {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.product-price {
    font-size: 1rem;
    font-weight: 700;
    color: #27ae60;
    margin: 0;
}

/* ===========================================
   ESTADOS Y ANIMACIONES
   =========================================== */

.chatbot-thinking {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #7f8c8d;
    font-style: italic;
}

.thinking-dots {
    display: flex;
    gap: 0.25rem;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    background: #7f8c8d;
    border-radius: 50%;
    animation: thinkingPulse 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }
.thinking-dot:nth-child(3) { animation-delay: 0s; }

@keyframes thinkingPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

@media (max-width: 768px) {
    .chatbot-close-btn {
        top: 0.75rem;
        right: 0.75rem;
        width: 30px;
        height: 30px;
    }
    
    .close-icon {
        font-size: 1.2rem;
    }
    .studiomix-chatbot-container {
        margin: 1rem;
        border-radius: 12px;
    }
    
    .chatbot-header {
        padding: 1rem 1.5rem;
    }
    
    .chatbot-title {
        font-size: 1.5rem;
    }
    
    .chatbot-subtitle {
        font-size: 0.9rem;
    }
    
    .chatbot-messages {
        height: 350px;
        padding: 1rem 1.5rem;
    }
    
    .chatbot-input-container {
        padding: 1rem 1.5rem;
    }
    
    .chatbot-products {
        padding: 1rem 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .product-image {
        height: 120px;
    }
    
    .product-info {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .chatbot-close-btn {
        top: 0.5rem;
        right: 0.5rem;
        width: 28px;
        height: 28px;
    }
    
    .close-icon {
        font-size: 1rem;
    }
    
    .studiomix-chatbot-container {
        margin: 0.5rem;
        border-radius: 8px;
    }
    
    .chatbot-header {
        padding: 0.75rem 1rem;
    }
    
    .chatbot-title {
        font-size: 1.3rem;
    }
    
    .chatbot-subtitle {
        font-size: 0.85rem;
    }
    
    .chatbot-messages {
        height: 300px;
        padding: 0.75rem 1rem;
    }
    
    .message-content {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .chatbot-input-container {
        padding: 0.75rem 1rem;
    }
    
    .chatbot-input {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .chatbot-send-btn {
        width: 40px;
        height: 40px;
    }
    
    .chatbot-products {
        padding: 0.75rem 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .product-image {
        height: 100px;
    }
    
    .product-info {
        padding: 0.5rem;
    }
    
    .product-name {
        font-size: 0.8rem;
    }
    
    .product-brand {
        font-size: 0.75rem;
    }
    
    .product-price {
        font-size: 0.9rem;
    }
    
    /* Botón flotante responsive */
    .chatbot-floating-button {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }
    
    .chatbot-icon {
        width: 30px;
        height: 30px;
    }
    
    .chatbot-badge {
        font-size: 10px;
        padding: 3px 8px;
        top: -8px;
        right: -8px;
    }
    
    /* Modal responsive */
    .chatbot-modal-container {
        width: 95%;
        max-height: 85vh;
    }
}

/* ===========================================
   ESTADOS DE ERROR Y CARGANDO
   =========================================== */

.chatbot-error {
    background: #e74c3c;
    color: #ffffff;
    padding: 1rem;
    margin: 1rem 2rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.chatbot-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #7f8c8d;
}

/* ===========================================
   SCROLLBAR PERSONALIZADO
   =========================================== */

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===========================================
   ACCESIBILIDAD
   =========================================== */

.chatbot-input:focus,
.chatbot-send-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.product-recommendation:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* ===========================================
   ESTADOS DE INTERACCIÓN
   =========================================== */

.chatbot-send-btn:focus:not(:disabled) {
    background: linear-gradient(135deg, #2980b9 0%, #1f4e79 100%);
}

.product-recommendation:focus {
    border-color: #3498db;
}

/* ===========================================
   MODO OSCURO (OPCIONAL)
   =========================================== */

@media (prefers-color-scheme: dark) {
    .studiomix-chatbot-container {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .chatbot-messages {
        background: #d5d5d5;
    }
    
    .chatbot-message--ai .message-content {
        background: #000000;
        color: #ecf0f1;
        border-color: #000000;
    }
    
    .chatbot-input-container {
        background: #000000;
        border-top-color: #000000;
    }
    
    .chatbot-input {
        background: #ededed;
        border-color: #7e7e7e;
        color: #000000;
    }
    
    .chatbot-input::placeholder {
        color: #bdc3c7;
    }
    
    .chatbot-products {
        background: #2c3e50;
        border-top-color: #34495e;
    }
    
    .products-title {
        color: #ecf0f1;
    }
    
    .product-recommendation {
        background: #34495e;
        border-color: #2c3e50;
    }
    
    .product-name {
        color: #ecf0f1;
    }
    
    .product-brand {
        color: #bdc3c7;
    }
}
