/* ===================================================================
   CSO Calificaciones — App CSS
   =================================================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e3a8a;
    --sidebar-hover: rgba(255,255,255,0.1);
    --sidebar-active: rgba(255,255,255,0.18);
    --topbar-height: 56px;
}

/* ── Layout ───────────────────────────────────────────────────────── */
body {
    background: #f1f5f9;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: width 0.25s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    padding: 0.5rem 0.75rem;
}

.nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.45);
    padding: 0.5rem 0.5rem 0.25rem;
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.user-name { font-weight: 600; line-height: 1.2; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.55); }

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-content {
    padding: 1.5rem;
}

/* ── Collapsed sidebar ─────────────────────────────────────────────── */
body.sidebar-collapsed .sidebar {
    width: 64px;
}
body.sidebar-collapsed .sidebar-brand span,
body.sidebar-collapsed .sidebar-nav .nav-link span,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .user-name,
body.sidebar-collapsed .user-role,
body.sidebar-collapsed .sidebar-footer .btn span {
    display: none;
}
body.sidebar-collapsed .main-content {
    margin-left: 64px;
}
body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 1.25rem 0.75rem;
}
body.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 0.6rem;
}

/* ── Login page ───────────────────────────────────────────────────── */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-icon {
    font-size: 3rem;
    color: #1e40af;
}

/* ── Stat cards ───────────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    border: 1px solid #e2e8f0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0 !important;
    padding: 0.875rem 1.25rem;
}

/* ── Materia card ─────────────────────────────────────────────────── */
.materia-card {
    transition: transform 0.15s, box-shadow 0.15s;
}
.materia-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ── Tables ───────────────────────────────────────────────────────── */
.table > :not(caption) > * > * {
    padding: 0.65rem 0.875rem;
}

.table-dark th {
    background: #1e293b !important;
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-color: #334155 !important;
}

/* ── Sticky column for wide tables ─────────────────────────────────── */
.sticky-col {
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
}

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
}

/* ── Progress bar ─────────────────────────────────────────────────── */
.progress {
    border-radius: 99px;
}

/* ── Form controls ────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ── Input number centering ───────────────────────────────────────── */
input[type="number"].text-center {
    -moz-appearance: textfield;
}
input[type="number"].text-center::-webkit-outer-spin-button,
input[type="number"].text-center::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-primary {
    background-color: #1e40af;
    border-color: #1e40af;
}
.btn-primary:hover {
    background-color: #1e3a8a;
    border-color: #1e3a8a;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    .sidebar.mobile-open {
        width: var(--sidebar-width);
    }
    .main-content {
        margin-left: 0;
    }
}

/* ── Print ────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .btn, .alert { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
}
