:root {
    --primary: #ea580c;
    --primary-dark: #c2410c;
    --sidebar-bg: #1e1b4b;
    --body-bg: #f8fafc;
    --card-bg: #ecd58e;
    --card-heading: #9a3412;
    --text-dark: #431407;
    --border: #e2e8f0;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --success-border: #a7f3d0;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --error-border: #fecaca;
    --info-bg: #eef2ff;
    --info-text: #3730a3;
    --info-border: #c7d2fe;
    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--body-bg);
    background-image: radial-gradient(#cbd5e1 0.5px, transparent 0.5px);
    background-size: 30px 30px;
    color: var(--text-dark);
    min-height: 100vh;
}

a {
    color: var(--primary);
}

/* ===================== App shell: sidebar + main ===================== */

body.app-body {
    display: flex;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    height: 100vh;
    position: fixed;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sidebar.hidden {
    transform: translateX(-260px);
}

.logo-box {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 14px;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
}

/* The platform mark. It carries its own tile and rounded corners, so it
   replaces .logo-box outright rather than sitting inside it. */
.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 15px;
    display: block;
    margin-bottom: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.split-auth-brand .brand-mark {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
}

.sidebar .brand-mark {
    width: 54px;
    height: 54px;
}

/* A college's own logo replaces the gradient tile, so it needs a neutral
   surface -- most logos are designed for white, not orange. */
.logo-box-image {
    width: 64px;
    height: 64px;
    background: white;
    padding: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.logo-box-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Thumbnail in the Super Admin colleges table. */
.logo-thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    display: block;
}

.nav-menu {
    list-style: none;
    margin-top: 32px;
}

.nav-item {
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.main-wrapper {
    margin-left: 260px;
    flex: 1;
    padding: 40px;
    transition: margin-left 0.4s ease;
}

.main-wrapper.expanded {
    margin-left: 0;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-260px);
    }
    .sidebar:not(.hidden) {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
        padding: 24px;
    }
}

/* ===================== Header wrapper ===================== */

.header-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 36px;
    align-items: stretch;
}

.top-header {
    background: white;
    padding: 22px 32px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex: 1;
    flex-wrap: wrap;
    gap: 1rem;
}

.vertical-toggle-btn {
    background: white;
    color: var(--primary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius);
    width: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.vertical-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===================== Buttons ===================== */

button, .btn {
    display: inline-block;
    width: 100%;
    padding: 12px 18px;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    transition: 0.2s;
}

button:hover, .btn:hover {
    filter: brightness(1.08);
}

.btn-auto {
    width: auto;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #fff7ed;
    filter: none;
}

.btn-danger {
    background: white;
    color: #b91c1c;
    border: 1px solid var(--error-border);
}

.btn-danger:hover {
    background: var(--error-bg);
    filter: none;
}

.logout-btn {
    width: auto;
    display: inline-block;
    padding: 10px 22px;
    background: none;
    border: 2px solid #ef4444;
    color: #ef4444;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    margin: 0;
    text-align: center;
    transition: 0.2s;
}

.logout-btn:hover {
    background: #ef4444;
    color: white;
}

/* ===================== Cards & grid ===================== */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    min-height: 160px;
    color: black;
    text-align: center;
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 25px 50px -12px rgba(234, 88, 12, 0.2);
}

.card h3 {
    color: var(--card-heading);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
}

.card i {
    color: var(--primary);
}

.card a.btn,
.card button {
    text-decoration: none;
}

.card p {
    font-size: 0.9rem;
    color: #57534e;
}

.card-plain {
    background: white;
    color: var(--text-dark);
    text-align: left;
}

.card-plain h3 {
    justify-content: flex-start;
}

.notice {
    background: #fff7ed;
    border-left: 4px solid var(--primary);
    padding: 12px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    border-radius: 6px;
    text-align: left;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--card-heading);
}

.empty-state {
    color: #78716c;
    font-size: 0.9rem;
}

/* ===================== Data tables ===================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.data-table th {
    text-align: left;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    padding: 16px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

.badge-danger {
    background: var(--error-bg);
    color: var(--error-text);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
}

/* ===================== Forms ===================== */

.field-group {
    max-width: 480px;
}

.field {
    margin-bottom: 18px;
    text-align: left;
}

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: 0.2s;
}

.field input:focus,
.field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

/* ===================== Alerts ===================== */

.alert {
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    text-align: left;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}

/* ===================== Sidebar footer ===================== */

.sidebar-footer {
    text-align: left;
}

/* ===================== Notifications ===================== */

.notification-wrapper {
    position: relative;
    margin-right: 18px;
}

/* Unread count on the bell. Without it the bell is a silent grey icon and
   students never discover they have anything waiting. */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #dc2626;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.notification-popover {
    position: absolute;
    right: 0;
    top: 2.2rem;
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(30, 27, 75, 0.15);
    padding: 0.75rem;
    z-index: 40;
    color: var(--text-dark);
    text-align: left;
}

.notification-popover a {
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.notification-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.notification-item:last-child {
    border-bottom: none;
}

/* ===================== Credentials box ===================== */

.credentials-box {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin: 1rem 0;
    text-align: left;
}

.credentials-box .credential-line {
    font-family: monospace;
    font-size: 1rem;
    margin: 0.35rem 0;
}

.email-send-box {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.email-send-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
}

.email-send-box button {
    width: auto;
    margin-top: 0;
}

/* ===================== Split-screen auth layout ===================== */

.split-auth {
    min-height: 100vh;
    display: flex;
}

.split-auth-brand {
    flex: 1;
    background: linear-gradient(150deg, var(--sidebar-bg) 0%, #0f0d2b 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.split-auth-brand .logo-box {
    width: 64px;
    height: 64px;
    font-size: 30px;
    margin: 0 auto 1.25rem;
}

.split-auth-brand h1 {
    color: #ffffff;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.01em;
}

.split-auth-brand p {
    color: var(--primary);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    margin: 0.75rem 0 0;
}

.split-auth-form {
    flex: 1;
    background: var(--body-bg);
    background-image: radial-gradient(#e2e8f0 0.5px, transparent 0.5px);
    background-size: 30px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(30, 27, 75, 0.1);
    text-align: left;
}

.auth-card h2 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    color: var(--card-heading);
}

.subtitle {
    margin: 0 0 1.5rem;
    color: #64748b;
    font-size: 0.9rem;
}

.auth-card label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-card input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
}

.auth-card input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}

.auth-card button[type="submit"] {
    margin-top: 1.5rem;
}

@media (max-width: 760px) {
    .split-auth {
        flex-direction: column;
    }
    .split-auth-brand {
        padding: 2.5rem 1.5rem;
    }
}

/* ===================== Error pages ===================== */

.error-page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(150deg, var(--sidebar-bg) 0%, #0f0d2b 100%);
}

.error-page-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(30, 27, 75, 0.1);
}

.error-page-card h1 {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
    color: var(--card-heading);
}

/* ===================== Tests: countdown ===================== */

.test-timer {
    position: sticky;
    top: 12px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    margin: 0 0 1.5rem auto;
    padding: 12px 22px;
    background: var(--sidebar-bg);
    color: #fed7aa;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(30, 27, 75, 0.25);
    font-weight: 700;
    transition: background 0.3s ease;
}

.test-timer i {
    color: var(--primary);
}

#testTimerValue {
    font-variant-numeric: tabular-nums;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    color: white;
}

.test-timer-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

.test-timer.is-urgent {
    background: #b91c1c;
    color: #fee2e2;
}

.test-timer.is-urgent i {
    color: #fecaca;
}

.test-timer.is-expired {
    background: #7f1d1d;
}

/* ===================== Tests: answering ===================== */

.option-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 0.85rem;
}

.option-choices label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.92rem;
    transition: 0.2s;
}

.option-choices label:hover {
    border-color: var(--primary);
    background: #fff7ed;
}

.option-choices input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ===================== Tests: reviewing ===================== */

.option-review {
    list-style: none;
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-review li {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.92rem;
}

.option-review li.is-correct {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
    font-weight: 600;
}

.option-review li.is-picked-wrong {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
    font-weight: 600;
}

.option-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 9px;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-card {
    border-left: 4px solid var(--border);
}

.review-card.review-correct {
    border-left-color: #10b981;
}

.review-card.review-wrong {
    border-left-color: #ef4444;
}

.explanation {
    margin-top: 0.85rem;
    padding: 10px 14px;
    background: var(--info-bg);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--info-text);
}

.score-banner {
    background: linear-gradient(135deg, var(--sidebar-bg), #0f0d2b);
    color: white;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(30, 27, 75, 0.2);
}

.score-banner-value {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.score-banner-value span {
    font-size: 1.35rem;
    font-weight: 600;
    opacity: 0.55;
}

.score-banner-percent {
    margin-top: 0.5rem;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.score-banner .empty-state {
    color: rgba(255, 255, 255, 0.6);
}

/* ===================== Live classes ===================== */

.live-card {
    border-left: 4px solid var(--border);
}

.live-card.is-live {
    border-left-color: #dc2626;
    box-shadow: 0 8px 30px rgba(220, 38, 38, 0.12);
}

.badge-live {
    background: #dc2626;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    animation: live-pulse 1.4s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

/* Respect users who have asked the OS to reduce motion. */
@media (prefers-reduced-motion: reduce) {
    .live-dot { animation: none; }
}

/* ===================== Reports ===================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-tile {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--card-heading);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table-scroll {
    overflow-x: auto;
}

/* Keeps a long marks table readable without the page scrolling sideways. */
.table-scroll .data-table {
    min-width: 640px;
}

.report-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ===================== Location footer ===================== */

.location-footer {
    position: fixed;
    right: 1rem;
    bottom: 0.75rem;
    background: rgba(30, 27, 75, 0.85);
    color: #fed7aa;
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    z-index: 50;
    pointer-events: none;
}

/* A notification that links somewhere should look and behave like a link. */
.notification-link {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    margin: 0 -4px;
    padding: 0.5rem 4px;
    transition: background 0.15s ease;
}

.notification-link:hover {
    background: #fff7ed;
}
