/* --- Archivo: /admin/assets/css/mia-widget.css --- */

@font-face {
    font-family: 'MayangGlyphsOutline';
    src: url('../mayanglyphsoutline-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 🌓 Theme Variables: Dark (default) / Light */
:root {
    --bg-primary: #020617;
    --bg-secondary: #0f172a;
    --bg-input: #0f172a;
    --bg-input-hover: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-placeholder: #64748b;
    --border-color: #334155;
    --border-focus: #06b6d4;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --btn-send-bg: #0891b2;
    --btn-send-hover: #06b6d4;
    --overlay-bg: rgba(2, 6, 23, 0.75);
    --card-bg: #0f172a;
    --card-border: #334155;
    --scrollbar-thumb: #334155;
    --map-bg: #0f172a;
}

:root[data-theme="light"] {
    --bg-primary: #efeae2;          /* 🌿 Fondo crema cálido estilo WhatsApp */
    --bg-secondary: #f7f4ef;        /* Fondo secundario suave */
    --bg-input: #ffffff;            /* Blanco puro en cuadro de texto */
    --bg-input-hover: #f5f0e6;
    --text-primary: #0f172a;        /* Texto slate-900 oscuro para contraste óptimo */
    --text-secondary: #334155;      /* Texto secundario nítido */
    --text-placeholder: #64748b;
    --border-color: #d6cfc4;        /* Borde cálido sutil */
    --border-focus: #0284c7;        /* Azul/cyan de alta visibilidad */
    --accent-cyan: #0284c7;         /* Azul cyánico de alto contraste */
    --accent-pink: #c026d3;         /* Magenta vívido de alto contraste */
    --btn-send-bg: #0284c7;         /* Botón enviar en azul potente */
    --btn-send-hover: #0369a1;
    --overlay-bg: rgba(239, 234, 226, 0.85);
    --card-bg: #ffffff;             /* Tarjetas y burbujas de bot en blanco brillante */
    --card-border: #dcd6cd;
    --scrollbar-thumb: #cbd5e1;
    --map-bg: #e5dfd5;
}

/* 🌌 Gemini-Style Atmospheric Bottom Light Effect (Cyan + Blue + Magenta) */
#gemini-light-effect {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 75vh;
    pointer-events: none;
    z-index: 1;
    background: 
        radial-gradient(ellipse 110% 65% at 50% 100%, 
            rgba(6, 182, 212, 0.35) 0%, 
            rgba(236, 72, 153, 0.25) 35%, 
            rgba(30, 58, 138, 0.18) 65%, 
            transparent 90%),
        radial-gradient(circle at 20% 95%, 
            rgba(6, 182, 212, 0.30) 0%, 
            transparent 50%),
        radial-gradient(circle at 80% 95%, 
            rgba(236, 72, 153, 0.30) 0%, 
            transparent 50%);
    filter: blur(40px);
    transition: opacity 0.5s ease;
    opacity: 1;
}

:root[data-theme="light"] #gemini-light-effect {
    opacity: 0.35;
    background: 
        radial-gradient(ellipse 110% 65% at 50% 100%, 
            rgba(2, 132, 199, 0.22) 0%, 
            rgba(192, 38, 211, 0.15) 35%, 
            transparent 80%);
}

/* Estilos de las Tarjetas de Información MIA (Tema Adaptativo) */
.mia-card {
    background-color: var(--card-bg); 
    border: 1px solid var(--card-border); 
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease;
    text-align: left;
    width: 100%;
}

.mia-card:hover {
    border-color: var(--accent-cyan); /* Resplandor cyan al pasar el mouse */
    transform: translateY(-2px);
}

.mia-texto-general {
    font-size: 0.875rem; /* text-sm */
    color: var(--text-primary); 
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

/* El botón dinámico para ver en el mapa */
.badge-mapa {
    display: inline-flex;
    align-items: center;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--accent-cyan);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

/* Botón dinámico para navegar con Waze */
.badge-waze {
    display: inline-flex;
    align-items: center;
    background: rgba(51, 204, 255, 0.1); 
    border: 1px solid rgba(51, 204, 255, 0.3);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #33ccff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none; /* Para quitar el subrayado porque usaremos un <a> */
}

.badge-waze:hover {
    background: rgba(51, 204, 255, 0.25);
    box-shadow: 0 0 10px rgba(51, 204, 255, 0.4);
    transform: translateY(-1px);
}

.badge-mapa:hover {
    background: rgba(6, 182, 212, 0.25);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* ========================================== */
/* MIA WIDGET - POP-UP DE LOCALIZACIONES      */
/* ========================================== */

/* Fondo oscuro (Overlay) */
.mia-popup-overlay {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px); /* Efecto cristal moderno */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Estado activo del overlay para la animación */
.mia-popup-overlay.active {
    display: flex;
    opacity: 1;
}

/* Tarjeta principal */
.mia-popup-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Animación de entrada de la tarjeta */
.mia-popup-overlay.active .mia-popup-card {
    transform: translateY(0);
}

/* Botón de cerrar (X) */
.mia-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mia-popup-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Imagen de cabecera */
.mia-popup-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-primary);
    display: block;
}

/* Contenedor de la información */
.mia-popup-content {
    padding: 20px;
}

/* Cabecera (Título y Rating) */
.mia-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 10px;
}

.mia-popup-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.mia-popup-rating {
    background: #fef08a;
    color: #854d0e;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Categoría */
.mia-popup-category {
    margin: 0 0 16px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Dirección */
.mia-popup-address-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.mia-popup-address-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

/* Estado (Abierto/Cerrado) */
.mia-popup-status-row {
    margin-bottom: 20px;
}

.mia-popup-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Contenedor de Botones */
.mia-popup-actions {
    display: flex;
    gap: 12px;
}

/* Botones genéricos */
.mia-popup-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Botón Primario (Cómo llegar) */
.mia-popup-btn-primary {
    background: var(--btn-send-bg);
    color: #ffffff;
    border: none;
}

.mia-popup-btn-primary:hover {
    background: var(--btn-send-hover);
}

/* Botón Secundario (Sitio Web) */
.mia-popup-btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.mia-popup-btn-secondary:hover {
    background: var(--bg-input-hover);
    border-color: var(--accent-cyan);
}

/* ==========================================================
   MIA MAP POPUPS (Anulación del estilo blanco de MapLibre)
   ========================================================== */
.mia-dark-popup .maplibregl-popup-content {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
}
.mia-dark-popup .maplibregl-popup-tip {
    display: none !important;
}
.mia-dark-popup {
    margin-top: -5px; /* Separación sutil entre la etiqueta y el pin */
    z-index: 50;
}

/* 🟢 Estilo 1: Minimalista y Elegante (Fondo oscuro, borde sutil) */
.map_pin_label_1 {
    background-color: #0f172a; /* slate-900 */
    color: #f1f5f9; /* slate-100 */
    padding: 6px 12px;
    border-radius: 0.5rem;
    border: 1px solid #334155; /* slate-700 */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 🟣 Estilo 2: Cyberpunk Neon (Borde y sombra rosa brillante) */
.map_pin_label_2 {
    background-color: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 0.375rem;
    border: 1px solid rgba(236, 72, 153, 0.5); /* pink-500/50 */
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* 🔵 Estilo 3: Glassmorphism (Cristal Translúcido, requiere soporte backdrop-filter) */
.map_pin_label_3 {
    background-color: rgba(30, 41, 59, 0.6); /* slate-800/60 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

/* ==========================================================
   MIA MARKDOWN OVERRIDE (Opción Nuclear)
   ========================================================== */

/* 1. Sometemos ABSOLUTAMENTE TODO el texto dentro del chat a 14px */
#chat-box * {
    font-size: 14px !important;
    line-height: 1.6 !important;
}

/* 2. Rescatamos los títulos de las tarjetas (Enlaces) para que sean clickeables */
#chat-box a > strong,
#chat-box strong > a {
    font-size: 15px !important;
    color: var(--accent-cyan) !important;
    text-decoration: none !important;
    cursor: pointer !important;
}

#chat-box a > strong:hover {
    color: var(--btn-send-hover) !important;
    text-decoration: underline !important;
}

/* 3. ELIMINACIÓN DE DOBLES RAYAS: Apagamos todos los <hr> que genere Gemini */
#chat-box hr {
    display: none !important;
}

/* 4. Letra pequeña para el Patrocinador y avisos menores */
#chat-box small, #chat-box em {
    font-size: 11px !important;
    color: var(--text-secondary) !important;
}

/* ==========================================================
   MIA THOUGHT FONT (Mayanglyphs Outline)
   ========================================================= */
.mia-thought-font {
    font-family: 'MayangGlyphsOutline', monospace;
}

.mia-thought-rtl {
    direction: rtl;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
}

/* ==========================================================
   MIA LEGAL DISCLAIMER (Aviso de IA)
   ========================================================== */
.mia-legal-disclaimer {
    font-size: 0.7rem;        /* Aproximadamente 11px - Muy pequeño */
    color: var(--text-placeholder); 
    text-align: center;       /* Centrado debajo de la barra */
    margin-top: 8px;          /* Separación de la barra de texto */
    margin-bottom: 4px;
    letter-spacing: 0.02em;
    font-weight: 400;
}

/* ==========================================================
   MIA MAP WRAPPER (FORZADO ANTI-PURGA Y ANTI-COLAPSO)
   ========================================================== */
#mia-map-wrapper {
    width: 100%;
    height: 0px;
    min-height: 0px;
    opacity: 0;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease, min-height 0.5s ease;
    overflow: hidden;
    position: relative;
    flex-shrink: 0; /* 🛡️ ESTO EVITA QUE EL CHAT LO APLASTE EN FLEXBOX */
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 1rem 1rem 0 0;
    z-index: 10;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.15);
}

/* Clase que el JS (mia-core.js) activará para desplegar el mapa */
#mia-map-wrapper.map-active {
    height: 35vh;
    min-height: 250px;
    opacity: 1;
}

#mia-mini-map {
    width: 100%;
    height: 100%;
}

/* ==========================================================
   MIA EDGE DRAWER — Android Navigation Drawer Style
   Pull-tab sticks to the left edge, drawer slides in with glass morphism
   ========================================================== */

#chat-panel {
    position: relative !important;
}

/* 📢 Pull-tab handle — always visible on the left edge (fixed to viewport) */
#mia-drawer-handle {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 64px;
    background: rgba(6, 182, 212, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-left: none;
    border-radius: 0 12px 12px 0;
    color: rgba(6, 182, 212, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 200;
    transition: width 0.2s ease, background 0.2s ease;
    box-shadow: 2px 0 12px rgba(6, 182, 212, 0.15);
    padding: 0;
    overflow: hidden;
}

/* 📢 Pull-tab handle — always visible on the left edge (fixed to viewport) */
#mia-drawer-handle {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 72px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(6, 182, 212, 0.35);
    border-left: none;
    border-radius: 0 16px 16px 0;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 250;
    transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 10px rgba(6, 182, 212, 0.2);
    padding: 0;
}

#mia-drawer-handle:hover,
#mia-drawer-handle:active {
    width: 30px;
    background: rgba(15, 23, 42, 0.9);
    color: var(--accent-pink);
    border-color: rgba(236, 72, 153, 0.5);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(236, 72, 153, 0.3);
}

/* Ensure the SVG icon is visible and styled nicely */
#mia-drawer-handle svg {
    display: block !important;
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

#mia-drawer-handle:hover svg {
    transform: scale(1.2);
}

/* When drawer is active, handle moves together with the side panel edge */
body.mia-drawer-active #mia-drawer-handle {
    left: 300px;
    border-left: 1.5px solid rgba(6, 182, 212, 0.35);
    border-radius: 0 16px 16px 0;
}

body.mia-drawer-active #mia-drawer-handle svg {
    transform: rotate(180deg);
}

/* Backdrop Overlay — covers the full viewport when drawer is open */
#mia-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 210;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#mia-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Main Drawer Container — slides from left over full viewport height */
#mia-drawer {
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: rgba(12, 18, 38, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(6, 182, 212, 0.18);
    z-index: 220;
    display: flex;
    flex-direction: column;
    transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.5);
    padding-top: max(1.25rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

#mia-drawer.open {
    left: 0;
}

/* 📱 iOS/Mobile Safari Zoom Fix - enforce 16px font-size to prevent automatic zoom */
@media (max-width: 767px) {
    #user-input {
        font-size: 16px !important;
    }
}

/* Content inside drawer */
.mia-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 40%, transparent);
}
.mia-drawer-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}
.mia-drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mia-drawer-close:hover {
    color: var(--accent-pink);
    background: var(--bg-input-hover);
}

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

/* User profile section in drawer */
.mia-drawer-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    background: color-mix(in srgb, var(--bg-primary) 60%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
    border-radius: 16px;
    gap: 10px;
}
.mia-drawer-avatar-wrap {
    position: relative;
    width: 64px;
    height: 64px;
}
.mia-drawer-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 15px color-mix(in srgb, var(--accent-cyan) 20%, transparent);
}
.mia-drawer-led {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}
.mia-drawer-led.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}
.mia-drawer-led.offline {
    background: #64748b;
}

.mia-drawer-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.mia-drawer-role {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-pink);
    background: color-mix(in srgb, var(--accent-pink) 10%, transparent);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Navigation items in drawer */
.mia-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mia-drawer-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.mia-drawer-btn-primary {
    background: var(--btn-send-bg);
    color: #ffffff !important;
}
.mia-drawer-btn-primary:hover {
    background: var(--btn-send-hover);
    transform: translateY(-1px);
}
.mia-drawer-btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.mia-drawer-btn-secondary:hover {
    background: var(--bg-input-hover);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}
.mia-drawer-btn-danger {
    background: color-mix(in srgb, #ef4444 10%, transparent);
    border: 1px solid color-mix(in srgb, #ef4444 20%, transparent);
    color: #f87171;
}
.mia-drawer-btn-danger:hover {
    background: #ef4444;
    color: #ffffff !important;
}

/* Section styling inside drawer */
.mia-drawer-section-title {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 4px;
}

/* Theme Toggle Button inside Drawer */
.mia-theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 12px;
}
.mia-theme-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================================
   MIA CHAT BUBBLES & RESPONSIVE LAYOUT
   ========================================================== */

.mia-msg-user {
    background-color: var(--btn-send-bg) !important;
    border: 1px solid color-mix(in srgb, var(--btn-send-bg) 20%, #ffffff) !important;
    color: #ffffff !important;
    border-radius: 20px 20px 4px 20px !important;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.15) !important;
}

.mia-msg-bot {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 20px 20px 20px 4px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
}

.mia-msg-error {
    background-color: color-mix(in srgb, #ef4444 8%, var(--bg-primary)) !important;
    border: 1px solid color-mix(in srgb, #ef4444 30%, transparent) !important;
    color: #f87171 !important;
    border-radius: 20px 20px 20px 4px !important;
}

/* Ensure Links inside BOT bubbles look nice and legible */
.mia-msg-bot a {
    color: var(--accent-cyan) !important;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s;
}
.mia-msg-bot a:hover {
    color: var(--btn-send-hover) !important;
}

/* ==========================================================
   MIA DETAIL/SUMMARY ACCORDIONS (MIA RAG Cards in Chat)
   ========================================================== */
#chat-box details {
    background-color: color-mix(in srgb, var(--bg-primary) 70%, transparent);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 16px;
    margin: 10px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

#chat-box details[open] {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-color: color-mix(in srgb, var(--accent-cyan) 50%, transparent);
}

#chat-box summary {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    user-select: none;
    list-style: none;
    position: relative;
    padding-right: 28px;
}

#chat-box summary::-webkit-details-marker {
    display: none; /* Hide Safari arrow */
}

#chat-box summary::after {
    content: "▼";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scale(0.85);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 10px;
    color: var(--text-secondary);
}

#chat-box details[open] summary::after {
    transform: translateY(-50%) rotate(180deg) scale(0.85);
    color: var(--accent-cyan);
}

#chat-box details > *:not(summary) {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 13px !important;
    line-height: 1.6;
}

/* Feedback buttons */
.mia-feedback-btn {
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
}
.mia-feedback-btn:hover {
    color: var(--accent-cyan) !important;
    border-color: var(--border-focus) !important;
    background: color-mix(in srgb, var(--accent-cyan) 10%, transparent) !important;
}

/* ==========================================================
   THEME-RESPONSIVE FLOATING CARDS & POPUPS OVERRIDES
   ========================================================== */

#mia-floating-card {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15) !important;
}

#mia-floating-card h4,
#mia-floating-card .text-white {
    color: var(--text-primary) !important;
}

#mia-floating-card .border-slate-700 {
    border-color: var(--border-color) !important;
}

#mia-floating-card .bg-slate-800,
#mia-floating-card .bg-slate-800\/60,
#mia-floating-card .bg-slate-900,
#mia-floating-card .bg-slate-950\/80,
#mia-floating-card .bg-slate-950 {
    background-color: var(--bg-primary) !important;
}

#mia-floating-card .text-slate-200,
#mia-floating-card .text-slate-300,
#mia-floating-card .text-slate-400 {
    color: var(--text-secondary) !important;
}

#mia-floating-card .bg-gradient-to-br {
    background: var(--bg-primary) !important;
    background-image: none !important;
}

#mia-floating-card .text-green-400 {
    color: var(--accent-cyan) !important;
}
#mia-floating-card .text-pink-400 {
    color: var(--accent-pink) !important;
}

/* Ensure reviews modal is responsive */
#mia-read-reviews-modal .bg-[#0f172a],
#mia-read-reviews-modal .bg-slate-900\/50 {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}
#mia-read-reviews-modal .text-white,
#mia-read-reviews-modal h3 {
    color: var(--text-primary) !important;
}
#mia-read-reviews-modal .border-slate-700,
#mia-read-reviews-modal .border-slate-700\/70 {
    border-color: var(--border-color) !important;
}
#mia-read-reviews-modal .text-slate-300,
#mia-read-reviews-modal .text-slate-400 {
    color: var(--text-secondary) !important;
}

#map-chat, #mia-mini-map {
    filter: none !important;
}