/* ================================================================
   global.css - Sistema de Gestión Escolar UENB Virgen María
   Paleta moderna, diseño limpio y optimizado para bajo rendimiento
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* ===== Fondo y superficies ===== */
    --bg-main: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f8fafc;
    --bg-hover: #f1f5f9;

    /* ===== Sidebar (color institucional profundo) ===== */
    --bg-sidebar: #0b1220;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #1d4ed8;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-border: #1e293b;
    --sidebar-accent: #38bdf8;
    --sidebar-accent-glow: rgba(56, 189, 248, 0.15);

    /* ===== Textos ===== */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* ===== Acentos institucionales ===== */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --accent-dark: #1e40af;

    /* ===== Estados ===== */
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;

    /* ===== Bordes y sombras ===== */
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 2px 4px -1px rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.04);
    --shadow-lg: 0 4px 6px -2px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);

    /* ===== Radios ===== */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* ================================================================
   Reset & base
   ================================================================ */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
}

p { margin: 0; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

/* ================================================================
   Scrollbar personalizada (delgada, discreta)
   ================================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Scrollbar especial para el sidebar (oscura) */
.custom-scroll::-webkit-scrollbar {
    width: 3px;
}
.custom-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}
.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(51, 65, 85, 0.8);
    border-radius: 4px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 1);
}

/* ================================================================
   SIDEBAR - Colores institucionales + seguridad visual
   ================================================================ */
#sidebar {
    background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
}

/* Marca / Logo */
#sidebar-brand {
    color: var(--text-inverse);
    letter-spacing: 0.5px;
}

/* Items del menú */
#sidebar nav a {
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    position: relative;
}
#sidebar nav a:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--sidebar-text-active);
}
#sidebar nav a:hover i {
    color: var(--sidebar-accent);
}

/* Item activo (marcado desde PHP con clase .active) */
#sidebar nav a.active {
    background-color: var(--bg-sidebar-active);
    color: var(--sidebar-text-active);
    box-shadow: inset 3px 0 0 var(--sidebar-accent);
}
#sidebar nav a.active i {
    color: var(--sidebar-accent);
}

/* Íconos del menú */
#sidebar nav a i {
    color: var(--sidebar-text);
    transition: color 0.15s ease;
    flex-shrink: 0;
}

/* Separadores internos */
#sidebar .border-b,
#sidebar .border-t {
    border-color: var(--sidebar-border) !important;
}

/* Card de año escolar */
#sidebar-year-card {
    background-color: rgba(15, 23, 42, 0.6);
}

/* ================================================================
   TARJETAS Y SUPERFICIES
   ================================================================ */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
}

.surface-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ================================================================
   INPUTS Y FORMULARIOS
   ================================================================ */
.input-moderno {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-moderno::placeholder {
    color: var(--text-muted);
}
.input-moderno:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.input-moderno:disabled {
    background-color: var(--bg-surface-alt);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ================================================================
   BOTONES
   ================================================================ */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    text-decoration: none;
}
.btn-premium:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    color: #ffffff;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    background-color: #047857;
    color: #ffffff;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #b91c1c;
    color: #ffffff;
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* ================================================================
   TOPBAR
   ================================================================ */
header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

/* ================================================================
   BADGES Y ETIQUETAS
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-accent  { background: var(--accent-light);  color: var(--accent-dark); }

/* ================================================================
   ESTADOS DE CARGA Y ALERTAS DE SEGURIDAD
   ================================================================ */
.security-banner {
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid var(--warning);
    color: #78350f;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
}

.ip-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-surface-alt);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.ip-indicator::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

/* ================================================================
   TABLAS
   ================================================================ */
.tabla-moderna {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.tabla-moderna thead {
    background-color: var(--bg-surface-alt);
    border-bottom: 2px solid var(--border-color);
}
.tabla-moderna th {
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
}
.tabla-moderna td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.tabla-moderna tbody tr:hover {
    background-color: var(--bg-surface-alt);
}

/* ================================================================
   UTILIDADES
   ================================================================ */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* Accesibilidad: foco visible */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ================================================================
   MODO DE IMPRESIÓN
   ================================================================ */
@media print {
    #sidebar, header, footer, .no-print { display: none !important; }
    body { background: #ffffff; }
    .surface-card, .glass-card { box-shadow: none; border: 1px solid #e2e8f0; }
}