/* ================================================================
   KPDI Campus — Exam Teacher View Styles
   Dark glassmorphism design with blue/violet accent palette
   ================================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #06070f;
    --bg2: #0d0f1e;
    --surface: rgba(255,255,255,0.04);
    --surface2: rgba(255,255,255,0.06);
    --surface-hover: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.16);
    --border-focus: rgba(59,130,246,0.5);

    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --text-muted: #64748b;

    --blue: #3b82f6;
    --blue-light: #60a5fa;
    --blue-glow: rgba(59,130,246,0.25);
    --violet: #8b5cf6;
    --green: #10b981;
    --green-glow: rgba(16,185,129,0.2);
    --amber: #f59e0b;
    --red: #ef4444;
    --red-glow: rgba(239,68,68,0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse 60% 40% at 10% -5%, rgba(59,130,246,0.1) 0%, transparent 60%),
        radial-gradient(ellipse 40% 30% at 90% 100%, rgba(139,92,246,0.08) 0%, transparent 60%),
        var(--bg);
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; height: 64px;
    background: rgba(6,7,15,0.8);
    backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--text);
}

.logo-mark {
    width: 36px; height: 36px; border-radius: 9px;
    background: linear-gradient(135deg, var(--blue), var(--violet));
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem; color: white;
    box-shadow: 0 0 16px var(--blue-glow);
    flex-shrink: 0;
}

.logo-text { font-size: 0.9rem; font-weight: 700; letter-spacing: -0.02em; }
.logo-sub { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

.header-nav { display: flex; align-items: center; gap: 12px; }

.header-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 100px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 0.75rem; font-weight: 500; color: var(--text-dim);
}

/* ── Steps Bar ───────────────────────────────────────────────── */
.steps-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 0; padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(13,15,30,0.5);
    overflow-x: auto;
}

.step {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: 100px;
    font-size: 0.8rem; font-weight: 500; color: var(--text-muted);
    white-space: nowrap;
    transition: color var(--transition);
}

.step__num {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700;
    background: var(--surface); border: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.step--active { color: var(--text); }
.step--active .step__num {
    background: var(--blue); border-color: var(--blue);
    color: white; box-shadow: 0 0 12px var(--blue-glow);
}

.step--done { color: var(--green); }
.step--done .step__num {
    background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.4);
    color: var(--green);
}

.step-line {
    width: 32px; height: 1px;
    background: var(--border); flex-shrink: 0;
}

/* ── Main ───────────────────────────────────────────────────── */
.main {
    max-width: 760px; margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ── Panel ──────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    margin-bottom: 20px;
    animation: panelIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel__header { margin-bottom: 28px; }

.panel__title {
    display: flex; align-items: center; gap: 12px;
    font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.panel__title-icon {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.25);
    color: var(--blue-light);
}

.panel__subtitle {
    font-size: 0.875rem; color: var(--text-dim); line-height: 1.6;
    padding-left: 48px;
}

.panel__actions {
    display: flex; justify-content: flex-end;
    gap: 12px; margin-top: 28px;
}

.panel__actions--between { justify-content: space-between; }

/* ── Dropzone ────────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    position: relative;
    margin-bottom: 24px;
}

.dropzone:hover,
.dropzone:focus,
.dropzone--dragover {
    border-color: var(--blue);
    background: rgba(59,130,246,0.04);
    outline: none;
}

.dropzone--has-file {
    border-style: solid;
    border-color: rgba(16,185,129,0.4);
    background: rgba(16,185,129,0.03);
    padding: 20px 24px;
}

.dropzone__icon {
    width: 64px; height: 64px; border-radius: var(--radius-lg);
    background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2);
    display: flex; align-items: center; justify-content: center;
    color: var(--blue); margin: 0 auto 16px;
}

.dropzone__text {
    font-size: 0.95rem; color: var(--text-dim); margin-bottom: 6px;
}

.dropzone__link {
    color: var(--blue); font-weight: 600; text-decoration: underline;
    text-underline-offset: 3px;
}

.dropzone__hint {
    font-size: 0.78rem; color: var(--text-muted);
}

.dropzone__selected { width: 100%; }

.file-preview {
    display: flex; align-items: center; gap: 14px;
    background: rgba(16,185,129,0.06); border: 1px solid rgba(16,185,129,0.2);
    border-radius: var(--radius-md); padding: 14px 18px;
}

.file-preview__icon {
    width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
    background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3);
    display: flex; align-items: center; justify-content: center;
    color: var(--green);
}

.file-preview__info { flex: 1; min-width: 0; text-align: left; }
.file-preview__name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview__size { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.file-preview__remove {
    width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0;
    border: none; background: transparent;
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition), color var(--transition);
}
.file-preview__remove:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* ── Page Range ─────────────────────────────────────────────── */
.page-range {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 8px;
}

.page-range__header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.8rem; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 16px; color: var(--text-muted);
}

.page-range__inputs {
    display: flex; align-items: flex-start; gap: 16px;
}

.page-range__separator {
    color: var(--text-muted); font-size: 1.2rem; font-weight: 300;
    padding-top: 32px; flex-shrink: 0;
}

/* ── Inputs ─────────────────────────────────────────────────── */
.input-group { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.input-label {
    font-size: 0.78rem; font-weight: 600; color: var(--text-dim);
    letter-spacing: 0.03em;
}

.input {
    width: 100%; padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text); font-family: inherit; font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.input::placeholder { color: var(--text-muted); }

.input-hint {
    font-size: 0.72rem; color: var(--text-muted);
}

.textarea {
    width: 100%; padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--text); font-family: inherit; font-size: 0.9rem;
    resize: vertical; min-height: 160px; line-height: 1.7;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.textarea::placeholder { color: var(--text-muted); }

/* ── Progress ───────────────────────────────────────────────── */
.upload-progress { margin-top: 20px; }

.progress-bar {
    width: 100%; height: 6px; border-radius: 100px;
    background: var(--surface2); overflow: hidden; margin-bottom: 10px;
}

.progress-bar__fill {
    height: 100%; border-radius: 100px;
    background: linear-gradient(90deg, var(--blue), var(--violet));
    transition: width 0.3s ease;
    width: 0%;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    font-size: 0.8rem; color: var(--text-dim); text-align: center;
}

/* ── Stats Row ──────────────────────────────────────────────── */
.stats-row {
    display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}

.stat-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--radius-md);
    background: var(--surface2); border: 1px solid var(--border);
}

.stat-chip__val {
    font-size: 1.3rem; font-weight: 800; letter-spacing: -0.03em;
    background: linear-gradient(135deg, #f1f5f9, #94a3b8);
    background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.stat-chip--used .stat-chip__val {
    background: linear-gradient(135deg, var(--red), #fca5a5);
    background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.stat-chip--free .stat-chip__val {
    background: linear-gradient(135deg, var(--green), #6ee7b7);
    background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.stat-chip__lbl {
    font-size: 0.72rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── Tickets Grid ───────────────────────────────────────────── */
.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
    margin-bottom: 28px;
}

.ticket-chip {
    aspect-ratio: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    cursor: pointer; user-select: none;
    transition: background var(--transition), border-color var(--transition),
                transform 150ms, box-shadow var(--transition);
    position: relative;
}

.ticket-chip:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.ticket-chip:active { transform: scale(0.95); }

.ticket-chip__num {
    font-size: 1rem; font-weight: 700; line-height: 1;
    color: var(--text);
}

.ticket-chip__lbl {
    font-size: 0.5rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted); margin-top: 3px;
}

/* Used state */
.ticket-chip--used {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.35);
}

.ticket-chip--used .ticket-chip__num { color: var(--red); }
.ticket-chip--used .ticket-chip__lbl { color: rgba(239,68,68,0.6); }

.ticket-chip--used::after {
    content: '';
    position: absolute; top: 5px; right: 5px;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--red); box-shadow: 0 0 6px var(--red-glow);
}

/* Assigned state */
.ticket-chip--assigned {
    background: rgba(59,130,246,0.08);
    border-color: rgba(59,130,246,0.3);
}

.ticket-chip--assigned .ticket-chip__num { color: var(--blue-light); }

/* ── Names Area ─────────────────────────────────────────────── */
.names-area { margin-bottom: 24px; }

.names-counter {
    font-size: 0.78rem; color: var(--text-muted); margin-top: 8px;
    text-align: right;
}

.names-counter__free { color: var(--green); font-weight: 600; }

/* ── Assignments ─────────────────────────────────────────────── */
.assignments-preview {
    background: rgba(59,130,246,0.04);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.assignments-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

.assignments-header__title {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.875rem; font-weight: 700; color: var(--blue-light);
}

.assignments-list {
    display: flex; flex-direction: column; gap: 8px;
}

.assignment-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    animation: rowIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rowIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.assignment-row__name {
    font-size: 0.875rem; font-weight: 500; color: var(--text);
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.assignment-row__ticket {
    display: flex; align-items: center; gap: 6px;
    flex-shrink: 0; margin-left: 12px;
}

.ticket-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; padding: 4px 10px; border-radius: 6px;
    font-size: 0.8rem; font-weight: 700;
    background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.35);
    color: var(--blue-light);
}

/* ── Late Student ────────────────────────────────────────────── */
.late-student-section {
    background: rgba(245,158,11,0.04);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 16px;
}

.late-student__header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.8rem; font-weight: 600; color: var(--amber);
    margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em;
}

.late-student__form {
    display: flex; gap: 10px;
}

.late-student__form .input { flex: 1; }

/* ── Link Card ──────────────────────────────────────────────── */
.link-card {
    background: rgba(16,185,129,0.04);
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.link-card__status {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.75rem; font-weight: 600; color: var(--green);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.link-card__url {
    font-size: 0.85rem; color: var(--text-dim);
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 16px;
    word-break: break-all; line-height: 1.5;
    font-family: 'Inter', monospace;
    margin-bottom: 16px;
}

.link-card__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Monitor ─────────────────────────────────────────────────── */
.monitor-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.monitor-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

.monitor-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.875rem; font-weight: 700; color: var(--text-dim);
}

.monitor-grid {
    display: flex; flex-direction: column; gap: 6px;
}

.monitor-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-radius: var(--radius-sm);
    background: var(--surface2); border: 1px solid var(--border);
    font-size: 0.82rem;
}

.monitor-row__name { color: var(--text-dim); flex: 1; }
.monitor-row__ticket { color: var(--blue-light); font-weight: 600; margin-right: 12px; }

.monitor-status {
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; padding: 2px 8px; border-radius: 100px;
}

.monitor-status--opened {
    background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3);
    color: var(--green);
}

.monitor-status--waiting {
    background: rgba(100,116,139,0.08); border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    border: none; font-family: inherit; font-size: 0.875rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
    white-space: nowrap; text-decoration: none;
    position: relative; overflow: hidden;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn--sm { padding: 6px 14px; font-size: 0.8rem; }
.btn--lg { padding: 12px 28px; font-size: 0.925rem; }

.btn--primary {
    background: linear-gradient(135deg, var(--blue), var(--violet));
    color: white; box-shadow: 0 4px 16px var(--blue-glow);
}
.btn--primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(59,130,246,0.35);
    transform: translateY(-1px);
}

.btn--secondary {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    color: var(--blue-light);
}
.btn--secondary:hover:not(:disabled) {
    background: rgba(59,130,246,0.18);
    border-color: var(--blue);
}

.btn--ghost {
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-dim);
}
.btn--ghost:hover:not(:disabled) {
    background: var(--surface-hover); border-color: var(--border-hover);
    color: var(--text);
}

.btn--danger-outline {
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--red);
}
.btn--danger-outline:hover:not(:disabled) {
    background: rgba(239,68,68,0.12);
    border-color: var(--red);
}

/* ── Dots ───────────────────────────────────────────────────── */
.dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    animation: dotPulse 2s ease-in-out infinite;
}

.dot--green { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.dot--amber { background: var(--amber); }
.dot--red { background: var(--red); }

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Toast Container ─────────────────────────────────────────── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}

.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border-radius: var(--radius-md);
    background: #1e2030; border: 1px solid var(--border);
    color: var(--text); font-size: 0.85rem; font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    pointer-events: all;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 360px;
}

.toast--out { animation: toastOut 0.25s ease forwards; }

.toast--success { border-color: rgba(16,185,129,0.4); }
.toast--success::before { content: '✓'; color: var(--green); font-weight: 700; }

.toast--error { border-color: rgba(239,68,68,0.4); }
.toast--error::before { content: '✕'; color: var(--red); font-weight: 700; }

.toast--info { border-color: rgba(59,130,246,0.4); }
.toast--info::before { content: 'ℹ'; color: var(--blue); font-weight: 700; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateX(16px); }
}

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header { padding: 0 16px; }
    .main { padding: 24px 16px 60px; }
    .panel { padding: 24px 20px; }
    .page-range__inputs { flex-direction: column; }
    .page-range__separator { display: none; }
    .steps-bar { padding: 12px 16px; gap: 4px; }
    .step__label { display: none; }
    .link-card__actions { flex-direction: column; }
    .late-student__form { flex-direction: column; }
}
