/* ============================================================
   ZMG — Admin / CMS design system
   Navy #0A1B3D · Deep blue #12305F · Gold #C9A227 · White
   Class names mirror the School Management admin so pages port cleanly.
   ============================================================ */

:root {
    --navy: #0d1b2a;
    --navy-2: #16283b;
    --navy-3: #1e4b8f;
    --gold: #c9a84c;
    --gold-2: #b3923f;
    --ink: #0f172a;
    --muted: #64748b;
    --faint: #94a3b8;
    --line: #e2e8f0;
    --bg: #f6f7f9;
}

h1:focus { outline: none; }

body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem 1rem 1rem 3.7rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred." }

/* ===== ADMIN SHELL ===== */
.admin-shell { display: flex; min-height: 100vh; background: var(--bg); }
.admin-sidebar {
    width: 244px; min-width: 244px; background: var(--navy); color: #cbd5e1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-main { flex: 1; min-width: 0; }

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, var(--gold), var(--gold-2));
    display: flex; align-items: center; justify-content: center; color: var(--navy);
    font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.brand-name { color: #fff; font-weight: 700; font-size: 0.95rem; line-height: 1.15; }
.brand-sub { color: var(--gold); font-size: 0.66rem; letter-spacing: 0.03em; }

.sidebar-nav { flex: 1; padding: 10px 0; }
.sidebar-section-label { padding: 14px 20px 5px; font-size: 0.66rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.06em; }
.nav-link {
    display: flex; align-items: center; gap: 11px; margin: 1px 10px; padding: 9px 12px; border-radius: 8px;
    color: #b6c2d4; font-size: 0.85rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.12s;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: rgba(201,162,39,0.16); color: var(--gold); font-weight: 600; }
.nav-link .material-icons { font-size: 18px; }

.sidebar-user { border-top: 1px solid rgba(255,255,255,0.08); padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--navy-3); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-name { font-weight: 600; color: #fff; font-size: 0.8rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: #7c8aa0; font-size: 0.68rem; }
.sidebar-signout { display: flex; align-items: center; gap: 8px; padding: 10px 18px; color: #93a1b5; font-size: 0.8rem; cursor: pointer; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-signout:hover { color: #fca5a5; }

/* ===== PAGE ===== */
.page-wrapper { padding: 26px 30px; max-width: 1360px; }
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--ink); margin: 0 0 3px; }
.page-header p { color: var(--muted); font-size: 0.86rem; margin: 0; }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.btn-group { display: flex; gap: 8px; flex-shrink: 0; margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 8px; font-size: 0.86rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.14s; text-decoration: none; line-height: 1.4; font-family: inherit; }
.btn-primary { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }
.btn-primary:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-gold { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-secondary { background: #fff; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover { background: #f8fafc; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: #eef1f5; color: var(--ink); }
.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 11px; font-size: 0.8rem; }
.btn-xs { padding: 4px 9px; font-size: 0.74rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===== CARDS ===== */
.card { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.card-sub { font-size: 0.78rem; color: var(--faint); margin: 0 0 14px; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; }
.stat-label { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat-sub { font-size: 0.72rem; color: var(--faint); margin-top: 3px; }
.stat-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #eef2fb; color: var(--navy-2); }
.stat-icon.gold { background: #f7efd6; color: var(--gold-2); }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 11px 14px; font-size: 0.71rem; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em; background: #f8fafc; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; font-size: 0.84rem; color: #334155; vertical-align: middle; }
.data-table tr:hover td { background: #fafbfc; }
.data-table tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 0.71rem; font-weight: 700; }
.badge-on { background: #dcfce7; color: #15803d; }
.badge-off { background: #f1f5f9; color: #64748b; }
.badge-gold { background: #f7efd6; color: var(--gold-2); }
.badge-navy { background: #e5ecf8; color: var(--navy-2); }
.badge-warn { background: #fef9c3; color: #a16207; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: #334155; margin-bottom: 6px; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.86rem; color: var(--ink); background: #fff; box-sizing: border-box; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(30,75,143,0.12); }
textarea.form-control { min-height: 84px; resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: #334155; }
.form-check input { width: 16px; height: 16px; accent-color: var(--navy-2); }
.field-hint { font-size: 0.72rem; color: var(--faint); margin-top: 4px; }

/* ===== SIDE PANEL ===== */
.side-panel-overlay { position: fixed; inset: 0; background: rgba(10,27,61,0.32); z-index: 200; backdrop-filter: blur(2px); }
.side-panel { position: fixed; top: 0; right: 0; width: 440px; max-width: 94vw; height: 100vh; background: #fff; z-index: 201; display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,0.14); }
.side-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.side-panel-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 700; color: var(--ink); margin: 0; }
.side-panel-body { flex: 1; overflow-y: auto; padding: 20px; }
.side-panel-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 15px 20px; border-top: 1px solid var(--line); flex-shrink: 0; }

/* ===== TOAST / STATES ===== */
.toast-message { display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 0.85rem; font-weight: 500; }
.toast-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.toast-error { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 54px; color: var(--faint); font-size: 0.88rem; }
.empty-state { text-align: center; padding: 54px 20px; color: var(--faint); }
.empty-state p { margin-top: 10px; font-size: 0.86rem; }
.spinning { animation: zspin 1s linear infinite; display: inline-block; }
@keyframes zspin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ===== LOGIN ===== */
.login-root { display: flex; min-height: 100vh; }
.login-left { width: 44%; background: linear-gradient(155deg, #080f18 0%, #0d1b2a 55%, #16283b 100%); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; }
.login-left .lead { font-family: 'Playfair Display', Georgia, serif; font-size: 2.1rem; font-weight: 600; line-height: 1.2; margin: 0 0 14px; }
.login-left p { color: rgba(255,255,255,0.72); font-size: 0.95rem; line-height: 1.6; margin: 0; }
.login-badge { display: inline-flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.85); font-size: 0.85rem; }
.login-badge .material-icons { color: var(--gold); font-size: 18px; }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 32px; }
.login-box { background: #fff; border-radius: 18px; border: 1px solid var(--line); padding: 38px; width: 100%; max-width: 410px; box-shadow: 0 10px 44px rgba(10,27,61,0.09); }
@media (max-width: 820px) { .login-left { display: none; } }

@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } .form-grid-2 { grid-template-columns: 1fr; } }

/* ===== IMAGE UPLOADERS (single picture + picture list) ===== */
.img-uploader-preview { border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; padding: 6px; display: inline-block; max-width: 100%; }
.img-uploader-preview img { display: block; max-width: 100%; max-height: 180px; border-radius: 6px; }
.img-uploader-empty { display: flex; align-items: center; gap: 8px; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 14px 16px; color: #94a3b8; font-size: 0.82rem; background: #f8fafc; }
.img-uploader-empty .material-icons { font-size: 22px; }
.img-uploader-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.img-uploader-status { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; color: #64748b; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.img-tile { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f1f5f9; aspect-ratio: 1 / 1; }
.img-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-tile-badge { position: absolute; top: 6px; left: 6px; background: #c9a84c; color: #0d1b2a; font-size: 0.66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.img-tile-actions { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 2px; padding: 4px; background: linear-gradient(to top, rgba(8,15,24,.78), rgba(8,15,24,0)); }
.img-tile-actions button { background: rgba(255,255,255,.92); border: 0; border-radius: 6px; width: 24px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #0f172a; }
.img-tile-actions button:disabled { opacity: .35; cursor: default; }
.img-tile-actions button.danger { color: #dc2626; }
.img-tile-actions .material-icons { font-size: 16px; }
