/* CSS del Sidebar / Nav Móvil Migrado desde la V1 */
#mainSidebar {
    display: flex; flex-direction: column; height: 100dvh;
    padding: 25px 15px 0 15px !important; box-sizing: border-box;
    width: 260px;
    /* overflow visible — el toggle button necesita sobresalir (right: -32px) */
    overflow: visible;
    background: #0d1e45 !important;
    border-right: 1px solid rgba(107,160,230,0.12) !important;
    /* Sin transition en el primer render — se activa solo tras montaje (ver layout-ready) */
}
#mainSidebar.layout-ready {
    transition: width 0.3s ease, padding 0.3s ease;
}

/* El scroll del contenido interno sí necesita clip, pero no el header */
#mainSidebar .nav-links { overflow-y: auto; overflow-x: hidden; }

.sidebar-header { flex-shrink: 0; margin-bottom: 25px !important; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; width: 100%; position: relative; }
.logo-container { display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden; }
.logo-full-dark, .logo-full-light { max-height: 45px; max-width: 100%; width: auto; object-fit: contain; }
.logo-full-light { display: none !important; }
.logo-full-dark { display: block !important; }

/* Sidebar siempre dark — logo-dark siempre visible en ambos temas */
/* [data-theme="light"] .logo-full-dark { display: none !important; } — desactivado: sidebar siempre navy */

.logo-mini { max-height: 40px; max-width: 40px; width: auto; object-fit: contain; display: none !important; }

.sidebar-toggle-btn { background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-muted); width: 34px; height: 34px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(0,0,0,0.05); position: absolute; right: -32px; top: 10px; z-index: 100; }
.sidebar-toggle-btn:hover { background: var(--primary); color: #000; border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(107, 227, 180, 0.2); }
.sidebar-toggle-btn i { transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* !important necesario para superar la especificidad de #mainSidebar */
.sidebar.collapsed { width: 80px !important; padding: 25px 10px 0 10px !important; }
.sidebar.collapsed .sidebar-header { gap: 20px; }
.sidebar.collapsed .logo-full-dark, .sidebar.collapsed .logo-full-light { display: none !important; }
.sidebar.collapsed .logo-mini { display: block !important; margin: 0 auto; }
.sidebar.collapsed .sidebar-toggle-btn i { transform: rotate(180deg); position: relative; right: 0; }
.sidebar.collapsed .submenu { display: none !important; }

.nav-links { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 0 !important; margin: 0; list-style: none; }
.nav-links::-webkit-scrollbar { width: 4px; }
.nav-links::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
/* Sidebar siempre dark — scrollbar siempre claro */
[data-theme="light"] #mainSidebar .nav-links::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }

/* Sidebar siempre es fondo dark — texto siempre claro independiente del tema */
.nav-links a { font-size: 0.85rem !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; display: flex; align-items: center; position: relative; padding: 12px 14px; border-radius: 10px; color: rgba(200,215,240,0.65); text-decoration: none; transition: 0.3s; margin-bottom: 2px; }
.nav-links a.active { background: rgba(107,227,180,0.12); color: #6be3b4; font-weight: 700; box-shadow: inset 3px 0 0 #6be3b4; }
.nav-links a:hover { background: rgba(255,255,255,0.06); color: rgba(200,215,240,0.95); }
.nav-links i:not(.arrow) { min-width: 30px; font-size: 1.1rem; }

.nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; opacity: 1; transition: opacity 0.3s; }
.sidebar.collapsed .nav-text { opacity: 0; display: none; }

.nav-links .submenu { list-style: none; padding: 0; margin-left: 20px; display: none; }
.has-submenu.open .submenu { display: block; }
.nav-links .submenu a { font-size: 0.8rem !important; padding: 8px 12px !important; opacity: 0.8; }
.nav-links .submenu a.active { opacity: 1; background: rgba(107, 227, 180, 0.05); }

/* Toggle button — verde sólido, visible contra el sidebar navy Y contra el contenido */
.sidebar-toggle-btn {
    background: #6be3b4 !important;
    border: 2px solid rgba(0,0,0,0.12) !important;
    color: #0a1220 !important;
    box-shadow: 0 3px 12px rgba(107,227,180,0.35), 0 1px 4px rgba(0,0,0,0.3) !important;
}
.sidebar-toggle-btn:hover {
    background: #4ecba0 !important;
    border-color: rgba(0,0,0,0.15) !important;
    color: #07101e !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(107,227,180,0.5), 0 2px 8px rgba(0,0,0,0.3) !important;
}
.sidebar-toggle-btn i { color: inherit !important; }
/* Labels de sección en sidebar siempre navy */
[data-theme="light"] #mainSidebar .nav-section-label { color: rgba(160,185,220,0.45) !important; }
[data-theme="light"] .bottom-nav { background: rgba(11,31,69,0.97) !important; border-top-color: rgba(107,160,230,0.15); }
[data-theme="light"] .b-nav-item { color: #7ba8d4; }
[data-theme="light"] .b-nav-item.active { color: var(--primary); }
[data-theme="light"] .btn-toggle-nav { background: rgba(17,34,82,0.95); border-color: rgba(107,160,230,0.2); color: var(--primary); }

.nav-section-label {
    list-style: none;
    font-size: 0.58rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1.3px; color: var(--text-muted);
    padding: 10px 10px 3px; display: flex; align-items: center; gap: 7px;
    opacity: 0.55; pointer-events: none; user-select: none;
}
.sidebar.collapsed .nav-section-label { display: none !important; }

/* Footer sidebar — siempre colores para fondo navy */
.sidebar-footer { flex-shrink: 0; padding: 15px 10px; margin-left: -15px; margin-right: -15px; border-top: 1px solid rgba(107,160,230,0.12); background: linear-gradient(to top, rgba(0,0,0,0.25), transparent); display: flex; flex-direction: column; gap: 12px; }
.session-info {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(107,160,230,0.12);
    border-radius: 8px; padding: 7px 10px; transition: border-color 0.2s;
}
.time-display { font-size: 0.9rem; font-weight: 700; color: rgba(220,235,255,0.9); font-family: monospace; }
.date-display { font-size: 0.62rem; color: rgba(160,185,220,0.55); font-weight: 600; margin-top: 2px; }

.btn-logout { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; background: rgba(239, 68, 68, 0.08); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 10px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: 0.3s; }
.btn-logout:hover { background: var(--danger); color: #fff; box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3); transform: translateY(-2px); }

.sidebar.collapsed .session-info { display: none !important; }
.sidebar.collapsed .btn-logout { padding: 0; width: 40px; height: 40px; border-radius: 10px; margin: 0 auto; }
.sidebar.collapsed .btn-logout span { display: none !important; }

.mobile-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 9998; opacity: 0; visibility: hidden; transition: 0.4s; }
.mobile-overlay.active { opacity: 1; visibility: visible; }

.mobile-only-btn { display: none; background: transparent; border: none; color: var(--text-main); font-size: 1.5rem; cursor: pointer; }
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--bg-panel); border-top: 1px solid var(--border); display: none; align-items: center; justify-content: space-around; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); z-index: 9999; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.bottom-nav.oculto { transform: translateY(100%); }

.btn-toggle-nav {
    position: absolute; top: -45px; right: 20px; background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 50%; width: 40px; height: 40px; color: var(--primary); display: flex; justify-content: center; align-items: center;
    cursor: pointer; box-shadow: 0 -4px 10px rgba(0,0,0,0.3);
}

.b-nav-item { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--text-muted); text-decoration: none; font-size: 1.2rem; transition: 0.3s; }
.b-nav-item span { font-size: 0.65rem; font-weight: 600; }
.b-nav-item.active { color: var(--primary); }

@media (max-width: 768px) {
    .mobile-only-btn { display: block; }
    #mainSidebar { position: fixed; left: 0; top: 0; width: 280px; z-index: 9999; transform: translateX(-100%); transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
    #mainSidebar.mobile-open { transform: translateX(0); box-shadow: 15px 0 30px rgba(0,0,0,0.6); }
    .sidebar-toggle-btn { display: none !important; }
    .sidebar-footer { margin-bottom: calc(25px + env(safe-area-inset-bottom)) !important; background: transparent !important; border: none !important; }
    .bottom-nav { display: flex; }
}

/* =========================================================================
   TOPBAR NEO — animación al hacer scroll
   ========================================================================= */

/* Estado normal: saludo visible, padding completo */
.neo-greeting {
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.3s ease, transform 0.25s ease;
    max-height: 70px;
    opacity: 1;
}

/* Cuando el usuario scrollea hacia abajo: topbar se vuelve transparente */
.neo-topbar.topbar-scrolled {
    padding: 9px 20px !important;
    border-radius: 20px !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* El saludo se desvanece y se encoge */
.neo-topbar.topbar-scrolled .neo-greeting {
    opacity: 0;
    max-height: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

/* Los botones de acción flotan en una píldora independiente */
.neo-topbar.topbar-scrolled .neo-topbar-actions {
    background: rgba(8, 11, 22, 0.82);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    padding: 6px 12px;
    gap: 4px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
    transition: all 0.3s ease;
}

/* En mobile: también el botón hamburger flota como píldora separada */
@media (max-width: 768px) {
    .neo-topbar.topbar-scrolled #mobileMenuBtn {
        background: rgba(8, 11, 22, 0.82) !important;
        backdrop-filter: blur(22px) !important;
        -webkit-backdrop-filter: blur(22px) !important;
        border: 1px solid rgba(255,255,255,0.07) !important;
        border-radius: 999px !important;
        padding: 8px 16px !important;
        width: auto !important;
        height: auto !important;
        box-shadow: 0 8px 30px rgba(0,0,0,0.4) !important;
    }
}

/* =========================================================================
   BOTTOM NAV — comportamiento cuando sidebar está abierto
   ========================================================================= */

/* Ya está en el CSS: .bottom-nav.oculto { transform: translateY(100%); }  */
/* La clase .oculto se activa desde Vue cuando mobileOpen=true              */

/* Ocultar bottom-nav cuando hay un modal abierto (body.modal-open) */
body.modal-open .bottom-nav { transform: translateY(100%) !important; }

/* Mejora visual del bottom nav */
.bottom-nav {
    box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
    backdrop-filter: blur(16px);
    background: rgba(10, 13, 20, 0.95) !important;
}

/* Indicador activo mejorado */
.b-nav-item.active i {
    filter: drop-shadow(0 0 6px rgba(107, 227, 180, 0.5));
}

/* =========================================================================
   RESPONSIVE MOBILE — mejoras generales del layout
   ========================================================================= */
@media (max-width: 768px) {

    /* Padding del contenido principal reducido en mobile */
    #scrollMain > div {
        padding: 12px 16px !important;
    }

    /* Charts apiladas verticalmente en mobile */
    .charts-wrapper {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    /* Ajuste para que el topbar no tenga margen inferior excesivo en mobile */
    .neo-topbar {
        margin-bottom: 16px !important;
    }

    /* bank-grid ya tiene 1 columna, solo ajuste de gap */
    .bank-grid {
        gap: 16px !important;
    }

    /* La tarjeta virtual: el aspect-ratio lo controla v2_styles.css */
    .bank-grid > div:last-child {
        min-height: unset;
    }
}
