/* ============================================================
   SHARED LAYOUT — sidebar, topbar, messages, loading, modals
   Included by all pages via components.js injection
   ============================================================ */

/* ── SIDEBAR ── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 240px;
    background: #0f172a;
    z-index: 1000;
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.logo-row { display: flex; align-items: center; gap: 10px; }

.logo-box {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}

.logo-text { font-size: 13px; font-weight: 700; color: #f1f5f9; line-height: 1.3; }
.logo-sub  { font-size: 10px; color: #64748b; margin-top: 1px; }

.sidebar-nav { padding: 14px 10px; flex: 1; overflow-y: auto; }

.nav-section {
    font-size: 10px; font-weight: 700; color: #475569;
    letter-spacing: 0.08em; text-transform: uppercase;
    padding: 8px 10px 4px;
}

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: #94a3b8; text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: all 0.15s; margin-bottom: 1px;
}

.nav-link:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.nav-link.active { background: rgba(59,130,246,0.18); color: #93c5fd; font-weight: 600; }
.nav-link .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* ── MAIN WRAPPER ── */
.main-wrapper {
    margin-left: 240px;
    min-height: 100vh;
    transition: margin-left 0.28s ease;
}

/* ── HAMBURGER & CLOSE ── */
.btn-hamburger {
    position: fixed; top: 14px; left: 14px; z-index: 1101;
    width: 42px; height: 42px; font-size: 20px;
    background: white; border: 1px solid #e2e8f0; border-radius: 8px;
    cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    display: none; align-items: center; justify-content: center;
}

.btn-close-sidebar {
    background: none; border: none; color: #64748b;
    font-size: 24px; cursor: pointer; padding: 0; display: none; line-height: 1;
}

/* ── TOPBAR ── */
.topbar {
    background: white; border-bottom: 1px solid #e2e8f0;
    padding: 0 28px; height: 58px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
}

.topbar-title {
    font-size: 16px; font-weight: 700; color: #0f172a;
    display: flex; align-items: center; gap: 8px;
}

.page-icon {
    width: 30px; height: 30px; background: #dbeafe;
    border-radius: 7px; display: flex; align-items: center; justify-content: center;
    font-size: 15px;
}

/* ── MESSAGES ── */
#message {
    font-size: 13px; font-weight: 600;
    padding: 6px 14px; border-radius: 20px; display: none;
    transition: all 0.2s;
}

.message-success { background: #dcfce7; color: #15803d; }
.message-error   { background: #fee2e2; color: #dc2626; }
.message-warning { background: #fef3c7; color: #d97706; }
.message-info    { background: #dbeafe; color: #1d4ed8; }

/* ── LOADING OVERLAY ── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.35);
    backdrop-filter: blur(2px);
    z-index: 9999; display: none;
    align-items: center; justify-content: center;
}

.loading-overlay.active { display: flex; }

.loading-box {
    background: white; border-radius: 14px;
    padding: 28px 40px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.loading-box p { font-size: 13px; font-weight: 600; color: #334155; margin: 0; }

/* ── SPINNER (shared) ── */
.spinner {
    width: 34px; height: 34px;
    border: 3px solid #e2e8f0; border-top-color: #3b82f6;
    border-radius: 50%;
    animation: _spin 0.7s linear infinite;
    margin: 0 auto 12px;
}

/* Students page has its own larger spinner - keep compatible */
.loading-text { font-size: 13px; color: #64748b; font-weight: 500; }

@keyframes _spin { to { transform: rotate(360deg); } }

/* ── CONFIRM MODAL ── */
.cm-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(3px);
    z-index: 10000; display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}

.cm-overlay.open { display: flex; }

.cm-box {
    background: white; border-radius: 16px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.22);
    animation: _cmIn 0.2s ease;
}

@keyframes _cmIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cm-header {
    padding: 22px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.cm-icon-row {
    display: flex; align-items: center; gap: 12px; margin-bottom: 4px;
}

.cm-icon-wrap {
    width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
    background: #fef2f2;
}

.cm-icon-wrap.info { background: #dbeafe; }

.cm-title { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0; }

.cm-body { padding: 16px 24px; }

.cm-message { font-size: 13.5px; color: #475569; line-height: 1.6; margin: 0; }

.cm-warning-box {
    background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px;
    padding: 12px 14px; font-size: 13px; color: #991b1b;
    display: flex; gap: 8px; align-items: flex-start;
    margin-top: 12px; line-height: 1.5;
}

.cm-footer {
    padding: 16px 24px 20px;
    display: flex; gap: 10px; justify-content: flex-end;
    border-top: 1px solid #f8fafc;
}

.cm-btn {
    padding: 9px 20px; border-radius: 8px; border: none;
    font-size: 13px; font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer; transition: all 0.15s;
}

.cm-btn-cancel {
    background: white; color: #334155;
    border: 1.5px solid #e2e8f0;
}
.cm-btn-cancel:hover { background: #f8fafc; }

.cm-btn-confirm { background: #3b82f6; color: white; }
.cm-btn-confirm:hover { background: #2563eb; }
.cm-btn-confirm.danger { background: #dc2626; }
.cm-btn-confirm.danger:hover { background: #b91c1c; }

/* ── RESPONSIVE ── */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.15); }
    .main-wrapper { margin-left: 0 !important; }
    .btn-hamburger { display: flex; }
    .btn-close-sidebar { display: flex; align-items: center; justify-content: center; }
    /* FIXED: filter:brightness() was removed — it creates a new CSS stacking context
       that traps position:fixed children (hamburger) inside it.
       Dimming is now handled by mobile.css via a ::after pseudo-element overlay. */
    .main-wrapper.sidebar-open { pointer-events: none; }
    .topbar { padding: 0 16px 0 62px !important; }
}

@media (max-width: 480px) {
    .sidebar { width: 80%; }
}