/* =====================================================================
   Gateway School, Enugu — Result Portal Stylesheet
   ---------------------------------------------------------------------
   All visual styling for the entire portal lives in this single file.
   Change the CSS variables in :root below to re-theme the whole site
   from one place — nothing else needs to be touched.
   ===================================================================== */

:root {
    --primary: #003087;       /* Gateway navy — headers, buttons, nav */
    --primary-dark: #001f5c;  /* hover/active state for primary */
    --secondary: #FFB800;     /* Gateway gold — accents, highlights */
    --bg: #F4F6FA;            /* page background */
    --surface: #FFFFFF;       /* card / panel background */
    --text: #1A2332;          /* main body text */
    --muted: #6B7585;         /* secondary / helper text */
    --border: #DCE1EA;        /* dividers, input borders */
    --danger: #C5283D;        /* errors, delete actions */
    --danger-bg: #FCEAEC;
    --success: #1E8E5A;       /* success messages */
    --success-bg: #E8F6EF;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0, 24, 73, 0.08);
    --shadow-md: 0 6px 20px rgba(0, 24, 73, 0.12);

    --font-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ---------------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------------- */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0 0 0.5em;
    color: var(--text);
    letter-spacing: -0.01em;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

button, input, select, textarea {
    font-family: inherit;
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------------------------------------------------------------------
   Auth pages (login screens — student + admin)
   --------------------------------------------------------------------- */
.auth-page {
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px 32px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 12px;
}

.school-name {
    font-size: 1.3rem;
    margin-bottom: 2px;
    color: var(--primary);
}

.school-motto {
    color: var(--secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}

.auth-title {
    text-align: center;
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    margin: 0 0 24px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
}

.auth-footer p {
    margin: 4px 0;
}

.admin-link a {
    color: var(--muted);
    font-weight: 500;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
}

input[type="file"] {
    padding: 9px 12px;
    cursor: pointer;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 4px;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
}

.btn-secondary:hover {
    background: #e6a600;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(0, 48, 135, 0.06);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #a3202f;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------------
   Top navigation (used on every logged-in page)
   --------------------------------------------------------------------- */
.topnav {
    background: var(--primary);
    color: #fff;
    padding: 0 24px;
}

.topnav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.topnav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topnav-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 3px;
}

.topnav-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topnav-brand-text strong {
    font-size: 0.95rem;
}

.topnav-brand-text span {
    font-size: 0.72rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.topnav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topnav-links a {
    color: #fff;
    opacity: 0.85;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.topnav-links a:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.topnav-links a.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.18);
}

.topnav-links .btn-logout {
    background: var(--secondary);
    color: var(--text);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    opacity: 1;
}

.topnav-links .btn-logout:hover {
    background: #e6a600;
}

/* ---------------------------------------------------------------------
   Page layout shell
   --------------------------------------------------------------------- */
.page-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.page-header p {
    color: var(--muted);
    margin: 4px 0 0;
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------------
   Cards & panels
   --------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.05rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ---------------------------------------------------------------------
   Stat cards (admin dashboard)
   --------------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 6px;
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 0.88rem;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table th {
    background: var(--bg);
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover td {
    background: rgba(0, 48, 135, 0.03);
}

.table-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Alerts / messages
   --------------------------------------------------------------------- */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(197, 40, 61, 0.25);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(30, 142, 90, 0.25);
}

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary {
    background: rgba(0, 48, 135, 0.1);
    color: var(--primary);
}

.badge-secondary {
    background: rgba(255, 184, 0, 0.18);
    color: #8a6400;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ---------------------------------------------------------------------
   Student dashboard: session / term groupings
   --------------------------------------------------------------------- */
.session-group {
    margin-bottom: 28px;
}

.session-group-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--primary);
    padding-bottom: 8px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--secondary);
    display: inline-block;
}

.term-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-card-term {
    font-weight: 700;
    font-size: 0.98rem;
}

.result-card-date {
    font-size: 0.78rem;
    color: var(--muted);
}

.result-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.result-card-actions .btn {
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ---------------------------------------------------------------------
   Modal-style confirm boxes (delete confirmations etc — pure CSS,
   no JS framework, controlled by a checkbox/target hack is overkill
   here; pages instead use a plain confirm() in onsubmit for simple
   destructive actions, kept minimal per the "no frameworks" brief)
   --------------------------------------------------------------------- */
.text-muted {
    color: var(--muted);
}

.text-danger {
    color: var(--danger);
}

.text-center {
    text-align: center;
}

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---------------------------------------------------------------------
   Upload report (bulk PDF upload / CSV import results)
   --------------------------------------------------------------------- */
.report-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.report-list li {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-list li:last-child {
    border-bottom: none;
}

.report-list .icon-ok {
    color: var(--success);
    font-weight: 700;
}

.report-list .icon-fail {
    color: var(--danger);
    font-weight: 700;
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 0.78rem;
}

/* ---------------------------------------------------------------------
   Responsive — mobile first adjustments
   --------------------------------------------------------------------- */
@media (max-width: 640px) {
    .auth-card {
        padding: 28px 22px;
    }

    .page-content {
        padding: 20px 16px 48px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .topnav {
        padding: 0 16px;
    }

    .topnav-links {
        width: 100%;
        justify-content: flex-start;
        gap: 4px;
    }

    table th, table td {
        padding: 10px 12px;
    }

    .card {
        padding: 18px;
    }

    .result-card-actions {
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}
