/* ==========================================================================
   SYNTHIA PROSPECTOR WEBCHAT - GENERIC STYLES
   ========================================================================== */

/* --- Variables de Tema (Personalizar aquí) --- */
:root {
    --chat-primary-color: #6eb2de;
    /* Color principal (header, burbujas user) */
    --chat-primary-gradient: linear-gradient(135deg, #6eb2de 0%, #5a7bb6 100%);
    --chat-secondary-color: #ff8826;
    /* Color secundario (burbujas bot) */
    --chat-secondary-gradient: linear-gradient(135deg, #ff8826 0%, #ee7844 100%);
    --chat-font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --chat-bg-image: none;
    /* Imagen de fondo del chat (opcional) */
    --dock-height: 80px;
    --dock-bg: #412927;
    --dock-border: #FC653C;
    --dock-inner-bg: #fff;
}

/* --- Header del Chat --- */
.chat-layout .chat-header {
    background: var(--chat-primary-gradient) !important;
    gap: 0em !important;
    display: flex;
    align-items: center;
}

.chat-layout .chat-header h1 {
    font-size: 24px !important;
    /* Ajustado para ser más genérico */
    color: #fff;
    margin-bottom: 0;
}

/* Avatar personalizado en header */
.custom-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    box-shadow: 0 0 0 2px white;
    border: 2px solid var(--chat-primary-color);
}

/* --- Cuerpo del Chat --- */
.chat-layout .chat-body {
    background-image: var(--chat-bg-image) !important;
    background-size: cover;
    background-position: center;
}

/* Mensajes */
.chat-message p,
.chat-message-markdown {
    line-height: 1.4 !important;
    font-family: var(--chat-font-family) !important;
}

.chat-message.chat-message-from-user:not(.chat-message-transparent) {
    background: var(--chat-primary-gradient) !important;
    color: #fff;
    border-radius: 0.8em 0.8em 0 0.8em;
}

.chat-message.chat-message-from-bot:not(.chat-message-transparent) {
    background: var(--chat-secondary-gradient) !important;
    color: #fff;
    border-radius: 0.8em 0.8em 0.8em 0;
}

/* --- Botón Toggle (Flotante) --- */
.chat-window-toggle {
    background: var(--chat-primary-gradient) !important;
    animation: pulse 3s infinite;
    transition: all 0.3s ease;
}

/* Estado abierto */
.chat-window-toggle.chat-open {
    background: var(--chat-secondary-gradient) !important;
    animation: none !important;
    box-shadow: none !important;
    transform: rotate(90deg);
    /* Efecto visual al abrir */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(110, 178, 222, 0.5);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(110, 178, 222, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(110, 178, 222, 0);
    }
}

/* --- Banner CTA (Call to Action) --- */
.chat-cta-wrapper {
    position: fixed;
    right: calc(60px + 20px);
    /* Ajustar según tamaño del toggle */
    bottom: 20px;
    z-index: 9998;
    pointer-events: none;
    animation: slideIn 0.5s ease-out forwards;
}

.chat-cta-banner {
    background: #fff;
    color: var(--chat-primary-color);
    border: 2px solid var(--chat-primary-color);
    padding: 10px 15px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: float 4s ease-in-out infinite;
}

.chat-hidden {
    display: none !important;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* responsive CTA */
@media (max-width: 768px) {
    .chat-cta-wrapper {
        right: 20px;
        bottom: 80px;
        /* Arriba del toggle en móbile */
    }
}

/* --- Quick Replies (Botones de Respuesta Rápida) --- */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 15px;
}

.quick-reply-btn {
    border: 1px solid var(--chat-primary-color);
    background: #fff;
    color: var(--chat-primary-color);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}

.quick-reply-btn:hover {
    background: var(--chat-primary-color);
    color: #fff;
}

/* --- Consent Notice --- */
.chat-layout .chat-body .chat-consent-notice {
    display: inline-block !important;
    box-sizing: border-box !important;
    margin: 10px 15px 12px !important;
    padding: 8px 11px !important;
    max-width: calc(100% - 30px) !important;
    border: 1px solid rgba(90, 123, 182, 0.28) !important;
    border-radius: 0.9em 0.9em 0.9em 0.3em !important;
    background: linear-gradient(135deg, rgba(255, 136, 38, 0.14) 0%, rgba(110, 178, 222, 0.18) 100%) !important;
    box-shadow: 0 6px 14px rgba(10, 45, 74, 0.08) !important;
    color: #36516f !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    vertical-align: top !important;
    position: relative !important;
    z-index: 1 !important;
}

.chat-layout .chat-body .chat-consent-notice-text {
    color: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

.chat-layout .chat-body .chat-consent-notice-link {
    color: var(--chat-primary-color) !important;
    font-size: inherit !important;
    font-weight: 700 !important;
    text-decoration: underline !important;
}

/* --- Input Area --- */
.chat-layout button[aria-label="Send"],
.chat-input-send-button {
    background: var(--chat-primary-gradient) !important;
    color: #fff !important;
    border-radius: 50% !important;
}

.chat-input-locked {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(1);
}

/* --- Modo AI First (Dock Persistente) --- */
body.mode-ai-first .chat-window-toggle,
body.mode-ai-first .chat-cta-wrapper {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.mode-ai-first {
    --ai-first-surface: var(--dock-bg, #412927);
    --ai-first-accent: var(--dock-border, #FC653C);
    --ai-first-font-family: var(--chat-font-family, 'Montserrat', system-ui, sans-serif);
}

body.mode-ai-first.dock-hide-native-input .chat-window-wrapper footer,
body.mode-ai-first.dock-hide-native-input .chat-window-wrapper .chat-input,
body.mode-ai-first.dock-hide-native-input .chat-window-wrapper textarea {
    display: none !important;
}

body.mode-ai-first .chat-window-wrapper {
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%) !important;
    bottom: calc(var(--dock-height, 80px) + 10px) !important;
    position: fixed !important;
    width: min(95vw, var(--ai-first-width, 600px)) !important;
    max-width: 95vw !important;
    z-index: 9999 !important;
}

body.mode-ai-first .chat-window-wrapper .chat-window,
body.mode-ai-first .chat-window-wrapper .chat-layout {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    font-family: var(--ai-first-font-family) !important;
}

body.mode-ai-first .chat-window-wrapper .chat-window {
    overflow: hidden !important;
    border: 2px solid var(--ai-first-accent) !important;
    border-radius: 16px !important;
}

body.mode-ai-first .chat-layout .chat-header {
    position: relative !important;
    justify-content: center !important;
    min-height: 86px !important;
    padding: 18px 58px 16px !important;
    background: linear-gradient(135deg, var(--ai-first-surface) 0%, #8e3f2f 100%) !important;
    border: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    color: #fff !important;
    font-family: var(--ai-first-font-family) !important;
    text-align: center !important;
}

body.mode-ai-first .chat-layout .chat-header h1,
body.mode-ai-first .chat-layout .chat-header p,
body.mode-ai-first .chat-message,
body.mode-ai-first .chat-message p,
body.mode-ai-first .chat-message-markdown {
    font-family: var(--ai-first-font-family) !important;
    letter-spacing: 0 !important;
}

body.mode-ai-first .chat-message.chat-message-from-user:not(.chat-message-transparent) {
    background: var(--ai-first-accent) !important;
    color: #fff !important;
}

body.mode-ai-first .chat-message.chat-message-from-bot:not(.chat-message-transparent) {
    background: #8f98a6 !important;
    color: #fff !important;
}

body.mode-ai-first .sp-chat-close-button {
    position: absolute !important;
    right: 18px !important;
    top: 18px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #fff !important;
    font-size: 30px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}

body.mode-ai-first .sp-chat-close-button:hover,
body.mode-ai-first .sp-chat-close-button:focus-visible {
    background: #fff !important;
    color: var(--ai-first-accent) !important;
    transform: scale(1.04) !important;
    outline: none !important;
}

body.mode-ai-first #chat-dock,
body.mode-ai-first #chat-dock * {
    box-sizing: border-box !important;
}

body.mode-ai-first #chat-dock {
    width: min(95vw, var(--ai-first-width, 600px));
    max-width: 95vw;
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: 0 !important;
    transform: translateX(-50%) !important;
    z-index: 10000 !important;
    background-color: var(--ai-first-surface);
    border-radius: 1rem 1rem 0 0;
    border: 2px solid var(--ai-first-accent);
    border-bottom: none;
    padding: 10px 10px 15px;
    box-sizing: border-box;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    display: block !important;
}

body.mode-ai-first .dock-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--dock-inner-bg, #fff);
    border: 2px solid var(--ai-first-accent);
    border-radius: 1rem;
    padding: 5px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.mode-ai-first .dock-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
}

body.mode-ai-first .dock-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.mode-ai-first #dock-input {
    flex: 1;
    min-width: 0;
    border: none;
    font-size: 16px;
    outline: none;
    padding: 5px;
    background: transparent;
    color: #30333a;
}

body.mode-ai-first #dock-send {
    background: var(--ai-first-accent);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

body.mode-ai-first #dock-send:hover,
body.mode-ai-first #dock-send:focus-visible {
    background: #fff;
    color: var(--ai-first-accent);
    transform: scale(1.05);
    outline: none;
}

body.mode-ai-first #dock-quick-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    justify-content: center;
    scrollbar-width: none;
}

body.mode-ai-first #dock-quick-bar::-webkit-scrollbar {
    display: none;
}

body.mode-ai-first .dock-quick-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--ai-first-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

body.mode-ai-first .dock-quick-btn:hover,
body.mode-ai-first .dock-quick-btn:focus-visible {
    background: #fff;
    color: var(--ai-first-accent);
    transform: translateY(-1px);
    outline: none;
}

@media (max-width: 768px) {
    body.mode-ai-first .chat-window-wrapper {
        width: 95vw !important;
        bottom: var(--dock-height, 80px) !important;
    }

    body.mode-ai-first #dock-quick-bar {
        justify-content: flex-start;
    }
}
