/* styles.css - MDQ Rescue Intranet v114 — Design System unificado */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Syne:wght@700;800&family=DM+Sans:wght@400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    list-style: none;
}
:root {
    /* Fondos y superficies */
    --bg:          #F3F7FA;
    --surface:     #ffffff;
    --surface-alt: #EAF0F6;
    --surface-2:   #F7FAFC;
    --surface-3:   #E1EAF2;
    --footer-bg:   #DDE6EE;

    /* Texto */
    --text:    #1e1e1e;
    --muted:   #5B6B7F;
    --muted-2: #8DA0B3;
    --dark:    #0B2545;
    --eyebrow: #4F6580;

    /* Naranja - marca principal */
    --primary:      #1F6FB2;
    --primary-dark: #174F82;
    --primary-deep: #0B2545;

    /* Bordes */
    --line:        #D3DEE8;
    --border-input:#CBD8E4;
    --border-card: #E1EAF2;

    /* Estados */
    --verde:    #10b981;
    --rojo:     #ef4444;
    --amarillo: #f59e0b;
    --azul:     #2980b9;

    /* Estados — variantes para texto y fondo suave (contraste AA) */
    --verde-txt:    #0a7d59;  --verde-bg:    #e3f6ee;
    --amarillo-txt: #8a5200;  --amarillo-bg: #fdf1d6;
    --rojo-txt:     #b42323;  --rojo-bg:     #fde8e8;
    --azul-txt:     #1c5f8c;  --azul-bg:     #e3eff8;

    /* Tipografías */
    --f-ui:      'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --f-display: 'Syne', var(--f-ui);
    --f-sub:     'DM Sans', var(--f-ui);

    /* Campus */
    --campus-blue:      #1a6fc4;
    --campus-blue-dark: #155a9e;

    /* Aliases retrocompatibles (no usar en nuevo codigo) */
    --naranja:       var(--primary);
    --naranja-deep:  var(--primary-deep);
    --crema-fondo:   var(--bg);
    --crema-card:    var(--surface);
    --blanco:        var(--surface);
}

/* ── BARRAS DE DESPLAZAMIENTO finas y cálidas ── */
* { scrollbar-width: thin; scrollbar-color: rgba(141,160,179,.55) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(141,160,179,.55); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: block;
    min-height: 100vh;
}
h1, h2, h3, h4 {
    font-family: 'Syne', 'Inter', sans-serif;
    font-weight: 800;
    color: var(--dark);
}
label, .form-label {
    font-family: 'DM Sans', 'Inter', sans-serif;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary), var(--primary-deep));
    color: white;
    padding: 30px 20px;
    position: fixed;
    height: 100vh;
    left: 0; top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar img {
    max-height: 52px;
    max-width: 150px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.sidebar h2 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
    color: white;
}
.sidebar-menu li { margin-bottom: 10px; }
.sidebar-menu a {
    color: white;
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 10px;
    transition: 0.3s;
}
.sidebar-menu a i { margin-right: 12px; width: 20px; text-align: center; }
.sidebar-menu a:hover { background: rgba(255,255,255,0.15); color: white; }
.user-welcome { margin-bottom: 30px; }
.user-welcome small { font-size: 0.7rem; opacity: 0.7; letter-spacing: 1px; font-family: 'DM Sans', sans-serif; }
.user-welcome p { margin: 5px 0; font-size: 1.1rem; font-family: 'Syne', sans-serif; font-weight: 700; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin-bottom: 10px; }
.sidebar-nav a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    transition: background 0.3s;
    font-size: 0.95rem;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.15); color: white; }
.sidebar-nav i { width: 20px; text-align: center; font-size: 1.1rem; }

/* Overlay oscuro al abrir sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ── TOPBAR MOBILE ── */
.topbar-mobile {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--primary);
    z-index: 998;
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topbar-mobile .hamburger {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
}
.topbar-mobile .topbar-title {
    color: white;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    flex: 1;
}
.topbar-mobile .topbar-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* ── CONTENIDO PRINCIPAL ── */
.main-content {
    margin-left: 260px;
    padding: 40px;
    width: calc(100% - 260px);
    min-height: 100vh;
    box-sizing: border-box;
}

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.stat-card {
    background: var(--surface);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    border: 1px solid var(--border-card);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 20px;
    flex-shrink: 0;
}
.stat-info h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    margin: 0;
}
.stat-info p {
    font-family: 'Syne', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    margin: 5px 0 0 0;
    color: var(--primary);
}

/* ── BOTONES ── */
.btn-premium {
    background: var(--primary);
    color: white;
    padding: 12px 25px;
    border-radius: 10px;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
    border: none;
    cursor: pointer;
}
.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(31,111,178,0.3);
    color: white;
}

/* ── CARDS ── */
.card {
    background: var(--surface);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid var(--border-card);
}

/* ── BADGES ── */
.badge { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; display: inline-block; }
.badge.verde    { background: #dcfce7; color: #166534; }
.badge.rojo     { background: #fee2e2; color: #b91c1c; }
.badge.amarillo { background: #fef9c3; color: #92400e; }
.badge.naranja  { background: #DDEBF7; color: #174F82; }
.badge.azul     { background: #e0f2fe; color: #0369a1; }

/* ── TABLAS ── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; }
thead th {
    background: var(--surface-2);
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-card);
}
tbody tr { border-bottom: 1px solid var(--surface-2); }
tbody tr:hover td { background: var(--surface-2); }

/* ── FORMULARIOS ── */
input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    box-sizing: border-box;
    margin-bottom: 4px;
    background: var(--surface-2);
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31,111,178,0.12);
    background: var(--surface);
}
label {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 5px;
}

/* ── DATA ITEMS ── */
.data-item {
    padding: 6px 0;
    font-size: 0.88rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.data-item i { color: var(--primary); width: 16px; }

/* ── BOTONES RAPIDOS (dashboard) ── */
.botonesrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ── BOTTOM NAV (solo APK standalone) ── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border-card);
    z-index: 900;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--muted-2);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    flex: 1;
    transition: color 0.2s;
}
.bottom-nav a i { font-size: 1.2rem; }
.bottom-nav a.active,
.bottom-nav a:hover { color: var(--primary); }

/* Mostrar bottom nav SOLO en standalone (APK) via clase JS */
body.is-standalone .bottom-nav { display: flex !important; }
body.is-standalone .main-content { padding-bottom: 80px !important; }

/* ══════════════════════════════════════════════════
   RESPONSIVE MOBILE
══════════════════════════════════════════════════ */
@media (max-width: 768px) {

    .sidebar {
        transform: translateX(-100%) !important;
        width: 280px !important;
        padding: 20px 16px !important;
        padding-top: 70px !important;
        position: fixed !important;
        left: 0 !important; top: 0 !important;
        z-index: 1000 !important;
    }
    .sidebar.open { transform: translateX(0) !important; }

    .topbar-mobile { display: flex !important; }

    .main-content {
        margin-left: 0 !important;
        padding: 76px 16px 24px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .card {
        padding: 16px !important;
        border-radius: 12px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        margin-bottom: 16px !important;
    }
    .stat-card {
        padding: 14px 10px !important;
        flex-direction: column !important;
        text-align: center !important;
        gap: 8px !important;
    }
    .stat-icon { margin-right: 0 !important; width: 36px !important; height: 36px !important; font-size: 0.95rem !important; }
    .stat-info p { font-size: 1.3rem !important; }
    .stat-info h3 { font-size: 0.65rem !important; }

    .botonesrap { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
    .btn-premium { padding: 11px 14px !important; font-size: 0.85rem !important; }

    header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .table-scroll { overflow-x: auto !important; }
    .table-scroll table { min-width: 480px; }

    .modal-content, .modal-box {
        width: 95% !important;
        margin: 10px auto !important;
        padding: 18px !important;
    }

    h1 { font-size: 1.2rem !important; }
    h2 { font-size: 1rem !important; }
    h3 { font-size: 0.92rem !important; }

    /* Títulos de las pantallas rediseñadas (mantienen tamaño de diseño en celular) */
    .da-h1, .mk-h1, .vt-h1, .dg h1 { font-size: 1.75rem !important; }
    .da-h2, .vt-h2, .dg-card h2 { font-size: 1.1rem !important; }

    input, select, textarea { font-size: 16px; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr !important; }
    .botonesrap { grid-template-columns: 1fr !important; }
}
