/* =========================================================
   components.css
   Reusable pieces: lists, numbers, popups, notifications,
   messages and status labels.
   No boxes around content: things are separated by
   spacing and thin lines, like notes on a page.
   ========================================================= */

/* ---------- Sections ---------- */
/* .card and .connection-panel used to be boxes; now they are just blocks of content */
.card,
.connection-panel {
    margin-bottom: 25px;
}

/* ---------- Numbers ---------- */
/* summary numbers shown side by side (student dashboard, super admin) */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 45px;
    margin-bottom: 25px;
}

.stat-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 30px;
    color: var(--blue);
}

.stat-label {
    color: var(--muted);
}

/* "label ........ number" rows on the admin dashboard */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 0;
    border-bottom: 1px dotted var(--line-dashed);
}

.stat-number {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
}

/* ---------- Lists ---------- */
/* one item in a list (exams, students, alerts): a bullet and some text */
.list-item,
.exam-card,
.alert-item,
.log-item {
    position: relative;
    padding: 6px 0 6px 16px;
    margin-bottom: 4px;
}

.list-item::before,
.exam-card::before,
.alert-item::before,
.log-item::before {
    content: "\2022"; /* bullet */
    position: absolute;
    left: 2px;
    top: 6px;
    color: var(--blue);
}

/* closed exams and violations get a red bullet */
.list-item.closed::before,
.alert-item::before,
.log-item::before {
    color: var(--red);
}

.alert-item.info::before,
.log-item.info::before {
    color: var(--blue);
}

/* an exam in the student's list: title on the left, button on the right */
.exam-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.exam-info h3 {
    margin-bottom: 2px;
}

.exam-info p {
    color: var(--muted);
    margin: 0;
}

/* thin vertical line between two columns */
.divider-v {
    width: 1px;
    background-color: var(--line);
}

/* ---------- Live alerts and proctoring logs ---------- */
.live-feed {
    max-height: 500px;
    overflow-y: auto;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.alert-type,
.log-type {
    font-weight: bold;
    color: var(--red);
}

.alert-item.info .alert-type,
.log-item.info .log-type {
    color: var(--blue);
}

.alert-time {
    color: var(--muted);
}

/* ---------- Answers shown for review and grading ---------- */
.answer-block {
    padding: 10px 0 12px;
    border-bottom: 1px dashed var(--line-dashed);
}

/* the student's answer, set in from the left like a quote */
.answer-text {
    margin: 4px 0 8px;
    padding-left: 10px;
    border-left: 2px solid var(--line-dashed);
    white-space: pre-wrap;
}

/* row of filters above a table */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 20px;
    margin-bottom: 20px;
}

/* ---------- Status labels ---------- */
/* small words like [GRADED] or [Active] */
.tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag::before { content: "["; }
.tag::after  { content: "]"; }

.status-badge {
    font-size: 12px;
    font-weight: bold;
}

.status-online,
.status-active {
    color: var(--blue);
}

.status-offline,
.status-revoked {
    color: var(--red);
}

/* exam scores */
.score {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
}

.score.good,
.score-high {
    color: var(--blue);
    font-weight: bold;
}

.score.low,
.score-med,
.score-low {
    color: var(--red);
    font-weight: bold;
}

/* ---------- Popups ---------- */
/* popups are the only boxes left, because they sit on top of the page */
.modal,
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(43, 43, 43, 0.35);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow: auto;
}

.modal-content,
.overlay > div {
    background-color: var(--paper);
    border: 1px solid var(--ink);
    padding: 20px 24px;
    width: 90%;
    max-width: 560px;
    margin: auto;
}

/* profile popup opened from the sidebar */
.profile-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(43, 43, 43, 0.35);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.profile-modal-overlay.active {
    display: flex;
}

.profile-modal {
    position: relative;
    background-color: var(--paper);
    border: 1px solid var(--ink);
    padding: 20px 24px;
    width: 380px;
    max-width: 90%;
}

.profile-modal-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--muted);
}

.profile-modal-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ink);
}

.profile-modal-avatar {
    display: none;
}

.profile-modal-header h3 {
    margin-bottom: 0;
}

.profile-modal-header p {
    color: var(--muted);
    margin: 0;
}

.profile-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dotted var(--line-dashed);
}

.profile-detail-row:last-child {
    border-bottom: none;
}

.profile-detail-label {
    color: var(--muted);
}

.profile-detail-value {
    font-weight: bold;
}

/* ---------- Notifications ---------- */
.toast-container {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    background-color: var(--paper);
    border: 1px solid var(--ink);
    padding: 7px 12px;
    min-width: 220px;
    max-width: 320px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toast.error,
.toast.warning {
    border-color: var(--red);
    color: var(--red);
}

.toast-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--muted);
    margin-left: 10px;
}

.toast.fade-out {
    display: none;
}

/* thin loading line at the top of the page (created in api.js) */
#global-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background-color: var(--blue);
    z-index: 9999;
}

/* small red dot next to a menu item when something is new */
.notify-dot,
.msg-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--red);
    margin-left: 6px;
}

/* ---------- Messages ---------- */
/* a conversation reads like a list of notes: name line, then the text */
.msg-bubble {
    align-self: stretch;
    padding: 8px 0 10px 12px;
    border-left: 2px solid var(--line-dashed);
}

.msg-bubble.mine {
    border-left-color: var(--blue);
}
