/* ============================================================
   Brandlevate CBT – Staff Portal Styles
   Author: Brandlevate Technologies | v1.0.0
   ============================================================ */

/* ── Portal wrapper ─────────────────────────────────────────── */
.blv-sp-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1f2937;
    min-height: 100vh;
    background: #f3f4f6;
}

/* ── Header ─────────────────────────────────────────────────── */
.blv-sp-header {
    position: sticky;
    top: 0;
    z-index: 200;
    /* Dark ribbon, same family as the student portal. The header previously
       forced a white background while the shared .blv-dash-header rules made
       every piece of text white, so name, ID and Logout were invisible. */
    background: linear-gradient(120deg, #0f1b3d 0%, #1d4ed8 100%);
    border-bottom: 3px solid #f5b301;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    color: #fff;
}
.blv-sp-header .blv-student-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 3px; }
.blv-sp-header .blv-student-name { color: #ffffff; font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.blv-sp-header .blv-student-meta {
    color: rgba(255,255,255,.9);
    font-size: .8rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
}
.blv-sp-header .blv-sp-staffid { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; color: #fde68a; }
.blv-sp-header .blv-portal-badge-sm {
    background: rgba(255,255,255,.18);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,.35);
    padding: 2px 10px;
}
.blv-sp-header .blv-btn-outline,
.blv-sp-header .blv-btn {
    background: rgba(255,255,255,.12);
    color: #ffffff;
    border: 1.5px solid rgba(255,255,255,.65);
    text-decoration: none;
}
.blv-sp-header .blv-btn-outline:hover,
.blv-sp-header .blv-btn:hover {
    background: #ffffff;
    color: #1e3a8a;
    border-color: #ffffff;
}
.blv-sp-header .blv-top-logo { background: #fff; border-radius: 6px; padding: 3px 6px; }

.blv-sp-header-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ── Stats bar ──────────────────────────────────────────────── */
.blv-sp-stats {
    display: flex;
    gap: 0;
    background: #2563eb;
    color: #fff;
}

.blv-sp-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 10px;
    border-right: 1px solid rgba(255,255,255,.15);
}
.blv-sp-stat:last-child { border-right: none; }

.blv-sp-stat-num {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
}

.blv-sp-stat-lbl {
    font-size: .72rem;
    opacity: .85;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 3px;
    text-align: center;
}

/* ── Body / Tabs ─────────────────────────────────────────────── */
.blv-sp-body {
    padding: 0 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.blv-sp-tabs {
    margin-top: 20px;
    margin-bottom: 0;
    border-bottom: 2px solid #e5e7eb;
}

.blv-sp-tab-pane { display: none; padding-top: 20px; }
.blv-sp-tab-pane.active { display: block; }

/* ── Toolbar ─────────────────────────────────────────────────── */
.blv-sp-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* ── Exam Grid ──────────────────────────────────────────────── */
.blv-sp-exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
    gap: 16px;
}

.blv-sp-exam-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    transition: box-shadow .18s;
    position: relative;
}
.blv-sp-exam-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.10); }
.blv-sp-exam-card.draft-card { border-left: 4px solid #d97706; }
.blv-sp-exam-card.published-card { border-left: 4px solid #16a34a; }
.blv-sp-exam-card.archived-card { border-left: 4px solid #9ca3af; opacity:.7; }

.blv-sp-exam-subject {
    font-size: .72rem;
    font-weight: 700;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 4px;
    display: block;
}

.blv-sp-exam-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1f2937;
}

.blv-sp-exam-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .76rem;
    color: #6b7280;
    margin-bottom: 14px;
}

.blv-sp-exam-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Class Grid ─────────────────────────────────────────────── */
.blv-sp-class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
    gap: 16px;
}

.blv-class-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    transition: box-shadow .18s;
}
.blv-class-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.10); }

.blv-class-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.blv-class-badge {
    background: #eff6ff;
    color: #2563eb;
    font-size: .8rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: .04em;
}

.blv-class-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
}

.blv-class-teacher {
    font-size: .8rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.blv-class-meta {
    font-size: .76rem;
    color: #9ca3af;
    margin-bottom: 14px;
}

.blv-class-card-footer {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Questions Table ─────────────────────────────────────────── */
.blv-sp-q-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.blv-sp-q-table th {
    background: #f9fafb;
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid #e5e7eb;
}

.blv-sp-q-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.blv-sp-q-table tr:last-child td { border-bottom: none; }
.blv-sp-q-table tr:hover td { background: #f9fafb; }

/* ── Results Table ───────────────────────────────────────────── */
.blv-sp-results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px,1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.blv-sp-result-stat {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.blv-sp-result-stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: #2563eb;
    display: block;
    line-height: 1;
    margin-bottom: 4px;
}

.blv-sp-result-stat-lbl {
    font-size: .74rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Portal login card accent ────────────────────────────────── */
.blv-portal-card { border-top: 4px solid #2563eb; }

.blv-portal-badge {
    display: inline-block;
    background: #eff6ff;
    color: #2563eb;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
}

.blv-portal-badge-sm {
    display: inline-block;
    background: rgba(37,99,235,.12);
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

/* ── Admin class grid ────────────────────────────────────────── */
.blv-class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
    gap: 16px;
    margin-top: 16px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .blv-sp-stats   { flex-wrap: wrap; }
    .blv-sp-stat    { min-width: 45%; border-right: none; border-bottom: 1px solid rgba(255,255,255,.15); }
    .blv-sp-body    { padding: 0 12px 32px; }
    .blv-sp-exam-grid, .blv-sp-class-grid { grid-template-columns: 1fr; }
    .blv-sp-toolbar { flex-direction: column; align-items: stretch; }
    .blv-sp-results-summary { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 480px) {
    .blv-sp-header  { padding: 10px 12px; }
    .blv-sp-stat-num { font-size: 1.3rem; }
    .blv-class-grid  { grid-template-columns: 1fr; }
}

/* Exam type tag on exam cards */
.blv-sp-exam-type { display:inline-block; margin-left:6px; padding:2px 9px; border-radius:999px; font-size:.68rem; font-weight:700; letter-spacing:.03em; }
.blv-sp-exam-type.terminal { background:#e0e7ff; color:#3730a3; }
.blv-sp-exam-type.ca       { background:#fef3c7; color:#92400e; }
.blv-sp-exam-type.termly   { background:#dcfce7; color:#166534; }


/* ── v2.5.6: instant tap response + staff modal alerts ───────── */
.blv2-btn, .blv2-q-btn, .blv2-option, .blv2-tf-btn { touch-action: manipulation; }
.blv-modal { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; overflow-y: auto; }
.blv-sp-modal-alert { margin-bottom: 14px; }

/* ── Legacy-browser layout fallbacks (auto-generated) ───────── */
@supports not (display: grid) {
.blv-sp-exam-grid { display: flex; flex-wrap: wrap; }
.blv-sp-exam-grid > * { box-sizing: border-box; width: calc(50.000% - 8px); margin: 0 4px 8px; }
.blv-sp-class-grid { display: flex; flex-wrap: wrap; }
.blv-sp-class-grid > * { box-sizing: border-box; width: calc(50.000% - 8px); margin: 0 4px 8px; }
.blv-sp-results-summary { display: flex; flex-wrap: wrap; }
.blv-sp-results-summary > * { box-sizing: border-box; width: calc(50.000% - 8px); margin: 0 4px 8px; }
.blv-class-grid { display: flex; flex-wrap: wrap; }
.blv-class-grid > * { box-sizing: border-box; width: calc(50.000% - 8px); margin: 0 4px 8px; }
}
@supports not (inset: 0) {
.blv-sp-header > * { margin-right: 16px; margin-bottom: 16px; }
.blv-sp-header .blv-student-info > * { margin-bottom: 3px; }
.blv-sp-header .blv-student-meta > * { margin-right: 6px; margin-bottom: 6px; }
.blv-sp-header-actions > * { margin-right: 8px; }
.blv-sp-toolbar > * { margin-right: 10px; margin-bottom: 10px; }
.blv-sp-exam-meta > * { margin-right: 10px; margin-bottom: 10px; }
.blv-sp-exam-actions > * { margin-right: 6px; margin-bottom: 6px; }
.blv-class-card-footer > * { margin-right: 6px; margin-bottom: 6px; }
}

/* Exam card: where it is assigned (v2.9.4) */
.blv-sp-exam-assigned { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 6px; margin: 2px 0 12px; font-size: 12px; line-height: 1.4; }
.blv-sp-assigned-label { font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; font-size: 10.5px; margin-right: 2px; }
.blv-sp-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #e0e7ff; color: #3730a3; font-weight: 600; white-space: nowrap; }
.blv-sp-chip-more { background: #f3f4f6; color: #4b5563; cursor: help; }
.blv-sp-chip-rule { background: #fef3c7; color: #92400e; }
.blv-sp-chip-stu  { background: #d1fae5; color: #065f46; }
.blv-sp-assigned-none { color: #b45309; font-weight: 600; }
.blv-sp-exam-assigned.none .blv-sp-assigned-none::before { content: "\26A0\FE0F "; }

/* v2.13.1: modal action buttons (Save Exam / Save as New Exam / Cancel) wrap and stay visible on phones */
.blv-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 600px) {
    .blv-modal-actions .blv-btn { flex: 1 1 100%; justify-content: center; text-align: center; }
}
