/* ============================================
   Chat - Asesor de Fragancias
   Diseño elegante estilo conversacional
   ============================================ */

.chat {
    --chat-primary: #C9A227;
    --chat-primary-light: #E8D5A3;
    --chat-primary-dark: #9A7B1A;
    --chat-dark: #1A1A1A;
    --chat-gray: #6B6B6B;
    --chat-gray-light: #F5F5F5;
    --chat-cream: #FAF8F5;
    --chat-white: #FFFFFF;
    --chat-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --chat-radius: 20px;
    --chat-radius-sm: 12px;
}

/* ============================================
   Modo Expandido (en home)
   ============================================ */

.chat-section {
    padding: var(--spacing-lg) 0;
    background: var(--color-cream);
}

.chat:not([data-minimizable="true"]) {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.chat:not([data-minimizable="true"]) .chat__toggle {
    display: none;
}

.chat:not([data-minimizable="true"]) .chat__window {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 600px;
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    border: 1px solid rgba(201, 162, 39, 0.15);
    overflow: hidden;
    background: var(--chat-white);
}

.chat:not([data-minimizable="true"]) .chat__close {
    display: none;
}

/* ============================================
   Modo Minimizable (botón flotante)
   ============================================ */

.chat[data-minimizable="true"] {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.chat[data-minimizable="true"] .chat__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: var(--chat-white);
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(201, 162, 39, 0.4);
    transition: all 0.3s ease;
}

.chat[data-minimizable="true"] .chat__toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(201, 162, 39, 0.5);
}

.chat[data-minimizable="true"] .chat__toggle i {
    font-size: 1.2rem;
}

.chat[data-minimizable="true"] .chat__window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 420px;
    height: 600px;
    display: none;
    flex-direction: column;
    border-radius: var(--chat-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(201, 162, 39, 0.15);
    overflow: hidden;
    background: var(--chat-white);
}

.chat[data-minimizable="true"].active .chat__window {
    display: flex;
}

.chat[data-minimizable="true"].active .chat__toggle {
    display: none;
}

/* ============================================
   Header del Chat - Elegante
   ============================================ */

.chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--chat-cream) 0%, #F5F0E8 100%);
    border-bottom: 1px solid rgba(201, 162, 39, 0.15);
}

.chat__header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat__header-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    border-radius: 50%;
    font-size: 1.2rem;
}

.chat__header-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--chat-dark);
    margin: 0;
}

.chat__header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--chat-gray);
    margin: 0;
}
/*
.chat__header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
}*/

.chat__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: var(--chat-gray);
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat__close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--chat-dark);
}

/* ============================================
   Formulario de Registro
   ============================================ */

.chat__register {
    flex: 1;
    padding: 28px;
    background: var(--chat-white);
    overflow-y: auto;
}

.chat__register-intro {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, var(--chat-cream) 0%, #F5F0E8 100%);
    border-radius: var(--chat-radius-sm);
    border-left: 4px solid var(--chat-primary);
}

.chat__register-intro p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--chat-dark);
    line-height: 1.6;
}

.chat__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat__form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat__form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--chat-dark);
    letter-spacing: 0.02em;
}

.chat__form-group input,
.chat__form-group select {
    padding: 14px 18px;
    border: 2px solid #E8E8E8;
    border-radius: var(--chat-radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--chat-white);
}

.chat__form-group input:focus,
.chat__form-group select:focus {
    outline: none;
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.1);
}

.chat__form-group input.error,
.chat__form-group select.error {
    border-color: #dc3545;
}

.chat__form-group input.success {
    border-color: #4CAF50;
}

.chat__form-status {
    font-size: 0.8rem;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat__form-status.success {
    color: #4CAF50;
}

.chat__form-status.error {
    color: #dc3545;
}

.chat__form-hidden {
    display: none;
}

.chat__form-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: var(--chat-white);
    border: none;
    border-radius: var(--chat-radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.chat__form-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.4);
}

.chat__form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Área de Conversación
   ============================================ */

.chat__conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-cream);
    overflow: hidden;
}

.chat__messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Scrollbar elegante */
.chat__messages::-webkit-scrollbar {
    width: 6px;
}

.chat__messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat__messages::-webkit-scrollbar-thumb {
    background: rgba(201, 162, 39, 0.3);
    border-radius: 3px;
}

.chat__messages::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 162, 39, 0.5);
}

/* ============================================
   Mensajes - Estilo Conversacional
   ============================================ */

.chat__message-wrapper {
    display: flex;
    flex-direction: column;
    animation: messageIn 0.3s ease;
}

.chat__message-wrapper--user {
    align-items: flex-end;
}

.chat__message-wrapper--assistant {
    align-items: flex-start;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat__message {
    max-width: 80%;
    padding: 14px 18px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat__message--user {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: var(--chat-white);
    border-radius: 18px 18px 4px 18px;
}

.chat__message--assistant {
    background: var(--chat-white);
    color: var(--chat-dark);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat__message-time {
    font-size: 0.7rem;
    color: var(--chat-gray);
    margin-top: 6px;
    padding: 0 4px;
}

/* ============================================
   Productos Recomendados
   ============================================ */

.chat__products {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-bottom: 4px;
    overflow-x: auto;
}

.chat__products::-webkit-scrollbar {
    height: 4px;
}

.chat__products::-webkit-scrollbar-thumb {
    background: rgba(201, 162, 39, 0.3);
    border-radius: 2px;
}

.chat__product {
    flex-shrink: 0;
    width: 160px;
    padding: 14px;
    background: var(--chat-white);
    border: 1px solid #E8E8E8;
    border-radius: var(--chat-radius-sm);
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.chat__product:hover {
    border-color: var(--chat-primary);
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.15);
    transform: translateY(-2px);
}

.chat__product-image {
    width: 100%;
    height: 100px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 8px;
    background: var(--chat-cream);
}

.chat__product-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--chat-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat__product-price {
    font-size: 0.9rem;
    color: var(--chat-primary-dark);
    font-weight: 700;
    margin-bottom: 10px;
}

.chat__product-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--chat-dark);
    color: var(--chat-white);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.chat__product:hover .chat__product-btn {
    background: var(--chat-primary);
}

/* ============================================
   Input de Mensaje
   ============================================ */

.chat__input-container {
    padding: 20px 24px;
    background: var(--chat-white);
    border-top: 1px solid rgba(201, 162, 39, 0.1);
}

.chat__messages-remaining {
    font-size: 0.75rem;
    color: var(--chat-gray);
    margin-bottom: 10px;
    text-align: center;
}

.chat__messages-remaining.warning {
    color: #dc3545;
}

.chat__input-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat__input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #E8E8E8;
    border-radius: 25px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--chat-gray-light);
}

.chat__input:focus {
    outline: none;
    border-color: var(--chat-primary);
    background: var(--chat-white);
}

.chat__input::placeholder {
    color: #999;
}

.chat__send {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: var(--chat-white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat__send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.4);
}

.chat__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat__send i {
    font-size: 1.1rem;
}

/* ============================================
   Typing Indicator
   ============================================ */

.chat__typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    background: var(--chat-white);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    width: fit-content;
}

.chat__typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chat-primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.chat__typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat__typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* ============================================
   Mensaje de Límite
   ============================================ */

.chat__limit {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--chat-white);
    text-align: center;
}

.chat__limit-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.chat__limit-message {
    font-size: 1rem;
    color: var(--chat-gray);
    line-height: 1.6;
    margin-bottom: 28px;
    max-width: 300px;
}

.chat__limit-btn {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: var(--chat-white);
    text-decoration: none;
    border-radius: var(--chat-radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.chat__limit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.4);
}



/* ============================================
   Producto Card con Compartir
   ============================================ */

.chat__product-card {
    display: flex;
    flex-direction: column;
    background: var(--chat-white);
    border: 1px solid #E8E8E8;
    border-radius: var(--chat-radius-sm);
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat__product-card:hover {
    border-color: var(--chat-primary);
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.15);
}

.chat__product-card .chat__product {
    border: none;
    border-radius: 0;
    width: 100%;
}

.chat__product-card .chat__product:hover {
    transform: none;
    box-shadow: none;
}

/* Botones de compartir */
.chat__product-share {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--chat-gray-light);
    border-top: 1px solid #E8E8E8;
}

.chat__share-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--chat-white);
    border: 1px solid #E0E0E0;
    border-radius: 50%;
    color: var(--chat-gray);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.chat__share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* Colores específicos por red social */
.chat__share-btn--whatsapp:hover {
    background: #25D366;
    border-color: #25D366;
    color: white;
}

.chat__share-btn--facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: white;
}

.chat__share-btn--twitter:hover {
    background: #000000;
    border-color: #000000;
    color: white;
}

.chat__share-btn[data-action="copy"]:hover {
    background: var(--chat-primary);
    border-color: var(--chat-primary);
    color: white;
}

/* Responsive */
@media (max-width: 480px) {
    .chat__product-share {
        gap: 6px;
        padding: 8px;
    }
    
    .chat__share-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}



/* ============================================
   Sugerencia de Email (Typo)
   ============================================ */

.chat__form-suggestion {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CD 100%);
    border: 1px solid #FFE69C;
    border-radius: var(--chat-radius-sm);
    font-size: 0.85rem;
    color: #664D03;
    margin-top: 8px;
}

.chat__form-suggestion strong {
    color: #1A1A1A;
}

.chat__suggestion-btn {
    padding: 6px 14px;
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.chat__suggestion-btn:hover {
    background: var(--chat-primary-dark);
    transform: translateY(-1px);
}
/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .chat-section {
        padding: var(--spacing-md) 0;
    }
    
    .chat:not([data-minimizable="true"]) {
        padding: 0 var(--spacing-sm);
    }
    
    .chat:not([data-minimizable="true"]) .chat__window {
        height: 550px;
    }
    
    .chat[data-minimizable="true"] {
        bottom: 16px;
        right: 16px;
    }
    
    .chat[data-minimizable="true"] .chat__toggle span {
        display: none;
    }
    
    .chat[data-minimizable="true"] .chat__toggle {
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
    
    .chat[data-minimizable="true"] .chat__window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .chat__header {
        padding: 16px 20px;
    }
    
    .chat__messages {
        padding: 16px;
        gap: 16px;
    }
    
    .chat__message {
        max-width: 85%;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .chat__product {
        width: 140px;
        padding: 12px;
    }
    
    .chat__product-image {
        height: 80px;
    }
}

@media (max-width: 480px) {
    .chat__message {
        max-width: 90%;
    }
    
    .chat__products {
        gap: 10px;
    }
    
    .chat__product {
        width: 130px;
    }
}