/* ============================================================
   JSCITS R&D MCQ SYSTEM - Stylesheet
   Uganda People's Defence Force
   ============================================================ */

:root {
    --green-dark: #1a3a1a;
    --green-mid: #2d5a27;
    --green-light: #4a7c40;
    --green-pale: #e8f0e8;
    --gold: #c8a84b;
    --gold-light: #f5e6b8;
    --red: #8b1a1a;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-400: #ced4da;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --shadow: 0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.18);
    --radius: 6px;
    --radius-lg: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    background: #f0f2f0;
    color: var(--gray-800);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── HEADER ─────────────────────────────────────────────── */
.site-header {
    background: var(--green-dark);
    color: var(--white);
    border-bottom: 3px solid var(--gold);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.header-brand { display: flex; align-items: center; gap: 14px; }

.brand-emblem {
    font-size: 2.2rem;
    background: var(--gold);
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--gold-light);
}

.brand-text { display: flex; flex-direction: column; }
.brand-main { font-size: 1.2rem; font-weight: 700; letter-spacing: 1px; color: var(--gold); }
.brand-sub { font-size: 0.72rem; color: #adc9ad; letter-spacing: 0.3px; margin-top: 2px; }

.header-user { display: flex; align-items: center; gap: 12px; }

.header-avatar-link { display:block; flex-shrink:0; }
.header-avatar-img {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--gold);
}
.header-avatar-fallback {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--gold); color: var(--green-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem; border: 2px solid var(--gold-light);
}
.user-name-link { text-decoration: none; }
.user-name-link:hover .user-name { text-decoration: underline; }
.user-info { display: flex; flex-direction: column; align-items: flex-end; }
.user-name { font-weight: 600; font-size: 0.88rem; color: #ff9800; }
.user-role {
    font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
    border-radius: 20px; letter-spacing: 0.5px; margin-top: 2px;
}
.badge-admin { background: var(--gold); color: var(--green-dark); }
.badge-staff { background: #4a90d9; color: #fff; }
.badge-student { background: #5cb85c; color: #fff; }

.btn-logout {
    background: transparent; border: 1px solid rgba(255,255,255,0.4);
    color: #fff; padding: 6px 14px; border-radius: var(--radius);
    text-decoration: none; font-size: 0.82rem; transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.15); }

.site-nav {
    background: var(--green-mid);
    padding: 0 24px;
    display: flex; gap: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.site-nav a {
    color: rgba(255,255,255,0.82); text-decoration: none;
    padding: 10px 16px; font-size: 0.83rem; font-weight: 500;
    letter-spacing: 0.2px; border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.site-nav a:hover, .site-nav a.active {
    color: #fff; border-bottom-color: var(--gold);
    background: rgba(255,255,255,0.06);
}

/* ── MAIN ───────────────────────────────────────────────── */
.site-main {
    flex: 1; max-width: 1200px; margin: 0 auto;
    width: 100%; padding: 24px 20px;
}

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
    background: var(--green-dark);
    color: rgba(255,255,255,0.55);
    text-align: center;
    padding: 16px 20px;
    font-size: 0.75rem;
    border-top: 2px solid var(--gold);
}
.site-footer p { margin: 3px 0; }
.footer-restricted { color: var(--gold); font-weight: 600; letter-spacing: 1px; margin-top: 6px !important; }

/* ── ALERTS ─────────────────────────────────────────────── */
.alert {
    padding: 12px 18px; border-radius: var(--radius);
    margin-bottom: 18px; font-size: 0.88rem; border-left: 4px solid;
}
.alert-success { background: #d4edda; color: #155724; border-color: #28a745; }
.alert-danger  { background: #f8d7da; color: #721c24; border-color: #dc3545; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffc107; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: #17a2b8; }

/* ── CARDS ──────────────────────────────────────────────── */
.card {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px;
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 14px;
    border-bottom: 2px solid var(--green-pale);
}
.card-title {
    font-size: 1.05rem; font-weight: 700; color: var(--green-dark);
    display: flex; align-items: center; gap: 8px;
}
.card-title .icon { font-size: 1.2rem; }

/* ── STAT CARDS ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow);
    border-left: 4px solid var(--green-light);
    display: flex; flex-direction: column;
}
.stat-card.gold { border-left-color: var(--gold); }
.stat-card.red  { border-left-color: var(--red); }
.stat-card.blue { border-left-color: #2563eb; }

.stat-num { font-size: 2rem; font-weight: 800; color: var(--green-dark); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--gray-600); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── TABLES ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--green-dark); color: var(--white);
    padding: 10px 14px; text-align: left; font-size: 0.82rem;
    font-weight: 600; letter-spacing: 0.3px;
    white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--gray-200); transition: background 0.15s; }
tbody tr:hover { background: var(--green-pale); }
tbody td { padding: 9px 14px; font-size: 0.88rem; }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--radius); font-size: 0.86rem;
    font-weight: 600; cursor: pointer; text-decoration: none;
    border: none; transition: all 0.2s; letter-spacing: 0.2px;
}
.btn-primary   { background: var(--green-mid); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-success   { background: #198754; color: #fff; }
.btn-success:hover { background: #146c43; }
.btn-danger    { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #b02a37; }
.btn-warning   { background: var(--gold); color: var(--green-dark); }
.btn-warning:hover { background: #b8962f; }
.btn-secondary { background: var(--gray-600); color: #fff; }
.btn-secondary:hover { background: #545b62; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

label { display: block; font-size: 0.83rem; font-weight: 600; color: var(--gray-800); margin-bottom: 5px; }
label .required { color: var(--red); }

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=number], input[type=tel],
select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--gray-400);
    border-radius: var(--radius); font-size: 0.88rem; color: var(--gray-800);
    background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--green-light);
    box-shadow: 0 0 0 3px rgba(74,124,64,0.15);
}
textarea { resize: vertical; min-height: 80px; }

.form-hint { font-size: 0.75rem; color: var(--gray-600); margin-top: 4px; }

/* ── PAGE HEADER ────────────────────────────────────────── */
.page-header {
    background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
    color: #fff; border-radius: var(--radius-lg);
    padding: 22px 26px; margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.page-header h1 { font-size: 1.35rem; font-weight: 700; }
.page-header p  { font-size: 0.83rem; color: rgba(255,255,255,0.75); margin-top: 4px; }

/* ── LOGIN / REGISTER PAGES ─────────────────────────────── */
.auth-wrapper {
    max-width: 480px; margin: 40px auto;
}
.auth-card {
    background: #fff; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.auth-header {
    background: var(--green-dark); padding: 28px 30px; text-align: center;
    border-bottom: 3px solid var(--gold);
}
.auth-header .shield { font-size: 2.8rem; margin-bottom: 8px; }
.auth-header h2 { color: var(--gold); font-size: 1.1rem; font-weight: 700; letter-spacing: 0.5px; }
.auth-header p  { color: rgba(255,255,255,0.7); font-size: 0.78rem; margin-top: 4px; }
.auth-body { padding: 28px 30px; }
.auth-footer { padding: 14px 30px; background: var(--gray-100); text-align: center; font-size: 0.82rem; color: var(--gray-600); }
.auth-footer a { color: var(--green-mid); font-weight: 600; }

/* ── EXAM INTERFACE ─────────────────────────────────────── */
.exam-header {
    background: var(--green-dark); color: #fff; border-radius: var(--radius-lg);
    padding: 16px 22px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center;
}
.exam-title { font-size: 1rem; font-weight: 700; }
.exam-meta  { font-size: 0.8rem; color: rgba(255,255,255,0.75); margin-top: 3px; }
.exam-timer { font-size: 1.5rem; font-weight: 800; color: var(--gold); }
.exam-timer.warning { color: #ff6b6b; animation: pulse 1s infinite; }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

.question-card {
    background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow);
    padding: 22px 24px; margin-bottom: 16px;
    border-left: 5px solid var(--green-light);
}
.question-num {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    color: var(--green-mid); letter-spacing: 0.5px; margin-bottom: 8px;
}
.question-text { font-size: 0.96rem; font-weight: 600; margin-bottom: 16px; line-height: 1.5; }

.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-label {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    padding: 10px 16px; border-radius: var(--radius);
    border: 2px solid var(--gray-200); transition: all 0.2s;
}
.option-label:hover { border-color: var(--green-light); background: var(--green-pale); }
.option-label input[type=radio] { display: none; }
.option-label input[type=radio]:checked + .option-key { background: var(--green-mid); color: #fff; }
.option-label:has(input:checked) { border-color: var(--green-mid); background: var(--green-pale); }

.option-key {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--gray-200); display: flex; align-items: center;
    justify-content: center; font-weight: 700; font-size: 0.82rem;
    flex-shrink: 0; transition: all 0.2s;
}
.option-text { font-size: 0.88rem; }

/* Review mode correct/incorrect */
.option-label.correct   { border-color: #198754; background: #d4edda; }
.option-label.incorrect { border-color: #dc3545; background: #f8d7da; }
.option-label.correct .option-key   { background: #198754; color: #fff; }
.option-label.incorrect .option-key { background: #dc3545; color: #fff; }

/* Progress bar */
.progress { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; margin: 10px 0; }
.progress-bar { height: 100%; background: var(--green-mid); border-radius: 4px; transition: width 0.4s; }

/* ── GRADES ─────────────────────────────────────────────── */
.grade-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    font-weight: 800; font-size: 1rem; color: #fff;
}
.grade-A { background: #0d6efd; }
.grade-B { background: #198754; }
.grade-C { background: #ffc107; color: #333; }
.grade-D { background: #fd7e14; }
.grade-E { background: #dc3545; }

.result-card {
    background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow);
    padding: 20px; margin-bottom: 14px;
    display: flex; align-items: center; gap: 18px;
}
.result-score { text-align: center; min-width: 80px; }
.result-score .score-num { font-size: 1.8rem; font-weight: 800; color: var(--green-dark); }
.result-score .score-pct { font-size: 0.75rem; color: var(--gray-600); }
.result-info { flex: 1; }
.result-subject { font-weight: 700; font-size: 0.96rem; }
.result-detail { font-size: 0.8rem; color: var(--gray-600); margin-top: 3px; }

/* ── BADGE ──────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 0.73rem; font-weight: 700;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: var(--gray-200); color: var(--gray-800); }

/* ── REPORT / PRINT ─────────────────────────────────────── */
.report-container {
    background: #fff; max-width: 800px; margin: 0 auto;
    padding: 30px; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
}
.report-letterhead { text-align: center; border-bottom: 3px double var(--green-dark); padding-bottom: 16px; margin-bottom: 20px; }
.report-letterhead h2 { color: var(--green-dark); font-size: 1.1rem; }
.report-letterhead p  { font-size: 0.78rem; color: var(--gray-600); }

@media print {
    .site-header, .site-footer, .site-nav, .btn, .no-print { display: none !important; }
    body { background: #fff; }
    .report-container { border: none; padding: 0; max-width: 100%; }
    .site-main { padding: 0; }
}

/* ── MISC ───────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--gray-600); font-size: 0.82rem; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.gap-2 { display: flex; gap: 8px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
hr { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }

.empty-state {
    text-align: center; padding: 48px 20px; color: var(--gray-600);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--gray-800); }

.divider-heading {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px;
    color: var(--gray-600); font-weight: 700; margin: 20px 0 12px;
    display: flex; align-items: center; gap: 8px;
}
.divider-heading::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

/* Verification status */
.verify-pending { background: #fff3cd; border: 1px solid #ffc107; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
