:root {
    --navy-dark: #0b1528;
    --navy-sidebar: #0f1c3f;
    --royal-blue: #2563eb;
    --royal-hover: #1d4ed8;
    --cyan-accent: #06b6d4;
    --bg-color: #f8fafc; /* Gris más limpio */
    --text-color: #1e293b;
    --card-bg: #ffffff;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
}

/* 🔐 PANTALLA DE LOGIN */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, var(--navy-sidebar), var(--navy-dark));
    padding: 20px;
    box-sizing: border-box;
}

.login-card {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-icon { font-size: 50px; margin-bottom: 10px; }
.login-card h2 { color: var(--navy-dark); margin: 0; font-size: 28px; font-weight: 800; }
.login-card p { color: var(--royal-blue); margin: 5px 0 25px 0; font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }

.input-group { text-align: left; margin-bottom: 20px; display: flex; flex-direction: column; }
.input-group label { font-size: 13px; font-weight: 700; color: #475569; margin-bottom: 6px; }
.input-group input { padding: 14px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 15px; }

.btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--royal-blue), #1e40af);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* 📊 INTERFAZ GENERAL */
.hidden-layout { display: none !important; }
.display-layout { display: flex !important; }

.sidebar {
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy-sidebar) 100%);
    position: fixed;
    padding: 30px 20px;
    box-sizing: border-box;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar h2 { color: #ffffff !important; text-align: center; margin: 0 0 4px 0; font-size: 24px; font-weight: 800; }
.sidebar-subtitle { text-align: center; margin: 0 0 20px 0; color: var(--cyan-accent); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.sidebar hr { border: 0; height: 1px; background: linear-gradient(90deg, transparent, #334155, transparent); margin-bottom: 25px; }

.nav-btn {
    width: 100%; background: none; border: none; color: #94a3b8; padding: 14px 20px; text-align: left;
    font-size: 15px; cursor: pointer; border-radius: 10px; margin-bottom: 8px; transition: all 0.2s ease;
    font-weight: 600; display: flex; align-items: center;
}
.nav-btn:hover { color: #ffffff; background-color: rgba(255, 255, 255, 0.05); transform: translateX(4px); }
.nav-btn.active { background: linear-gradient(135deg, var(--royal-blue) 0%, #1e40af 100%); color: #ffffff; box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3); }

.main-content { margin-left: 280px; padding: 40px; width: calc(100% - 280px); box-sizing: border-box; }
.content-section { animation: fadeIn 0.4s ease; }
.hidden { display: none !important; }

h2 { color: var(--navy-dark); margin-top: 0; font-size: 26px; font-weight: 700; position: relative; padding-bottom: 10px; }
h2::after { content: ''; position: absolute; bottom: 0; left: 0; width: 50px; height: 4px; background-color: var(--royal-blue); border-radius: 2px; }

.card { background: var(--card-bg); padding: 30px; border-radius: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 10px 15px -3px rgba(0,0,0,0.03); margin-bottom: 25px; border: 1px solid #e2e8f0; }
.header-card { border-left: 6px solid var(--royal-blue); background: linear-gradient(to right, #ffffff, #f8fafc); }
.header-card h1 { color: var(--navy-dark); font-size: 30px; margin: 0 0 10px 0; font-weight: 800; }
.header-card p { color: #64748b; font-size: 15px; line-height: 1.6; margin: 0; }

.stats-grid { display: flex; gap: 20px; margin-top: 30px; }
.stat-box { background: #ffffff; border: 1px solid #e2e8f0; padding: 22px; border-radius: 16px; flex: 1; text-align: center; position: relative; overflow: hidden; }
.stat-box::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background-color: var(--royal-blue); }
.stat-box h3 { margin: 0 0 8px 0; color: #475569; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-box p { margin: 0; font-size: 38px; font-weight: 800; color: var(--royal-blue); }
.alert-box::before { background-color: #ef4444; }
.alert-box p { color: #ef4444; }

/* 🔴 NUEVA SECCIÓN DE ALUMNOS DEUDORES EN EL DASHBOARD */
.deudores-container { margin-top: 30px; text-align: left; background: #fff5f5; border: 1px solid #fed7d7; padding: 20px; border-radius: 12px; }
.deudores-container h4 { margin: 0 0 12px 0; color: #c53030; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.deudores-list { list-style: none; padding: 0; margin: 0; }
.deudores-list li { display: flex; justify-content: space-between; padding: 10px 14px; background: white; border-radius: 8px; margin-bottom: 8px; border-left: 4px solid #f56565; font-size: 14px; font-weight: 600; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.deudores-list .cat-badge { background: #edf2f7; color: #4a5568; padding: 2px 8px; border-radius: 4px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-top: 20px; }
input, select { padding: 12px 16px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 14px; }
input:focus { outline: none; border-color: var(--royal-blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12); }

button { padding: 12px 24px; border: none; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px; }
.btn-success { background-color: var(--royal-blue); color: white; }
.btn-primary { background-color: #0284c7; color: white; }
.btn-danger { background-color: #ef4444; color: white; }

table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th { background-color: #f8fafc; color: #475569; font-weight: 700; font-size: 13px; text-transform: uppercase; border-bottom: 2px solid #edf2f7; }
th, td { padding: 14px; text-align: left; }
td { border-bottom: 1px solid #f1f5f9; font-size: 14px; }
tr:hover { background-color: #f8fafc; }
.badge { background-color: #eff6ff; color: var(--royal-blue); padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.search-box input { width: 100%; box-sizing: border-box; }

/* 📱 MENÚ MÓVIL OPTIMIZADO (FLOTANTE Y ELEGANTE) */
.mobile-menu-toggle { display: none; }

/* 📱 DISEÑO RESPONSIVO MÓVIL PREMIUM */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.25);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Fondo oscuro transparente cuando el menú móvil esté abierto */
    .sidebar-overlay {
        display: none; position: fixed; top:0; left:0; width:100vw; height:100vh;
        background: rgba(11, 21, 40, 0.5); backdrop-filter: blur(4px); z-index: 99;
    }
    .sidebar.open + .sidebar-overlay { display: block; }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
        padding-top: 75px;
    }
    
    /* Botón hamburguesa flotante moderno */
    .mobile-menu-toggle {
        display: flex; align-items: center; gap: 8px;
        position: fixed; top: 14px; left: 14px; z-index: 110;
        background: var(--navy-dark); color: white; border: none;
        padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
        box-shadow: 0 4px 12px rgba(11, 21, 40, 0.2);
    }

    .card { padding: 20px; border-radius: 14px; margin-bottom: 16px; }
    .header-card h1 { font-size: 24px; }
    
    .stats-grid { flex-direction: column; gap: 14px; margin-top: 20px; }
    .stat-box { padding: 18px; border-radius: 12px; }
    .stat-box p { font-size: 32px; }
    
    /* Forzar diseño de lista/tarjeta en tablas para que quepa en pantallas chicas sin scroll feo */
    table, thead, tbody, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; }
    tr { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; margin-bottom: 12px; background: #ffffff; box-shadow: 0 2px 4px rgba(0,0,0,0.01); }
    td { border: none; padding: 6px 8px; text-align: right; position: relative; padding-left: 50%; font-size: 14px; }
    td::before {
        content: attr(data-label); position: absolute; left: 8px; width: 45%;
        text-align: left; font-weight: 700; color: #64748b; font-size: 13px;
    }
    td img { float: right; }
    td button { width: 100%; margin-top: 5px; box-sizing: border-box; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }