﻿* {
    box-sizing: border-box;
}

:root {
    --primary: #1565d8;
    --primary-dark: #0f4fb5;
    --primary-soft: #eaf2ff;
    --success: #168a55;
    --success-soft: #e9f8f0;
    --danger: #d92d20;
    --danger-soft: #fff0ef;
    --warning: #b54708;
    --warning-soft: #fff4e5;

    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #667085;
    --border: #e4e7ec;

    --radius: 16px;
    --shadow: 0 4px 18px rgba(16, 24, 40, .07);
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;
    padding-bottom: 78px;
    -webkit-font-smoothing: antialiased;
}

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

button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* =========================
   LOGIN
========================= */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at top, #eaf2ff 0, #f4f7fb 42%, #eef2f7 100%);
}

.loginbox {
    width: min(420px, 100%);
    padding: 30px 22px 24px;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: 0 14px 40px rgba(16, 24, 40, .12);
}

.loginbox h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -.4px;
}

.loginbox p {
    margin: 8px 0 20px;
    color: var(--muted);
    font-size: 14px;
}

.loginbox input,
.loginbox button {
    width: 100%;
    min-height: 52px;
    margin-top: 10px;
    padding: 13px 15px;
    border-radius: 13px;
    font-size: 16px;
}

.loginbox input {
    border: 1px solid #d0d5dd;
    background: #fff;
    outline: none;
}

.loginbox input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 216, .12);
}

.loginbox button {
    border: 0;
    background: linear-gradient(135deg, #1565d8, #0f4fb5);
    color: #fff;
    font-weight: 750;
    box-shadow: 0 6px 14px rgba(21, 101, 216, .22);
}

.loginbox button:active {
    transform: translateY(1px);
}

.loginbox small {
    display: block;
    margin-top: 14px;
    color: var(--muted);
    font-size: 12px;
}

.loginbox #loginError {
    min-height: 20px;
    margin-top: 10px;
    color: var(--danger);
    font-size: 13px;
}

/* =========================
   HEADER
========================= */

header.topbar {
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 15px;

    background: linear-gradient(135deg, #1565d8, #0f4fb5);
    color: #fff;

    box-shadow: 0 2px 12px rgba(16, 24, 40, .15);
}

.topbar small {
    opacity: .9;
    font-size: 12px;
}

.build {
    font-size: 11px;
    opacity: .75;
}

.logout {
    background: rgba(255,255,255,.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 10px;
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 650;
}

/* =========================
   MAIN
========================= */

main {
    width: min(100%, 900px);
    margin: auto;
    padding: 16px 14px 24px;
}

.hero {
    padding: 8px 2px 18px;
}

.hero small {
    color: var(--muted);
    font-size: 12px;
}

.hero h1 {
    margin: 5px 0 0;
    font-size: 25px;
    line-height: 1.2;
    letter-spacing: -.5px;
}

/* =========================
   DASHBOARD CARDS
========================= */

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.card {
    min-height: 108px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid rgba(228,231,236,.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card b {
    display: block;
    margin-bottom: 6px;
    font-size: 30px;
    line-height: 1;
    color: var(--primary);
}

.card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 550;
}

/* =========================
   SECTION HEADER
========================= */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 13px;
}

.section-head h2 {
    margin: 0;
    font-size: 20px;
}

.section-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* =========================
   BUTTONS
========================= */

.section-head button,
.actions button,
.student-actions button {
    border: 0;
    border-radius: 12px;
    font-weight: 700;
}

.section-head > button {
    min-height: 44px;
    padding: 0 14px;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 5px 12px rgba(21,101,216,.18);
}

/* =========================
   PANELS / FORMS
========================= */

.panel {
    margin-bottom: 14px;
    padding: 17px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel h2 {
    margin: 0 0 15px;
    font-size: 18px;
}

.formgrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.formgrid input,
.formgrid select,
.formgrid textarea {
    width: 100%;
    min-height: 50px;
    padding: 12px 13px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.formgrid input:focus,
.formgrid select:focus,
.formgrid textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,216,.10);
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0 0;
}

.actions button {
    min-height: 52px;
    padding: 12px 10px;
    text-align: center;
    font-size: 15px;
}

/* =========================
   SAVE BUTTONS
========================= */

#saveStudentButton,
#saveSessionButton,
#saveResultButton {
    background: var(--primary) !important;
    color: #fff !important;
    border: 0 !important;
    font-weight: 750;
    box-shadow: 0 5px 12px rgba(21,101,216,.18);
}

#saveStudentButton:hover,
#saveSessionButton:hover,
#saveResultButton:hover {
    background: var(--primary-dark) !important;
}

#cancelStudentButton,
#cancelSessionButton,
#cancelResultButton {
    background: #fff !important;
    color: var(--text) !important;
    border: 1px solid #d0d5dd !important;
}

/* =========================
   STUDENT FILTERS
========================= */

.student-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    margin-bottom: 12px;
}

.student-filters input,
.student-filters select {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: #fff;
    outline: none;
}

/* =========================
   LISTS
========================= */

.list {
    background: transparent;
}

.student {
    margin-bottom: 9px;
    padding: 15px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 2px 9px rgba(16,24,40,.05);
}

.student:last-child {
    margin-bottom: 0;
}

.student strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
}

.student small {
    color: var(--muted);
    font-size: 12px;
}

.student.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.student-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.student-actions button {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 12px;
}

.student-edit {
    background: var(--primary-soft);
    color: #175cd3;
}

.student-delete {
    background: var(--danger-soft);
    color: var(--danger);
}

/* =========================
   NAVIGATION
========================= */

nav.nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;

    height: 70px;

    display: flex;
    align-items: stretch;
    justify-content: space-around;

    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(16,24,40,.08);
}

.navbtn {
    flex: 1;
    max-width: 150px;
    border: 0;
    background: transparent;
    color: #667085;
    font-size: 12px;
    font-weight: 650;
    position: relative;
}

.navbtn.active {
    color: var(--primary);
    font-weight: 750;
}

.navbtn.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 3px;
    border-radius: 0 0 5px 5px;
    background: var(--primary);
}

/* =========================
   ERROR
========================= */

#studentFormError,
#sessionFormError,
#resultFormError {
    margin-top: 9px;
    color: var(--danger);
    font-size: 13px;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 600px) {

    main {
        padding: 14px 12px 20px;
    }

    .hero h1 {
        font-size: 23px;
    }

    .section-head {
        align-items: flex-start;
    }

    .section-head > button {
        flex-shrink: 0;
        min-height: 42px;
        padding: 0 12px;
    }

    .student.item {
        align-items: flex-start;
        flex-direction: column;
    }

    .student-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .student-actions .status {
        margin-right: auto;
    }

    .panel {
        padding: 15px;
    }

    .actions button {
        min-height: 50px;
    }
}

/* =========================
   TABLET / DESKTOP
========================= */

@media (min-width: 700px) {

    body {
        padding-bottom: 20px;
    }

    main {
        padding: 22px 18px 40px;
    }

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

    .formgrid {
        grid-template-columns: 1fr 1fr;
    }

    .student-filters {
        grid-template-columns: minmax(0, 2fr) 1fr 1fr;
    }

    nav.nav {
        position: static;
        width: min(900px, 100%);
        height: 58px;
        margin: 0 auto;
        border: 1px solid var(--border);
        border-radius: 15px;
    }
}
