:root {
    /* --- PALETA DE COLORES: MODO OSCURO --- */
    /* --- THEME: DARK MODE --- */
    --primary-color: #2C2C2E; /* Encabezado: Gris oscuro */
    --primary-color-hover: #3A3A3C; /* Hover: Gris un poco más claro */
    --chat-bubble-background: #ffffff;
    --chat-bubble-border-color: #F59E0B;

    --user-message-background: #0A84FF; /* Burbuja Usuario: Azul brillante */
    --user-message-text: #FFFFFF; /* Texto Usuario: Blanco */
    --bot-message-background: #3A3A3C; /* Burbuja Bot: Gris medio */
    --bot-message-text: #F2F2F2; /* Texto Bot: Blanco roto */
    --chat-window-background: #1A1A1A; /* Fondo Ventana: Casi negro */
    --link-color: #0A84FF; /* Color para enlaces */

    /* --- SIZING & SPACING --- */
    --spacing-xs: 0.25rem;  /* 4px */
    --spacing-sm: 0.5rem;   /* 8px */
    --spacing-md: 1rem;     /* 16px */
    --spacing-lg: 1.5rem;   /* 24px */
    --border-radius-sm: 8px;
    --border-radius-md: 15px;
    --border-radius-lg: 20px;
    --border-radius-full: 50%;
}

body {
    font-family: 'Inter', sans-serif;
}

/* Estilos para la ventana de chat */
#chat-widget-container {
    position: fixed;
    bottom: 20px;
    left: auto;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    gap: var(--spacing-sm);
}

#chat-bubble {
    background-color: var(--chat-bubble-background);
    border: 3px solid var(--chat-bubble-border-color);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease-in-out;
    overflow: hidden;
}

#chat-bubble:hover {
    transform: scale(1.1);
}

#chat-window {
    width: 100%;
    max-width: 400px;
    height: 600px;
    background-color: var(--chat-window-background);
    border-radius: 15px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

#chat-window.hidden {
    transform: scale(0);
    opacity: 0;
}

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    padding: 0.75rem var(--spacing-md);
    border-top-left-radius: var(--border-radius-md);
    border-top-right-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    gap: var(--spacing-sm);
}

#chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-radius: var(--border-radius-full);
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.5);
}

.header-text h3 {
    font-weight: 600; /* Semi-bold para el título */
    font-size: 1.05rem; /* Ligeramente más grande */
    line-height: 1.2;
    color: #FFFFFF;
}

.header-text p {
    font-size: 0.8rem;
    opacity: 0.8;
    color: #E5E5EA;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    gap: var(--spacing-sm);
}

.header-actions button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    padding: var(--spacing-xs);
    border-radius: var(--border-radius-full);
    transition: background-color 0.2s;
}

.header-actions button:hover {
    background-color: rgba(255,255,255,0.2);
}

.chat-messages {
    flex-grow: 1;
    padding: 1rem;
    padding: var(--spacing-md);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    gap: 0.75rem; /* 12px */
}

.message {
    padding: 12px 18px; /* Un poco más de padding */
    border-radius: 20px;
    padding: 0.75rem 1.125rem; /* 12px 18px */
    border-radius: var(--border-radius-lg);
    max-width: 80%;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 1.05rem; /* NUEVO: Tamaño de letra aumentado */
    font-size: 1.05rem;
}

.user-message {
    background-color: var(--user-message-background);
    color: var(--user-message-text);
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    margin-left: auto;
}

.bot-message {
    background-color: var(--bot-message-background);
    color: var(--bot-message-text);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    margin-right: auto;
}

.bot-message p { margin-bottom: 0.75em; }
.bot-message p:last-child { margin-bottom: 0; }
.bot-message ul {
    list-style-type: disc;
    padding-left: 20px;
    padding-left: 1.25rem; /* 20px */
    margin-top: 0.5em;
    margin-bottom: 0.75em;
}
.bot-message li { margin-bottom: 0.25em; }

.bot-message a {
    color: var(--link-color) !important;
    font-weight: bold !important;
    text-decoration: underline;
}
.bot-message a:hover {
    text-decoration: none;
}

.bot-message .info-request {
    background-color: #2C2C2E; /* Fondo oscuro */
    border-left: 4px solid #30D158; /* Verde brillante de iOS */
    padding: 12px;
    margin-top: 12px;
    border-radius: 8px;
    padding: 0.75rem; /* 12px */
    margin-top: 0.75rem; /* 12px */
    border-radius: var(--border-radius-sm);
    font-weight: 500;
}
.bot-message .info-request strong {
    color: #FFFFFF; /* Texto blanco */
}

.chat-input-area {
    border-top: 1px solid #3A3A3C;
    padding: 0.75rem 1rem;
    padding: 0.75rem var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
    gap: var(--spacing-sm);
    flex-shrink: 0;
    background-color: var(--chat-window-background);
}

.promo-link {
    font-size: 1rem;
    font-weight: 500;
    color: var(--link-color) !important;
    text-align: center;
    text-decoration: none;
    transition: color 0.2s;
}

.promo-link:hover {
    text-decoration: underline;
}

.chat-input {
    display: flex;
    gap: 10px;
    gap: var(--spacing-sm);
}

.chat-input input {
    flex-grow: 1;
    background-color: #2C2C2E;
    color: #FFFFFF;
    border: 1px solid #3A3A3C;
    border-radius: 20px;
    padding: 10px 15px;
    border-radius: var(--border-radius-lg);
    padding: 0.625rem 0.9375rem; /* 10px 15px */
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input::placeholder {
    color: #8E8E93;
}

.chat-input input:focus {
    border-color: var(--link-color);
}

.chat-input button {
    background-color: var(--link-color);
    color: white;
    border: none;
    border-radius: 50%;
    border-radius: var(--border-radius-full);
    width: 44px;
    height: 44px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-input button:hover {
    background-color: #0A84FF99; /* Azul con opacidad */
}

.thinking-indicator {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 5px;
    gap: 0.3125rem; /* 5px */
}

.thinking-indicator span {
    width: 8px;
    height: 8px;
    background-color: #8E8E93;
    border-radius: 50%;
    border-radius: var(--border-radius-full);
    animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-indicator span:nth-child(1) { animation-delay: -0.32s; }
.thinking-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

@media (max-width: 450px) {
    #chat-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        border-radius: 0; /* Override */
        bottom: 0;
        right: 0;
    }
    #chat-widget-container {
        bottom: 15px;
        left: auto;
        right: 15px;
    }
    #chat-bubble {
        width: 55px;
        height: 55px;
        overflow: hidden;
    }
    .message {
        font-size: 1.1rem;
        font-weight: 500;
    }
}
