/**
 * Sistema de Facturación — Academix
 * Bootstrap 5 + estilos propios del panel admin
 */

:root {
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --accent: #0e7490;
    --accent-dark: #0c5f77;
}

body { background: #f5f7fa; font-family: 'Segoe UI', Tahoma, sans-serif; color: #1e293b; }

/* min-width:0 en un hijo flex evita que texto/tablas anchas empujen el
   layout y produzcan scroll horizontal en celulares. */
.app-content { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Sidebar ──
   Mobile-first: drawer propio con position:fixed, oculto fuera de pantalla
   (translateX -100%) hasta que se le agrega .is-open (ver assets/js/app.js).
   A partir de 992px vuelve a ser una columna normal, fija, dentro del
   .d-flex — ya no depende del componente Offcanvas de Bootstrap. */
.sidebar-app {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(var(--sidebar-width), 85vw);
    background: #0f172a;
    color: #fff;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-x: hidden;
    overflow-y: auto;
}
.sidebar-app.is-open { transform: translateX(0); }
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
    display: none;
}
.sidebar-backdrop.is-open { display: block; }
@media (min-width: 992px) {
    .sidebar-app {
        position: static;
        width: var(--sidebar-width);
        flex-shrink: 0;
        transform: none;
    }
    .sidebar-close-header, .sidebar-backdrop { display: none !important; }
}
.sidebar-close-header { padding: .5rem .75rem 0; }
.sidebar-brand {
    color: #fff; font-size: 1.02rem; font-weight: 700;
    padding: 1rem 1.25rem;
    display: flex; align-items: center; gap: .6rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: .4rem;
    line-height: 1.2;
}
/* Placa blanca detrás del logo: tiene trazos negros que se perderían
   directo sobre el navy del sidebar. */
.sidebar-brand img {
    height: 34px; width: 34px; object-fit: contain; flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    padding: 3px;
}
.sidebar-body .nav-link {
    color: rgba(255,255,255,.75);
    padding: .6rem 1.25rem;
    font-size: .87rem;
    display: flex; align-items: center; gap: .65rem;
    border-left: 3px solid transparent;
}
.sidebar-body .nav-link i:not(.nav-chevron) { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-body .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-body .nav-link.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--accent); font-weight: 600; }
.sidebar-body .nav-section-label {
    padding: .85rem 1.25rem .3rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.35);
}
.sidebar-body .nav-section-label:first-child { padding-top: .3rem; }

/* ── Sidebar: grupos padre/submenú colapsables ── */
.sidebar-body .nav-parent { cursor: pointer; }
.sidebar-body .nav-parent .nav-chevron {
    margin-left: auto;
    font-size: .68rem;
    opacity: .5;
    transition: transform .2s ease;
}
.sidebar-body .nav-parent:not(.collapsed) .nav-chevron { transform: rotate(180deg); }
.sidebar-body .nav-parent.has-active { color: #fff; font-weight: 600; }
.sidebar-body .nav-link:focus-visible,
.sidebar-body .nav-parent:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.sidebar-body .collapse, .sidebar-body .collapsing { width: 100%; }
.sidebar-body .nav-submenu { background: rgba(0,0,0,.2); width: 100%; }
.sidebar-body .nav-sublink { padding: .5rem 1.25rem .5rem 2.35rem; font-size: .83rem; }
.sidebar-body .nav-sublink i { width: 16px; font-size: .8rem; flex-shrink: 0; }

/* ── Topbar ── */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 700; color: #0f172a; flex: 1; font-size: 1rem; }

/* ── Contenido ── */
.content-wrapper { padding: 1.5rem; flex: 1 0 auto; }
@media (max-width: 575.98px) {
    .content-wrapper { padding: 1rem; }
}

/* ── Footer ── */
.app-footer {
    padding: .9rem 1.5rem;
    text-align: center;
    font-size: .78rem;
    color: #94a3b8;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

/* ── Tarjetas de estadística (dashboard, reportes) ──
   White card + acento de color (border-left + ícono opcional) en vez de
   fondo degradado: mismo criterio ya validado en IML-Eventos ("reemplaza
   gradientes coloridos que producían ruido visual y chocaban entre sí").
   .stat-card se queda en block (no flex) a propósito: varias páginas de
   reportes solo ponen .stat-num/.stat-lbl directo adentro, sin ícono, y
   deben seguir viéndose apiladas igual que antes. El layout con ícono
   (.stat-card-body, flex) es opt-in — lo usa el dashboard nuevo. */
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--stat-color, #0e7490);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.stat-card-body { display: flex; align-items: center; gap: .85rem; }
.stat-card .stat-icon {
    width: 42px; height: 42px; flex-shrink: 0;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem; color: #fff;
    background: var(--stat-color, #0e7490);
}
.stat-card .stat-num { font-size: 1.3rem; font-weight: 800; line-height: 1.15; color: #0f172a; }
.stat-card .stat-lbl { font-size: .75rem; color: #64748b; margin-top: .2rem; }
.stat-blue   { --stat-color: #2563eb; }
.stat-red    { --stat-color: #dc2626; }
.stat-green  { --stat-color: #059669; }
.stat-orange { --stat-color: #d97706; }

/* ── Login ── */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: #eef2f6;
    padding: 1rem;
}
/* .login-card: usado por cambiar_password.php (tarjeta simple centrada,
   no necesita el panel partido de login.php). */
.login-card {
    background: #fff; border-radius: 16px;
    padding: 2.25rem 2rem;
    width: 100%; max-width: 380px;
    box-shadow: 0 10px 40px rgba(0,0,0,.12);
}
.login-logo { height: 64px; width: 64px; object-fit: contain; }

/* login.php: panel partido — marca a la izquierda, formulario a la derecha. */
.login-split {
    display: flex;
    width: 100%;
    max-width: 820px;
    min-height: 460px;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.14);
}
.login-brand-panel {
    flex: 1 1 42%;
    background: linear-gradient(160deg, var(--accent), var(--accent-dark));
    color: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 2.5rem 2rem;
    text-align: center;
}
.login-brand-logo {
    width: 84px; height: 84px; object-fit: contain;
    background: #fff; border-radius: 18px; padding: 8px;
    margin-bottom: 1.25rem;
}
.login-brand-panel h2 { font-size: 1.3rem; font-weight: 800; margin: 0 0 .5rem; }
.login-brand-panel p { font-size: .82rem; opacity: .85; letter-spacing: .03em; margin: 0; }
.login-form-panel {
    flex: 1 1 58%;
    display: flex; align-items: center; justify-content: center;
    padding: 2.5rem 2rem;
}
.login-form-inner { width: 100%; max-width: 320px; }
@media (max-width: 700px) {
    .login-split { flex-direction: column; min-height: 0; max-width: 380px; }
    .login-brand-panel { padding: 2rem 1.5rem 1.5rem; }
    .login-brand-logo { width: 60px; height: 60px; margin-bottom: .8rem; }
    .login-brand-panel h2 { font-size: 1.1rem; }
    .login-form-panel { padding: 2rem 1.75rem; }
}

/* ── Impresión ── */
@media print {
    .sidebar-app, .topbar, .no-print, .modal { display: none !important; }
    .app-content, .content-wrapper { padding: 0 !important; margin: 0 !important; }
    body { background: #fff; }
    .card { border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
}
