/* =======================================================
   1. FUENTES Y VARIABLES (POPPINS)
   ======================================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Colores Principales */
    --ba-primary: #2563eb;
    --ba-primary-dark: #1e4ed8;
    --ba-secondary: #8b5cf6;
    --ba-accent: #10b981;
    --ba-danger: #ef4444;
    --ba-warning: #f59e0b;
    --ba-bg-dark: #0f172a;
    --ba-bg-card: #1e293b;

    /* Fuente Principal */
    --f7-font-family: 'Poppins', -apple-system, sans-serif;
    
    /* Variables de Capas */
    --z-base: 1;
    --z-nav: 500;
    --z-panel: 1000;
    --z-backdrop: 10500;
    --z-popup: 11000;
    --z-sheet: 12000;
    --z-toast: 13000;
    --z-modal: 13500;
    --z-preloader: 14000;
    
    --f7-popup-z-index: var(--z-popup);
    --f7-sheet-z-index: var(--z-sheet);
    --f7-modal-z-index: var(--z-modal);
    --f7-toast-z-index: var(--z-toast);
}

/* =======================================================
   2. CORE & RESET
   ======================================================= */
body {
    font-family: 'Poppins', sans-serif !important;
    -webkit-font-smoothing: antialiased;
}

* {
    font-family: 'Poppins', sans-serif;
}

#app { height: 100%; }

/* =======================================================
   3. FIX VISUAL: BOTONES FLOTANTES (FAB SIN CUADRADO)
   ======================================================= */
.fab, .fab-premium {
    background: transparent !important;
    box-shadow: none !important;
    width: auto !important;
}
.fab > a, .fab-premium > a {
    border-radius: 50% !important;
    overflow: hidden;
    width: 56px;
    height: 56px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.fab-backdrop { background: rgba(0,0,0,0.5) !important; }

/* =======================================================
   4. BACKDROPS & MODALS (FIX DE CAPAS)
   ======================================================= */
.popup-backdrop { z-index: calc(var(--z-popup) - 1) !important; }
.sheet-backdrop { z-index: calc(var(--z-sheet) - 1) !important; }
.dialog-backdrop { z-index: calc(var(--z-modal) - 1) !important; }

.popup { z-index: var(--z-popup) !important; }
.sheet-modal { 
    z-index: var(--z-sheet) !important;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2) !important;
    border-radius: 24px 24px 0 0;
}
.dialog { z-index: var(--z-modal) !important; }
.toast { z-index: var(--z-toast) !important; }
.popup .item-input-wrap { z-index: auto !important; }

/* =======================================================
   5. CLASES DE DISEÑO (HOME LIMPIA)
   ======================================================= */
.home-page-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, var(--ba-bg-dark) 0%, var(--ba-bg-card) 100%);
    height: 100vh;
    padding: 40px;
    box-sizing: border-box;
}

.home-logo-container {
    width: 90px;
    height: 90px;
    border-radius: 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 50px rgba(59, 130, 246, 0.4);
    margin-bottom: 25px;
}

.home-title {
    color: white;
    font-size: 48px;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0;
}

.home-subtitle {
    color: #64748b;
    font-size: 15px;
    margin-top: 8px;
    font-weight: 500;
}

.home-btn-wrapper {
    width: 100%;
    max-width: 280px;
    margin-top: 40px;
}

.home-btn-start {
    width: 100%;
    height: 56px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =======================================================
   6. UTILIDADES VISUALES Y TARJETAS
   ======================================================= */
.dashboard-card-premium {
    background: var(--ba-bg-card);
    border-radius: 20px;
    padding: 18px;
    color: white;
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
}

.glass-header {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}
@supports ((-webkit-backdrop-filter: blur(12px)) or (backdrop-filter: blur(12px))) {
    .glass-header {
        background-color: rgba(255, 255, 255, 0.7) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
    }
}

.card-item-style {
    background: white;
    border-radius: 18px;
    padding: 16px 20px;
    margin: 10px 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    border: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-item-style:active {
    transform: scale(0.97);
    background: #f8fafc;
}

.card-flight {
    background: #ffffff;
    border-radius: 20px;
    margin: 12px 16px;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.05);
    overflow: hidden;
}

.card-flight-header {
    background: linear-gradient(90deg, var(--ba-primary), var(--ba-secondary));
    padding: 14px 20px;
    color: white;
    font-weight: 700;
}

/* =======================================================
   7. BOTONES
   ======================================================= */
.button-fill-premium {
    background: linear-gradient(135deg, var(--ba-primary), var(--ba-primary-dark)) !important;
    border-radius: 16px !important;
    font-weight: 700 !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3) !important;
}

/* =======================================================
   8. ANIMACIONES
   ======================================================= */
.splash-screen {
    position: fixed; inset: 0;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 99999;
    transition: all 0.6s ease-in-out;
}
.splash-screen.hide { opacity: 0; visibility: hidden; transform: scale(1.1); }

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
.stagger-item { opacity: 0; animation: slideUpFade 0.6s ease-out forwards; }
.list li { animation: slideUpFade 0.4s ease-out forwards; opacity: 0; }

/* =======================================================
   9. SCROLLBAR & FORMS
   ======================================================= */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.input-premium { margin-bottom: 22px; }
.input-premium input, .input-premium select {
    border: 2px solid #f1f5f9;
    border-radius: 14px;
    background: #f8fafc;
    padding: 14px 18px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.input-premium input:focus {
    border-color: var(--ba-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* =======================================================
   10. CORRECCIONES PARA ACCESIBILIDAD (LIGHTHOUSE)
   ======================================================= */
.stat-title, 
.stat-label, 
.navbar .title span, 
.welcome-text,
#user-name-display { 
    color: #64748b !important;
}

/* Notificaciones (Acordeón) */
.notif-body-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
    line-height: 1.4;
    cursor: pointer;
    position: relative;
    padding-right: 10px;
}

.notif-body-text::after {
    content: '▼';
    font-size: 10px;
    position: absolute;
    bottom: 0;
    right: 0;
    opacity: 0.5;
}

.notif-body-text.expanded {
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
}

.notif-body-text.expanded::after {
    content: '▲';
}

/* =======================================================
   11. ESTILOS UX PRO (SMART SWITCH + AVATAR GRID)
   ======================================================= */

/* 1. Switch Moderno para "Gasto Grupal" */
.smart-switch-container {
    background: #f1f5f9;
    border-radius: 16px;
    padding: 6px;
    display: flex;
    align-items: center;
    position: relative;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}
.smart-switch-label {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
/* Estado Activo del Switch (Slider Base) */
.smart-switch-input:checked + .smart-switch-slider {
    background: var(--ba-primary) !important;
    transition: all 0.2s ease;
}
.option-selected {
    background: white !important;
    color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 2. Grilla de Avatares (Reemplaza checkboxes) */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 15px;
    animation: fadeIn 0.3s ease;
}
.avatar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
}
/* El checkbox real está oculto pero funcional */
.avatar-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.avatar-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    border: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.avatar-name {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    line-height: 1.2;
    transition: color 0.2s;
}

/* Animación simple */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =======================================================
   TEMAS DE COLOR POR MÓDULO (Smart Grid Avatares)
   ======================================================= */

/* 1. ALOJAMIENTOS (Violeta) 🏨 */
.sheet-alojamiento-nuevo .avatar-item input:checked ~ .avatar-circle {
    background: #f3e8ff; 
    color: #7c3aed;      
    border-color: #7c3aed;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}
.sheet-alojamiento-nuevo .avatar-item input:checked ~ .avatar-name {
    color: #7c3aed;
}
.sheet-alojamiento-nuevo .option-selected {
    color: #7c3aed !important; /* Texto del switch activo */
    border: 1px solid #ddd6fe;
}

/* 2. TRASLADOS (Verde) 🚖 */
.sheet-traslado-nuevo .avatar-item input:checked ~ .avatar-circle {
    background: #ecfdf5; 
    color: #059669;      
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.sheet-traslado-nuevo .avatar-item input:checked ~ .avatar-name {
    color: #059669;
}
.sheet-traslado-nuevo .option-selected {
    color: #059669 !important;
    border: 1px solid #a7f3d0;
}

/* 3. VUELOS (Azul/Celeste) ✈️ */
.sheet-vuelo-nuevo .avatar-item input:checked ~ .avatar-circle {
    background: #e0f2fe; 
    color: #0284c7;      
    border-color: #0284c7;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}
.sheet-vuelo-nuevo .avatar-item input:checked ~ .avatar-name {
    color: #0284c7;
}
.sheet-vuelo-nuevo .option-selected {
    color: #0284c7 !important;
    border: 1px solid #bae6fd;
}

/* 4. ACTIVIDADES (Naranja) 🎟️ */
.sheet-actividad-nueva .avatar-item input:checked ~ .avatar-circle {
    background: #fff7ed; 
    color: #ea580c;      
    border-color: #ea580c;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}
.sheet-actividad-nueva .avatar-item input:checked ~ .avatar-name {
    color: #ea580c;
}
.sheet-actividad-nueva .option-selected {
    color: #ea580c !important;
    border: 1px solid #fed7aa;
}

/* =======================================================
   12. MAPA ITINERARIO MAXIMIZADO (v2)
   ======================================================= */

/* Se aplica directamente al div del mapa para sacarlo de flujo y maximizarlo */
#mapa-itinerario.map-maximized {
    position: fixed !important;
    top: 165px !important; /* Debajo de la navbar y el nuevo contenedor de controles */
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: auto !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.custom-pin-google {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
