/* ============================================================
   mentalmaths.css
   Shared styles for all BrainBuzz Mental Maths pages.
   Register, admin login, admin dashboard, teacher access/verify.
   ============================================================ */

/* ── Variables ───────────────────────────────────────────────── */
:root {
    --mm-primary:       #5867DD;
    --mm-primary-dark:  #4455c7;
    --mm-primary-light: rgba(88,103,221,.1);
    --mm-accent:        #84DCC6;
    --mm-bg:            #f5f6fb;
    --mm-border:        #e9ecef;
    --mm-text:          #333;
    --mm-muted:         #6c757d;
    --hero-gradient-start: rgba(88,103,221,.12);
    --hero-gradient-end:   rgba(132,220,198,.12);
}

/* ── Shared form elements ────────────────────────────────────── */
.form-label {
    font-weight: 600; font-size: .875rem; color: var(--mm-text);
    display: block; margin-bottom: .35rem;
}
.form-control {
    width: 100%; border: 2px solid var(--mm-border); border-radius: .6rem;
    padding: .6rem .85rem; font-size: .95rem; box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    border-color: var(--mm-primary);
    box-shadow: 0 0 0 3px var(--mm-primary-light);
    outline: none;
}
.form-control[readonly] { background: #f8f9fb; color: #555; }
.form-hint  { font-size: .78rem; color: var(--mm-muted); margin-top: .3rem; }
.form-group { margin-bottom: 1.1rem; }

/* ── Alerts ──────────────────────────────────────────────────── */
.form-alert {
    border-radius: .6rem; padding: .75rem 1rem; font-size: .875rem;
    margin-bottom: 1rem; display: none; align-items: flex-start; gap: .5rem;
}
.form-alert.show    { display: flex; }
.form-alert.error   { background: #fde8e9; border: 1px solid #f5c6cb; color: #842029; }
.form-alert.success { background: #d1f2ea; border: 1px solid #84DCC6;  color: #0a6547; }
.form-alert.warning { background: #fff8e1; border: 1px solid #ffc107;  color: #856404; }

/* ── Primary gradient button (register, login, modal) ────────── */
.btn-register,
.btn-login,
.btn-modal-send {
    background: linear-gradient(135deg, var(--mm-primary) 0%, var(--mm-accent) 100%);
    border: none; color: white; font-weight: 700; border-radius: 2rem;
    cursor: pointer; transition: all .2s;
}
.btn-register   { width: 100%; margin-top: .5rem; padding: .75rem 2rem; font-size: 1rem; }
.btn-login      { width: 100%; margin-top: .5rem; padding: .8rem 2rem;  font-size: 1rem; }
.btn-modal-send { flex: 2; padding: .65rem; font-size: .9rem; font-weight: 700; }

.btn-register:hover,
.btn-login:hover            { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(88,103,221,.3); }
.btn-register:disabled,
.btn-login:disabled,
.btn-modal-send:disabled    { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner-sm {
    display: inline-block; width: .9rem; height: .9rem;
    border: 2px solid rgba(255,255,255,.4); border-top-color: white;
    border-radius: 50%; animation: mm-spin .6s linear infinite;
    margin-right: .4rem; vertical-align: -.15em;
}
@keyframes mm-spin { to { transform: rotate(360deg); } }

/* ── Status badge ────────────────────────────────────────────── */
.status-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .35rem .85rem; border-radius: 2rem; font-size: .8rem; font-weight: 700;
}
.status-badge.warning { background: #fff3cd; color: #856404; }
.status-badge.success { background: #d1f2ea; color: #0a6547; }
.status-badge.danger  { background: #fde8e9; color: #842029; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    background: #333; color: white; border-radius: .75rem;
    padding: .75rem 1.25rem; font-size: .875rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    transform: translateY(4rem); opacity: 0; transition: all .3s;
    z-index: 999; display: flex; align-items: center; gap: .5rem;
}
.toast.show    { transform: translateY(0); opacity: 1; }
.toast.success { background: #0a6547; }
.toast.error   { background: #842029; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: white; border-radius: 14px;
    padding: 2rem; width: 100%; max-width: 380px; margin: 1rem;
}
.modal-box h3     { font-weight: 800; margin: 0 0 .5rem; }
.modal-box p      { font-size: .875rem; color: #666; margin: 0 0 1.25rem; }
.modal-actions    { display: flex; gap: .75rem; margin-top: 1rem; }
.btn-modal-cancel {
    flex: 1; background: #f0f0f0; border: none; border-radius: 2rem;
    padding: .65rem; font-weight: 600; cursor: pointer; font-size: .9rem;
}

/* ══════════════════════════════════════════════════════════════
   REGISTER PAGE
   ══════════════════════════════════════════════════════════════ */
.reg-hero {
    background: linear-gradient(135deg, rgba(88,103,221,.12) 0%, rgba(132,220,198,.12) 100%);
    border-bottom: 1px solid rgba(88,103,221,.15);
    padding: 2.25rem 0 2rem; text-align: center;
}
.reg-hero h1 { font-size: clamp(1.6rem,4vw,2.4rem); font-weight: 800; margin-bottom: .4rem; }
.reg-hero p  { color: #555; font-size: 1rem; margin: 0; }

.reg-card {
    background: white; border-radius: 14px;
    box-shadow: 0 2px 20px rgba(0,0,0,.08);
    padding: 2rem 2.25rem; max-width: 700px; margin: 0 auto;
}

.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1.75rem; }
.type-btn    { border: 2px solid var(--mm-border); border-radius: .75rem; padding: 1.25rem 1rem; background: white; cursor: pointer; text-align: center; transition: all .2s; color: #555; }
.type-btn:hover  { border-color: var(--mm-primary); background: #f8f9fe; }
.type-btn.active { border-color: var(--mm-primary); background: linear-gradient(135deg,rgba(88,103,221,.08),rgba(132,220,198,.08)); color: var(--mm-primary); }
.type-btn i      { font-size: 1.75rem; display: block; margin-bottom: .5rem; }
.type-btn strong { display: block; font-size: .95rem; margin-bottom: .2rem; }
.type-btn span   { font-size: .78rem; color: #888; }
.type-btn.active span { color: var(--mm-primary); }

.step-panel        { display: none; }
.step-panel.active { display: block; }

.form-section              { border-top: 2px solid #f0f0f0; padding-top: 1.5rem; margin-top: 1.5rem; }
.form-section:first-child  { border-top: none; padding-top: 0; margin-top: 0; }
.form-section-title {
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--mm-primary);
    margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
}

.match-warning      { display: none; background: #fff8e1; border: 2px solid #ffc107; border-radius: .75rem; padding: 1.25rem 1.5rem; margin-top: 1rem; }
.match-warning.show { display: block; }
.match-warning h5   { color: #856404; font-size: .95rem; font-weight: 700; margin-bottom: .5rem; }
.match-warning p    { font-size: .875rem; color: #6d5010; margin-bottom: .75rem; }
.match-actions      { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn-match-yes { background: var(--mm-primary); color: white; border: none; border-radius: 2rem; padding: .5rem 1.25rem; font-size: .85rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-match-no  { background: white; color: var(--mm-primary); border: 2px solid var(--mm-primary); border-radius: 2rem; padding: .5rem 1.25rem; font-size: .85rem; font-weight: 600; cursor: pointer; }

.seat-selector       { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; background: #f8f9fb; border-radius: .75rem; border: 2px solid var(--mm-border); }
.seat-selector label { font-weight: 600; font-size: .875rem; flex: 1; margin: 0; }
.seat-count          { display: flex; align-items: center; gap: .5rem; }
.seat-btn            { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--mm-primary); background: white; color: var(--mm-primary); font-size: 1.1rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.seat-btn:hover      { background: var(--mm-primary); color: white; }
.seat-btn:disabled   { opacity: .3; cursor: not-allowed; }
#seatDisplay         { font-size: 1.4rem; font-weight: 800; color: var(--mm-primary); min-width: 2.5rem; text-align: center; }

.price-preview          { background: linear-gradient(135deg,rgba(88,103,221,.08),rgba(132,220,198,.08)); border: 1px solid rgba(88,103,221,.2); border-radius: .75rem; padding: 1rem 1.25rem; margin-top: .75rem; display: flex; justify-content: space-between; align-items: center; }
.price-preview .p-label { font-size: .875rem; color: #555; }
.price-preview .p-break { font-size: .78rem; color: #888; }
.price-preview .p-amount { font-size: 1.3rem; font-weight: 800; color: var(--mm-primary); }

.consent-box   { background: #f8f9fb; border-radius: .6rem; padding: 1rem; font-size: .82rem; color: #555; }
.consent-box a { color: var(--mm-primary); }

.success-panel      { text-align: center; padding: 1rem; }
.success-icon       { width: 5rem; height: 5rem; background: linear-gradient(135deg,var(--mm-primary),var(--mm-accent)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: white; margin: 0 auto 1.5rem; }
.next-step-list     { text-align: left; background: #f8f9fb; border-radius: .75rem; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.next-step-item     { display: flex; gap: .75rem; margin-bottom: .85rem; }
.next-step-item:last-child { margin-bottom: 0; }
.step-num           { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: linear-gradient(135deg,var(--mm-primary),var(--mm-accent)); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }

.already-link   { text-align: center; font-size: .85rem; color: var(--mm-muted); margin-top: 1.5rem; }
.already-link a { color: var(--mm-primary); font-weight: 600; text-decoration: none; }
.back-btn       { background: none; border: none; color: var(--mm-primary); font-size: .85rem; font-weight: 600; padding: 0; margin-bottom: 1.25rem; cursor: pointer; }

/* ══════════════════════════════════════════════════════════════
   ADMIN LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */

/* Hero banner — solid gradient, white text, centred */
.login-hero {
    background: linear-gradient(135deg, var(--mm-primary) 0%, var(--mm-accent) 100%);
    padding: 2.5rem 0 2rem;
    color: white;
    text-align: center;
}
.login-hero .hero-badge {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.3);
    color: white;
    border-radius: 2rem;
    padding: .4rem 1.1rem;
    font-size: .85rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: .9rem;
}
.login-hero h1 { font-size: clamp(1.6rem,4vw,2rem); font-weight: 800; margin-bottom: .35rem; color: white; }
.login-hero p  { opacity: .88; margin-bottom: 0; font-size: 1rem; }

/* Card */
.login-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 20px rgba(0,0,0,.08);
    padding: 2rem 2.25rem;
}
@media (max-width: 540px) {
    .login-card { padding: 1.5rem 1.25rem; }
}

/* Welcome banner (shown after successful registration) */
.welcome-banner    { background: linear-gradient(135deg,rgba(88,103,221,.08),rgba(132,220,198,.08)); border: 1px solid rgba(88,103,221,.25); border-radius: .75rem; padding: .9rem 1rem; font-size: .85rem; color: #3a4ab0; margin-bottom: 1.5rem; display: flex; gap: .6rem; align-items: flex-start; }
.welcome-banner i  { flex-shrink: 0; margin-top: .1rem; }

/* Password field show/hide toggle */
.password-wrap              { position: relative; }
.password-wrap .form-control { padding-right: 2.8rem; }
.pwd-toggle                 { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #aaa; font-size: 1rem; padding: 0; transition: color .15s; }
.pwd-toggle:hover           { color: var(--mm-primary); }

/* Footer links row */
.login-footer           { text-align: center; margin-top: 1.5rem; font-size: .82rem; color: #888; }
.login-footer a         { color: var(--mm-primary); text-decoration: none; font-weight: 600; }
.login-footer a:hover   { text-decoration: underline; }
.login-footer .divider  { margin: 0 .5rem; color: #ccc; }

/* Reset button — same style as .btn-login */
.btn-reset {
    background: linear-gradient(135deg, var(--mm-primary) 0%, var(--mm-accent) 100%);
    border: none; color: white; font-weight: 700; border-radius: 2rem;
    cursor: pointer; transition: all .2s;
    width: 100%; margin-top: .5rem; padding: .8rem 2rem; font-size: 1rem;
}
.btn-reset:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(88,103,221,.3); }
.btn-reset:disabled             { opacity: .6; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════════════════════════════
   ADMIN DASHBOARD
   ══════════════════════════════════════════════════════════════ */
.admin-topbar              { background: linear-gradient(135deg,var(--mm-primary) 0%,var(--mm-accent) 100%); padding: .9rem 0; color: white; }
.admin-topbar .container   { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.admin-topbar h1           { font-size: 1.1rem; font-weight: 800; margin: 0; }
.admin-topbar .school-tag  { font-size: .82rem; opacity: .9; }
.topbar-actions            { display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
.topbar-actions a          { color: rgba(255,255,255,.85); text-decoration: none; }
.topbar-actions a:hover    { color: white; }

.dash-card             { background: white; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.07); padding: 1.5rem; margin-bottom: 1.25rem; }
.dash-card-title       { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mm-primary); display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }

.stat-row              { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-box              { background: #f8f9fb; border-radius: .75rem; padding: 1rem 1.25rem; }
.stat-box .stat-val    { font-size: 1.6rem; font-weight: 800; color: var(--mm-primary); line-height: 1.1; word-break: break-word; }
.stat-box .stat-label  { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9ca3af; margin-top: .35rem; }

.pending-banner         { background: #fff8e1; border: 2px solid #ffc107; border-radius: .75rem; padding: 1rem 1.25rem; margin-bottom: 1.25rem; display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.pending-banner .pb-text { flex: 1; min-width: 200px; }
.pending-banner h5      { color: #856404; font-weight: 700; margin: 0 0 .25rem; font-size: .95rem; }
.pending-banner p       { color: #6d5010; font-size: .85rem; margin: 0; }

.btn-send-invoice           { background: var(--mm-primary); color: white; border: none; border-radius: 2rem; padding: .55rem 1.25rem; font-size: .875rem; font-weight: 700; cursor: pointer; white-space: nowrap; align-self: center; transition: all .15s; }
.btn-send-invoice:hover     { background: var(--mm-primary-dark); }
.btn-send-invoice:disabled  { opacity: .6; cursor: not-allowed; }

.dash-tabs          { display: flex; gap: .25rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.dash-tab           { border: 2px solid var(--mm-border); background: white; border-radius: .6rem; padding: .5rem 1.1rem; font-size: .875rem; font-weight: 600; color: #555; cursor: pointer; transition: all .15s; }
.dash-tab:hover     { border-color: var(--mm-primary); color: var(--mm-primary); }
.dash-tab.active    { border-color: var(--mm-primary); background: var(--mm-primary); color: white; }

.tab-panel          { display: none; }
.tab-panel.active   { display: block; }

.seat-table                 { width: 100%; border-collapse: collapse; }
.seat-table th              { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #888; padding: .6rem .75rem; text-align: left; border-bottom: 2px solid #f0f0f0; }
.seat-table td              { padding: .65rem .75rem; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.seat-table tr:last-child td { border-bottom: none; }
.seat-table tr:hover td     { background: #fafafa; }
.seat-num                   { font-size: .78rem; color: #aaa; font-weight: 700; width: 2rem; }

.seat-input         { border: 1px solid var(--mm-border); border-radius: .5rem; padding: .4rem .65rem; font-size: .875rem; width: 100%; box-sizing: border-box; transition: border-color .15s; }
.seat-input:focus   { border-color: var(--mm-primary); outline: none; box-shadow: 0 0 0 2px var(--mm-primary-light); }

.last-login-cell    { font-size: .78rem; color: #888; white-space: nowrap; }

.btn-save-seat              { background: var(--mm-primary); color: white; border: none; border-radius: .5rem; padding: .4rem .85rem; font-size: .8rem; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn-save-seat:hover        { background: var(--mm-primary-dark); }
.btn-save-seat:disabled     { opacity: .5; cursor: not-allowed; }
.btn-save-seat.saved        { background: #28a745; }
.btn-save-seat.hidden       { display: none; }

/* ── Pending seat badge ── */
.badge-pending {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    border-radius: 1rem;
    font-size: .65rem;
    font-weight: 700;
    padding: .1rem .45rem;
    margin-left: .35rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.btn-notify-seat            { background: #28a745; color: white; border: none; border-radius: .5rem; padding: .4rem .85rem; font-size: .8rem; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; }
.btn-notify-seat:hover      { background: #218838; }
.btn-notify-seat:disabled   { background: #aaa; cursor: not-allowed; opacity: 1; }

.btn-clear-seat             { background: none; border: 1px solid #dee2e6; color: #aaa; border-radius: .5rem; padding: .4rem .6rem; font-size: .8rem; cursor: pointer; margin-left: .25rem; transition: all .15s; }
.btn-clear-seat:hover       { border-color: #dc3545; color: #dc3545; }

.sub-detail-row             { display: flex; justify-content: space-between; align-items: center; padding: .75rem 0; border-bottom: 1px solid #f0f0f0; font-size: .9rem; }
.sub-detail-row:last-child  { border-bottom: none; }
.sub-detail-label           { color: #666; }
.sub-detail-value           { font-weight: 600; color: var(--mm-text); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .type-toggle            { grid-template-columns: 1fr; }
    .seat-table thead       { display: none; }
    .seat-table tr          { display: block; padding: .75rem; border-bottom: 1px solid #f0f0f0; }
    .seat-table td          { display: block; padding: .2rem 0; border: none; }
    .seat-table td::before  { content: attr(data-label); font-size: .72rem; color: #aaa; display: block; }
}

/* ══════════════════════════════════════════════════════════════
   TEACHER ACCESS & VERIFY PAGES
   ══════════════════════════════════════════════════════════════ */
.access-hero {
    background: linear-gradient(135deg, rgba(88,103,221,.12) 0%, rgba(132,220,198,.12) 100%);
    border-bottom: 1px solid rgba(88,103,221,.15);
    padding: 3rem 0 2.5rem; text-align: center;
}
.access-hero-icon {
    width: 3.5rem; height: 3.5rem;
    background: linear-gradient(135deg, var(--mm-primary), var(--mm-accent));
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.75rem; color: white;
    margin-bottom: 1rem;
}
.access-hero h1 { font-size: clamp(1.4rem,4vw,2rem); font-weight: 800; margin-bottom: .4rem; }
.access-hero p  { color: #555; font-size: 1rem; margin: 0; }

.access-card {
    background: white; border-radius: 14px;
    box-shadow: 0 2px 20px rgba(0,0,0,.08);
    padding: 2.5rem;
    max-width: 480px; margin: 2rem auto;
}

.access-card .form-label { margin-bottom: .5rem; }
.access-card .form-control { padding: .8rem 1rem; font-size: 1rem; }
.access-card .form-hint { margin-top: .5rem; margin-bottom: 1.25rem; }
.access-card .btn-register { margin-top: .25rem; padding: .9rem; font-size: 1.05rem; }

.access-footer {
    text-align: center; font-size: .85rem;
    color: var(--mm-muted); margin-top: 1.5rem; line-height: 1.6;
}

/* ── OTP digit inputs ────────────────────────────────────────── */
.otp-input-row {
    display: flex; align-items: center; justify-content: center;
    gap: .5rem; margin: 1rem 0;
}
.otp-digit {
    width: 3rem; height: 3.5rem;
    border: 2px solid var(--mm-border); border-radius: .6rem;
    font-size: 1.5rem; font-weight: 800; text-align: center;
    color: var(--mm-primary); transition: border-color .15s, box-shadow .15s;
    -moz-appearance: textfield;
}
.otp-digit::-webkit-outer-spin-button,
.otp-digit::-webkit-inner-spin-button { -webkit-appearance: none; }
.otp-digit:focus {
    border-color: var(--mm-primary);
    box-shadow: 0 0 0 3px var(--mm-primary-light);
    outline: none;
}
.otp-digit.filled { border-color: var(--mm-primary); background: rgba(88,103,221,.04); }
.otp-sep { font-size: 1.25rem; color: #ccc; font-weight: 300; margin: 0 .25rem; }

@media (max-width: 400px) {
    .otp-digit { width: 2.5rem; height: 3rem; font-size: 1.25rem; }
}

/* ══════════════════════════════════════════════════════════════
   TEACHER BAR
   Slim logged-in indicator shown on all test pages.
   ══════════════════════════════════════════════════════════════ */
.mm-teacher-bar {
    background: linear-gradient(135deg, var(--mm-primary) 0%, var(--mm-accent) 100%);
    padding: .55rem 0;
    font-size: .82rem;
}
.mm-teacher-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mm-teacher-greeting {
    color: rgba(255,255,255,.9);
    display: flex;
    align-items: center;
    gap: .35rem;
}
.mm-teacher-greeting i  { color: white; }
.mm-teacher-school      { color: rgba(255,255,255,.7); }
.mm-teacher-logout {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    transition: color .15s;
}
.mm-teacher-logout:hover { color: white; }

/* ══════════════════════════════════════════════════════════════
   CLASS.PHP — shared structural styles (colour-independent)
   ══════════════════════════════════════════════════════════════ */

/* Show/hide views */
.view        { display: none; }
.view.active { display: block; }

/* Category badge */
.category-badge {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 1.5rem;
    color: white;
}
.category-badge.cat-1 { background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%); }
.category-badge.cat-2 { background: linear-gradient(135deg, #198754 0%, #157347 100%); }
.category-badge.cat-3 { background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%); color: #000; }

/* Progress bar */
.progress-bar-container {
    background: #e9ecef;
    height: 8px;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.progress-bar-fill {
    height: 100%;
    transition: width .4s ease;
    width: 0%;
}

/* Control buttons row */
.control-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Question number label */
.question-number {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* Answers grid */
.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}
.answer-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: .5rem;
}
.answer-number {
    font-weight: 700;
    display: block;
    margin-bottom: .5rem;
}

/* Slide-in animation (used by answer display cards) */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Timer input group */
.timer-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: .5rem;
}
.timer-input-group.has-error {
    background: #fff3cd;
    border: 2px solid #ffc107;
}
.timer-input-label {
    flex: 1;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.timer-input-field {
    width: 100px;
    padding: .5rem;
    border: 2px solid #dee2e6;
    border-radius: .5rem;
    font-size: 1.1rem;
    text-align: center;
}
.error-text {
    color: #dc3545;
    font-size: .9rem;
    margin-top: .5rem;
    display: none;
}
.timer-input-group.has-error .error-text { display: block; }

/* ══════════════════════════════════════════════════════════════
   MENTALMATHS LANDING PAGE (mentalmaths.php)
   ══════════════════════════════════════════════════════════════ */

.mm-landing-hero {
    background: linear-gradient(135deg, var(--hero-gradient-start) 0%, var(--hero-gradient-end) 100%);
    padding: 2.5rem 0;
    border-bottom: 1px solid rgba(88,103,221,.15);
}
.mm-landing-hero h1 {
    font-size: clamp(2rem,5vw,3rem); font-weight: 800; margin-bottom: .5rem;
    color: var(--mm-primary);
}
.mm-landing-hero p.lead { font-size: 1.05rem; color: #555; max-width: 580px; }

.btn-how-to {
    background: white; border: 2px solid var(--mm-primary); color: var(--mm-primary);
    font-weight: 600; border-radius: 2rem; padding: .5rem 1.25rem;
    transition: all .2s; text-decoration: none;
    display: inline-flex; align-items: center;
}
.btn-how-to:hover { background: var(--mm-primary); color: white; }

/* ── Tests section ── */
.tests-section {
    background: linear-gradient(135deg, rgba(88,103,221,.05) 0%, rgba(132,220,198,.05) 100%);
    min-height: 60vh;
}

/* ── Filter sidebar ── */
.filter-sidebar {
    background: white; border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    padding: 1.25rem; position: sticky; top: 1.5rem;
}
.filter-sidebar h6 {
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: #9aa0aa; margin-bottom: .75rem;
}
.filter-btn {
    display: block; width: 100%; text-align: left;
    background: none; border: none; border-radius: .5rem;
    padding: .55rem .85rem; font-weight: 600; font-size: .9rem;
    color: #495057; cursor: pointer; transition: all .15s; margin-bottom: .2rem;
}
.filter-btn:hover  { background: rgba(88,103,221,.08); color: var(--mm-primary); }
.filter-btn.active { background: linear-gradient(135deg,var(--mm-primary) 0%,var(--mm-accent) 100%); color: white; }

/* ── Tests table ── */
.tests-table { background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.tests-table thead { background: #f8f9fa; }
.tests-table thead th { border-bottom: 2px solid #e9ecef; font-weight: 600; padding: 1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; }
.tests-table tbody td { padding: .9rem 1rem; vertical-align: middle; }
.tests-table tbody tr:hover { background-color: var(--hero-gradient-start); }
.tests-table tbody tr.row-hidden { display: none; }

/* ── Locked rows ── */
.tests-table tbody tr.row-locked td,
.tests-table tbody tr.row-locked td strong,
.tests-table tbody tr.row-locked td small { color: #aaa; }
.tests-table tbody tr.row-locked td .badge { opacity: .4; }
.tests-table tbody tr.row-locked:hover { background: none; }

/* Grey Start Test button — always fully visible */
.btn-grey-start {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #e8e8e8;
    color: #888;
    border: 2px solid #d0d0d0;
    border-radius: .4rem;
    padding: .3rem .9rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-grey-start:hover {
    background: #d8d8d8;
    color: #555;
}

/* ── Free badge ── */
.badge-free {
    display: inline-block; background: #d1f2ea; color: #0a6547;
    font-size: .7rem; font-weight: 700; padding: .15rem .5rem;
    border-radius: 1rem; margin-left: .4rem; vertical-align: middle;
}

/* ── Results meta ── */
.results-meta { font-size: .85rem; color: #6c757d; margin-bottom: .75rem; min-height: 1.25rem; }

/* ── Pagination ── */
.mm-pagination { display: flex; align-items: center; justify-content: center; gap: .35rem; margin-top: 1.25rem; flex-wrap: wrap; }
.mm-pagination button { border: 1.5px solid #dee2e6; background: white; border-radius: .5rem; padding: .4rem .75rem; font-size: .875rem; font-weight: 600; color: #495057; cursor: pointer; transition: all .15s; min-width: 38px; line-height: 1; }
.mm-pagination button:hover:not(:disabled) { border-color: var(--mm-primary); color: var(--mm-primary); background: rgba(88,103,221,.05); }
.mm-pagination button.pag-active { background: linear-gradient(135deg,var(--mm-primary) 0%,var(--mm-accent) 100%); border-color: transparent; color: white; }
.mm-pagination button:disabled { opacity: .35; cursor: default; }

/* ── How-to modal ── */
.modal-how .modal-header { background: linear-gradient(135deg,var(--mm-primary) 0%,var(--mm-accent) 100%); color: white; border-bottom: none; }
.modal-how .btn-close { filter: invert(1); }
.step-item { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.step-body > strong { display: block; margin-bottom: .2rem; }
.step-body p strong { display: inline; margin-bottom: 0; }
.step-body p { margin: 0; font-size: .9rem; color: #555; }
.timing-example { background: #f8f9fa; border-left: 4px solid #ffc107; border-radius: 0 .5rem .5rem 0; padding: .9rem 1.1rem; font-size: .875rem; }

/* ── Unlock modal ── */
.unlock-modal-body { text-align: center; padding: 1.5rem 1rem; }
.unlock-icon { width: 3.5rem; height: 3.5rem; background: #f0f0f0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #999; margin-bottom: 1rem; }
.unlock-options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1.25rem; }
.unlock-opt {
    border: 2px solid var(--mm-border); border-radius: .75rem; padding: 1rem .75rem;
    text-decoration: none; color: var(--mm-text); transition: all .15s; text-align: center;
}
.unlock-opt:hover { border-color: var(--mm-primary); background: rgba(88,103,221,.04); color: var(--mm-primary); }
.unlock-opt i { font-size: 1.5rem; display: block; margin-bottom: .4rem; color: var(--mm-primary); }
.unlock-opt strong { display: block; font-size: .9rem; }
.unlock-opt span { font-size: .75rem; color: #888; }
.unlock-already { margin-top: 1rem; font-size: .82rem; color: var(--mm-muted); }
.unlock-already a { color: var(--mm-primary); font-weight: 600; text-decoration: none; }

/* ── Primary action buttons (listing page) ── */
.btn-start-test {
    display: inline-flex; align-items: center; gap: .35rem;
    background: var(--mm-primary); color: white;
    border: none; border-radius: .4rem;
    padding: .4rem 1rem; font-size: .875rem; font-weight: 600;
    text-decoration: none; cursor: pointer; transition: background .15s;
}
.btn-start-test:hover { background: var(--mm-accent); color: white; }

.btn-mm-primary {
    display: block; text-align: center;
    padding: .4rem .75rem; font-size: .8rem; font-weight: 600;
    border-radius: .4rem; background: var(--mm-primary); color: #fff;
    text-decoration: none; margin-bottom: .5rem; transition: background .15s;
}
.btn-mm-primary:hover { background: var(--mm-primary-dark); color: #fff; }

.btn-mm-outline {
    display: block; text-align: center;
    padding: .4rem .75rem; font-size: .8rem; font-weight: 600;
    border-radius: .4rem; background: #fff; color: var(--mm-primary);
    border: 2px solid var(--mm-primary); text-decoration: none; transition: all .15s;
}
.btn-mm-outline:hover { background: var(--mm-primary); color: #fff; }

/* All-tests dot uses primary colour */
.dot-all { background: var(--mm-primary); }

/* ── Category timer cards (class.php settings view) ── */
.cat-timer-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s;
}
.cat-timer-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.12); }

.cat-timer-card__accent {
    height: 5px;
    width: 100%;
}
.cat-timer-card--1 .cat-timer-card__accent { background: linear-gradient(90deg, #0d6efd, #0b5ed7); }
.cat-timer-card--2 .cat-timer-card__accent { background: linear-gradient(90deg, #198754, #157347); }
.cat-timer-card--3 .cat-timer-card__accent { background: linear-gradient(90deg, #ffc107, #ffb300); }

.cat-timer-card__body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.cat-timer-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.cat-timer-card__count {
    font-size: .8rem;
    font-weight: 700;
    color: #6c757d;
    background: #f1f3f5;
    padding: .2rem .65rem;
    border-radius: 2rem;
}
.cat-timer-card__name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: .4rem;
}
.cat-timer-card__desc {
    font-size: .85rem;
    color: #6c757d;
    line-height: 1.5;
    flex: 1;
    margin-bottom: 1.5rem;
}
.cat-timer-card__input-wrap {
    border-top: 1px solid #f0f0f0;
    padding-top: 1.25rem;
}
.cat-timer-card__input-label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9ca3af;
    margin-bottom: .6rem;
}
.cat-timer-card__stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-bottom: .4rem;
}
.cat-stepper-btn {
    width: 2.25rem; height: 2.25rem;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    background: white;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: #495057;
    transition: all .15s;
    display: flex; align-items: center; justify-content: center;
}
.cat-stepper-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.cat-timer-card__input {
    width: 5rem;
    padding: .5rem;
    border: 2px solid #dee2e6;
    border-radius: .5rem;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    color: #2c3e50;
    -moz-appearance: textfield;
}
.cat-timer-card__input::-webkit-outer-spin-button,
.cat-timer-card__input::-webkit-inner-spin-button { -webkit-appearance: none; }
.cat-timer-card__input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-shadow);
}
.cat-timer-card__range {
    text-align: center;
    font-size: .75rem;
    color: #adb5bd;
}

/* Error state on the card */
.cat-timer-card.has-error {
    box-shadow: 0 0 0 2px #dc3545, 0 4px 16px rgba(220,53,69,.15);
}
.cat-timer-card.has-error .cat-timer-card__input { border-color: #dc3545; }
.cat-timer-card.has-error .error-text { display: block; text-align: center; margin-top: .5rem; }

/* ── School logo (hero — class.php, index.php) ── */
.school-logo-wrap { margin-bottom: 1.25rem; }
.school-logo-img  {
    max-height: 80px;
    max-width: 260px;
    object-fit: contain;
    background: rgba(255,255,255,.92);
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

/* ── Responsive ── */
@media (max-width: 767px) {
    .tests-table { font-size: .875rem; }
    .tests-table td .btn { width: 100%; }
    .mm-landing-hero { text-align: center; }
    .mm-landing-hero p.lead { margin: 0 auto 1rem; }
    .filter-sidebar { position: static; }
    .filter-btn { display: inline-block; width: auto; margin-right: .3rem; margin-bottom: .4rem; }
    .unlock-options { grid-template-columns: 1fr; }
}

/* ===========================================
   SCHOOL TEST LISTING PAGE
   =========================================== */

/* ── Type filter pills ─────────────────────────── */
.type-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
}

.type-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .85rem;
    border-radius: 2rem;
    border: 2px solid #e5e7eb;
    background: #fff;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    color: #6b7280;
}
.type-pill:hover          { border-color: var(--mm-primary); color: var(--mm-primary); }
.type-pill.active         { border-color: var(--mm-primary); background: color-mix(in srgb, var(--mm-primary) 10%, transparent); color: var(--mm-primary); }
.type-pill .dot           { width: 8px; height: 8px; border-radius: 50%; }
.dot-platform             { background: var(--mm-primary); }
.dot-school               { background: #10b981; }
.dot-seat                 { background: #f59e0b; }

/* ── Test type badges ──────────────────────────── */
.badge-platform {
    background: color-mix(in srgb, var(--mm-primary) 10%, transparent);
    color: var(--mm-primary);
    border: 1px solid color-mix(in srgb, var(--mm-primary) 25%, transparent);
    font-size: .72rem; font-weight: 700;
    padding: .25rem .6rem; border-radius: 1rem;
    white-space: nowrap;
}
.badge-school {
    background: #d1fae5; color: #065f46;
    border: 1px solid #6ee7b7;
    font-size: .72rem; font-weight: 700;
    padding: .25rem .6rem; border-radius: 1rem;
    white-space: nowrap;
}
.badge-seat {
    background: #fef3c7; color: #92400e;
    border: 1px solid #fcd34d;
    font-size: .72rem; font-weight: 700;
    padding: .25rem .6rem; border-radius: 1rem;
    white-space: nowrap;
}

/* ── Loading skeleton ──────────────────────────── */
.skeleton-row td { padding: .85rem 1rem; }
.skeleton-bar {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Empty state ───────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}
.empty-state i {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
}

/* ══════════════════════════════════════════════════════════════
   APP INSTALL BANNER
   Shown on mobile browsers on homeaccess pages
   ══════════════════════════════════════════════════════════════ */

.app-install-banner {
    display: none; /* hidden on desktop */
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border-bottom: 1px solid var(--mm-border);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.app-install-banner__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--mm-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.app-install-banner__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.app-install-banner__text strong {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--mm-text);
    line-height: 1.2;
}
.app-install-banner__text span {
    font-size: 0.75rem;
    color: var(--mm-muted);
    line-height: 1.3;
}
.app-install-banner__btn {
    flex-shrink: 0;
    background: var(--mm-primary);
    color: #fff;
    border-radius: 8px;
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s;
}
.app-install-banner__btn:hover { background: var(--mm-primary-dark); color: #fff; }
.app-install-banner__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--mm-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}

/* Only show on mobile */
@media (max-width: 767px) {
    .app-install-banner { display: flex; }
}