/* custom_styles.css - Estilos personalizados con variables */

/* Variables (con valores por defecto si no se definen desde admin) */
:root {
    --primary-color: #2563EB;
    /* Azul Rey por defecto */
    --secondary-color: #1E40AF;
    /* Azul Oscuro */
    --accent-color: #ff6b6b;
    /* Rojo/Coral */
}

/* Welcome Modal Styles */
.welcome-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.welcome-modal {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.5s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.welcome-modal h2 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.welcome-modal p {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.welcome-features {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.feature-icon {
    font-size: 2rem;
}

.start-tour-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.start-tour-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

/* FAB Styles */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
}

.like-fab,
.share-fab,
.guide-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.like-fab {
    background: var(--accent-color);
}

.share-fab {
    background: #4ecdc4;
}

.guide-fab {
    background: var(--primary-color);
    font-size: 30px;
}

.like-fab:hover,
.share-fab:hover,
.guide-fab:hover {
    transform: scale(1.1);
}

.like-count {
    font-size: 12px;
    margin-top: -5px;
}

.like-fab.liked {
    animation: heartBeat 0.5s;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.floating-heart {
    position: fixed;
    color: var(--accent-color);
    font-size: 24px;
    pointer-events: none;
    animation: floatUp 1.5s ease-out forwards;
    z-index: 1001;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    z-index: 2000;
    animation: fadeInOut 3s ease forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    90% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* ========================================
   MODO VOZ Y NUEVO DISEÑO
   ======================================== */

.chat-window.modern-design {
    position: fixed;
    width: 380px;
    height: 600px;
    background: #f3f4f6;
    /* Gris muy claro de fondo */
    bottom: 20px;
    right: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-window.modern-design.hidden {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
}

/* --- HEADER SUPERIOR --- */
.chat-header-top {
    background: var(--primary-color);
    /* <--- VARIABLE RESTAURADA */
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-branding {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-branding .svg-avatar {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    padding: 2px;
}

.chat-title-text {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.3px;
}

.chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.chat-close:hover {
    opacity: 1;
}

/* --- CONTROLES (SWITCH Y IDIOMA) --- */
.chat-header-controls {
    background: var(--primary-color);
    /* <--- VARIABLE RESTAURADA */
    padding: 0 16px 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mode-switch-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 3px;
    display: flex;
    gap: 2px;
}

.mode-switch-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mode-switch-btn.active {
    background: white;
    color: #1F2937;
    /* Gris oscuro */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mode-switch-btn:hover:not(.active) {
    color: white;
}

.modern-lang-select {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.modern-lang-select option {
    background: white;
    color: #333;
}

/* --- MENSAJES --- */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #F3F4F6;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-group {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.message-group.bot {
    align-self: flex-start;
}

.message-group.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar-small {
    flex-shrink: 0;
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.message-sender-name {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 4px;
    margin-left: 2px;
}

.message {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.bot-bubble {
    background: white;
    color: #1F2937;
    border-top-left-radius: 2px;
}

.message.user-bubble {
    background: var(--primary-color);
    /* <--- VARIABLE RESTAURADA */
    color: white;
    border-top-right-radius: 2px;
}

/* Typing indicator */
.typing-indicator {
    padding: 5px;
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

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

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

@keyframes typing {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* --- INPUT AREA --- */
.modern-input-area {
    background: white;
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-pill-container {
    flex: 1;
    background: #F3F4F6;
    border-radius: 24px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    transition: border 0.2s;
}

.input-pill-container:focus-within {
    border-color: var(--primary-color);
    /* <--- VARIABLE RESTAURADA */
    background: white;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    /* Nota: el box shadow azul transparente podría necesitar ajuste dinámico, 
       pero por ahora lo dejo sutil. Si quieres que también cambie, 
       necesitaríamos inyectar el color en estilo inline o usar opacidades */
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    color: #374151;
    width: 100%;
}

.voice-mic-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #6B7280;
    padding: 4px;
    border-radius: 50%;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-mic-icon:hover {
    color: var(--primary-color);
    /* <--- VARIABLE RESTAURADA */
    background: rgba(0, 0, 0, 0.05);
}

.voice-mic-icon.listening {
    color: var(--accent-color);
    /* <--- VARIABLE RESTAURADA */
    animation: pulse 1.5s infinite;
}

.modern-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #4B5563;
    /* Gris oscuro para contraste por defecto */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.modern-send-btn:hover {
    background: #374151;
    transform: scale(1.05);
}

.modern-send-btn:active {
    transform: scale(0.95);
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .chat-window.modern-design {
        width: 100% !important;
        max-width: 100% !important;
        height: 50vh !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    .chat-messages {
        padding: 15px;
    }

    /* Header ajustes */
    .chat-header-top {
        padding: 10px 14px;
    }

    .chat-header-controls {
        padding: 0 14px 10px 14px;
    }

    /* Cuando está activo el modo voz */
    .modern-input-area.voice-mode-active {
        flex-direction: column;
        justify-content: center;
        padding: 20px;
        min-height: 140px;
    }

    /* En modo voz móvil, ocultamos input de texto y mostramos mic gigante */
    .modern-input-area.voice-mode-active .input-pill-container,
    .modern-input-area.voice-mode-active .modern-send-btn {
        display: none;
    }

    /* Botón micrófono gigante en modo voz */
    .modern-input-area.voice-mode-active::after {
        content: '🎤';
        font-size: 40px;
        width: 80px;
        height: 80px;
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        /* <--- VAR RESTAURADA */
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        animation: pulse 2s infinite;
        cursor: pointer;
    }

    /* Ajuste de FABs */
    .chat-window:not(.hidden)~.fab-container {
        bottom: calc(50vh + 20px);
    }
}