/* ================================================================
   QUIZMASTER — Black & White with Color Accents
   Elegant, modern, well-animated UI
   ================================================================ */

/* ---- CSS Variables (Dark Mode Default) ---- */
:root {
  --bg:              #09090f;
  --bg-card:         #101018;
  --bg-card-hover:   #141422;
  --bg-input:        #1a1a28;
  --bg-overlay:      rgba(9,9,15,0.85);
  --border:          #1e1e30;
  --border-hover:    #2e2e48;
  --border-focus:    rgba(99,102,241,0.6);
  --text:            #f0f0f8;
  --text-muted:      #6b6b8a;
  --text-dim:        #3d3d5c;
  --accent:          #6366f1;
  --accent-hover:    #818cf8;
  --accent-glow:     rgba(99,102,241,0.14);
  --accent-glow-lg:  rgba(99,102,241,0.28);
  --success:         #22c55e;
  --success-bg:      rgba(34,197,94,0.10);
  --success-border:  rgba(34,197,94,0.25);
  --warning:         #f59e0b;
  --warning-bg:      rgba(245,158,11,0.10);
  --warning-border:  rgba(245,158,11,0.25);
  --danger:          #ef4444;
  --danger-bg:       rgba(239,68,68,0.10);
  --danger-border:   rgba(239,68,68,0.25);
  --info:            #3b82f6;
  --info-bg:         rgba(59,130,246,0.10);
  --info-border:     rgba(59,130,246,0.25);
  --radius:          12px;
  --radius-sm:       8px;
  --radius-lg:       18px;
  --radius-xl:       24px;
  --shadow:          0 4px 32px rgba(0,0,0,0.5);
  --shadow-sm:       0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg:       0 12px 60px rgba(0,0,0,0.6);
  --t:               0.25s cubic-bezier(0.4,0,0.2,1);
  --t-fast:          0.12s cubic-bezier(0.4,0,0.2,1);
  --t-bounce:        0.5s cubic-bezier(0.34,1.56,0.64,1);
}

/* ---- Light Mode ---- */
html.light {
  --bg:              #f4f5fa;
  --bg-card:         #ffffff;
  --bg-card-hover:   #f0f1f9;
  --bg-input:        #eaebf5;
  --bg-overlay:      rgba(244,245,250,0.9);
  --border:          #e0e1f0;
  --border-hover:    #c8cae0;
  --border-focus:    rgba(99,102,241,0.5);
  --text:            #0a0a14;
  --text-muted:      #555570;
  --text-dim:        #9090b0;
  --shadow:          0 4px 24px rgba(0,0,0,0.10);
  --shadow-sm:       0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg:       0 12px 48px rgba(0,0,0,0.14);
}

/* ---- Reset & Base ---- */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ================================================================
   Page Transition
   ================================================================ */
.page-transition {
  animation: pageFadeIn 0.45s ease-out;
}

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

/* ================================================================
   Cards
   ================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), box-shadow var(--t);
}

.card:hover { border-color: var(--border-hover); }

.card-glow:hover {
  box-shadow: 0 0 0 1px var(--accent), 0 8px 32px var(--accent-glow);
  border-color: var(--accent);
}

/* ================================================================
   Buttons
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--t);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.btn:hover::after { opacity: 0.06; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 14px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 24px var(--accent-glow-lg);
  color: #fff;
}
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #dc2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-info    { background: var(--info);    color: #fff; }
.btn-info:hover    { background: #2563eb; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--bg-card);
}

.btn-sm  { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg  { padding: 13px 30px; font-size: 0.95rem; }
.btn-xl  { padding: 16px 40px; font-size: 1.05rem; font-weight: 600; }
.btn-icon{ padding: 8px; border-radius: var(--radius-sm); }

/* ================================================================
   Inputs
   ================================================================ */
.input-field, .textarea-field, select.input-field {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--t);
  outline: none;
  appearance: none;
}
.input-field::placeholder, .textarea-field::placeholder { color: var(--text-dim); }
.input-field:focus, .textarea-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea-field {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.input-group { margin-bottom: 18px; }
.input-group:last-child { margin-bottom: 0; }

select.input-field { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b6b8a' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; }

/* ================================================================
   Admin Nav
   ================================================================ */
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 200;
  transition: background var(--t);
}

.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.brand-name { letter-spacing: -0.02em; }
.brand-name span { color: var(--accent); }

.admin-nav-center {
  display: flex;
  align-items: center;
  gap: 2px;
}

.admin-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 6px 14px;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--t);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active { color: var(--accent-hover); background: var(--accent-glow); }

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--t);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-hover); background: var(--bg-card); }

/* ================================================================
   Admin Layout
   ================================================================ */
.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 14px;
}

.admin-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ================================================================
   Stat Grid
   ================================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: var(--t), transform var(--t);
}
.stat-card:hover { transform: translateY(-2px); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.accent::before  { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }
.stat-card.info::before    { background: var(--info); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  transition: color 0.3s;
}
.stat-value.stat-flash { animation: flashPulse 0.5s ease-out; }

@keyframes flashPulse {
  0%   { color: var(--accent-hover); }
  100% { color: inherit; }
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ================================================================
   Quiz Control
   ================================================================ */
.quiz-control {
  padding: 32px;
  margin-bottom: 28px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.quiz-control::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.quiz-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.quiz-status.active  { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.quiz-status.inactive{ background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border); }

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  animation: blink 1.4s ease-in-out infinite;
}
.quiz-status.active  .pulse-dot { background: var(--success); }
.quiz-status.inactive .pulse-dot{ background: var(--danger); }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.25} }

.toggle-btn {
  padding: 15px 52px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: var(--t-bounce);
  letter-spacing: 0.01em;
}
.toggle-btn.start {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 24px rgba(34,197,94,0.30);
}
.toggle-btn.start:hover { transform: translateY(-3px); box-shadow: 0 8px 36px rgba(34,197,94,0.45); }
.toggle-btn.stop {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 24px rgba(239,68,68,0.30);
}
.toggle-btn.stop:hover  { transform: translateY(-3px); box-shadow: 0 8px 36px rgba(239,68,68,0.45); }

/* ================================================================
   Student Grid
   ================================================================ */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.student-status-card {
  padding: 16px 12px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: var(--t), transform var(--t);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.student-status-card:hover { transform: translateY(-3px); border-color: var(--border-hover); box-shadow: var(--shadow-sm); }

.student-avatar {
  width: 42px; height: 42px;
  background: var(--bg-input);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 9px;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: var(--t);
  border: 2px solid transparent;
}
.student-status-card.online   .student-avatar { background: var(--info-bg);    color: var(--info);    border-color: var(--info); }
.student-status-card.submitted .student-avatar { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.student-status-card.flagged   .student-avatar { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }

.student-name {
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-waiting   { background: var(--bg-input); color: var(--text-muted); }
.badge-active    { background: var(--info-bg);    color: var(--info); }
.badge-submitted { background: var(--success-bg); color: var(--success); }
.badge-flagged   { background: var(--warning-bg); color: var(--warning); }

.student-progress {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
  min-height: 1em;
}

/* ================================================================
   Activity Feed
   ================================================================ */
.activity-section { margin-top: 28px; }

.activity-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.activity-section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.live-badge .pulse-dot { background: var(--danger); width: 6px; height: 6px; }

.activity-timeline {
  max-height: 480px;
  overflow-y: auto;
  padding: 4px;
}
.activity-timeline::-webkit-scrollbar { width: 4px; }
.activity-timeline::-webkit-scrollbar-track { background: transparent; }
.activity-timeline::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: background var(--t-fast);
}
.activity-item:hover { background: var(--bg-card-hover); }

.activity-item-new {
  animation: activityIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes activityIn {
  from { opacity:0; transform:translateY(-8px) scale(0.98); }
  to   { opacity:1; transform:translateY(0)   scale(1); }
}

.activity-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-dot.login            { background: var(--info); }
.activity-dot.quiz_started     { background: var(--accent); }
.activity-dot.quiz_submitted   { background: var(--success); }
.activity-dot.tab_hidden       { background: var(--warning); }
.activity-dot.copy_attempt     { background: var(--danger); }
.activity-dot.paste_attempt    { background: var(--danger); }
.activity-dot.right_click      { background: var(--warning); }
.activity-dot.fullscreen_exit  { background: var(--warning); }
.activity-dot.key_combo_blocked{ background: var(--danger); }

.activity-content  { flex:1; min-width:0; }
.activity-text     { font-size: 0.84rem; font-weight: 500; line-height: 1.4; }
.activity-time     { font-size: 0.73rem; color: var(--text-dim); margin-top: 1px; }
.activity-username { color: var(--accent-hover); font-weight: 700; }
.activity-username:hover { text-decoration: underline; }
.activity-flagged  { color: var(--warning); font-weight: 600; }
.activity-empty    { text-align:center; color:var(--text-muted); padding:40px; font-size:0.9rem; }

/* ================================================================
   Results Table
   ================================================================ */
.results-table {
  width: 100%;
  border-collapse: collapse;
}
.results-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.results-table td {
  padding: 13px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tbody tr:hover td { background: var(--bg-card-hover); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
}
.rank-1     { background: linear-gradient(135deg,#fbbf24,#f59e0b); color:#78350f; }
.rank-2     { background: linear-gradient(135deg,#d1d5db,#9ca3af); color:#1f2937; }
.rank-3     { background: linear-gradient(135deg,#d97706,#b45309); color:#fffbeb; }
.rank-other { background: var(--bg-input); color: var(--text-muted); }

.progress-bar-mini {
  height: 5px; background: var(--bg-input);
  border-radius:100px; overflow:hidden;
  width:90px; display:inline-block;
  vertical-align:middle; margin-right:8px;
}
.progress-bar-fill {
  height:100%; border-radius:100px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.fill-high { background: var(--success); }
.fill-mid  { background: var(--warning); }
.fill-low  { background: var(--danger); }

/* ================================================================
   Manage Tables (Students / Questions)
   ================================================================ */
.manage-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.manage-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.manage-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: var(--bg-card-hover);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.manage-table td {
  padding: 12px 18px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.manage-table tr:last-child td { border-bottom: none; }
.manage-table tbody tr { transition: background var(--t-fast); }
.manage-table tbody tr:hover td { background: var(--bg-card-hover); }

.table-actions { display:flex; gap:6px; align-items:center; }

.correct-badge {
  display:inline-flex; align-items:center; justify-content:center;
  width:22px; height:22px;
  background: var(--success-bg);
  color: var(--success);
  border-radius:5px;
  font-size:0.78rem;
  font-weight:700;
  border:1px solid var(--success-border);
}

/* ================================================================
   Modal
   ================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9,9,15,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
}
html.light .modal-overlay { background: rgba(200,200,220,0.6); }

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(16px);
  transition: transform var(--t-bounce);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-lg { max-width: 700px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display:flex; align-items:center; justify-content:center;
  transition: var(--t);
  font-size: 1.1rem;
}
.modal-close:hover { color:var(--text); border-color:var(--border-hover); background:var(--bg-input); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ================================================================
   Quiz Start Popup (Student Waiting)
   ================================================================ */
.quiz-start-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9,9,15,0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.quiz-start-overlay.open { opacity:1; visibility:visible; }

.quiz-start-card {
  background: var(--bg-card);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 0 60px rgba(34,197,94,0.2), var(--shadow-lg);
  transform: scale(0.85) translateY(20px);
  transition: transform var(--t-bounce) 0.1s;
}
.quiz-start-overlay.open .quiz-start-card {
  transform: scale(1) translateY(0);
}

.quiz-start-icon {
  width: 80px; height: 80px;
  background: var(--success-bg);
  border: 2px solid var(--success-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 2.2rem;
  animation: pulseGreen 1.5s ease-in-out infinite;
}
@keyframes pulseGreen {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50%      { box-shadow: 0 0 0 14px rgba(34,197,94,0); }
}

.quiz-start-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.quiz-start-sub   { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 28px; }
.quiz-countdown   { font-size: 3rem; font-weight: 800; color: var(--success); letter-spacing: -0.04em; }

/* ================================================================
   Anti-Cheat Warning Banner (Quiz Page)
   ================================================================ */
.anticheat-overlay {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.anticheat-banner {
  background: linear-gradient(135deg, #3b0000, #7f1d1d);
  border: 1px solid rgba(239,68,68,0.5);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 0;
  max-width: 680px;
  width: 92%;
  box-shadow: 0 8px 48px rgba(239,68,68,0.35), 0 0 0 1px rgba(239,68,68,0.15);
  overflow: hidden;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}

.anticheat-overlay.visible .anticheat-banner {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.anticheat-inner {
  padding: 20px 28px;
}

.anticheat-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.anticheat-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  animation: warningShake 0.5s ease-in-out;
}
@keyframes warningShake {
  0%,100% { transform: rotate(0); }
  20%      { transform: rotate(-10deg); }
  40%      { transform: rotate(10deg); }
  60%      { transform: rotate(-6deg); }
  80%      { transform: rotate(6deg); }
}

.anticheat-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fca5a5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.anticheat-body {
  font-size: 0.88rem;
  color: #fecaca;
  line-height: 1.6;
  padding-left: 38px;
}

.anticheat-dismiss {
  display: block;
  margin-top: 14px;
  margin-left: 38px;
  background: rgba(239,68,68,0.25);
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  padding: 5px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--t);
  font-family: inherit;
}
.anticheat-dismiss:hover { background: rgba(239,68,68,0.4); }

.anticheat-progress {
  height: 3px;
  background: rgba(239,68,68,0.2);
  border-radius: 0;
}
.anticheat-progress-bar {
  height: 100%;
  background: rgba(239,68,68,0.6);
  border-radius: 0;
  transition: width linear;
}

/* ================================================================
   Login Page
   ================================================================ */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%,
    rgba(99,102,241,0.08) 0%, transparent 65%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 44px 40px;
  animation: cardAppear 0.6s var(--t-bounce);
}

@keyframes cardAppear {
  from { opacity:0; transform:translateY(28px) scale(0.95); }
  to   { opacity:1; transform:translateY(0)    scale(1); }
}

.login-logo {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  animation: logoFloat 3.5s ease-in-out infinite;
  box-shadow: 0 8px 32px var(--accent-glow-lg);
}
@keyframes logoFloat {
  0%,100%{ transform:translateY(0); }
  50%    { transform:translateY(-7px); }
}

.login-title    { font-size:1.5rem; font-weight:800; text-align:center; letter-spacing:-0.02em; margin-bottom:4px; }
.login-subtitle { text-align:center; color:var(--text-muted); font-size:0.9rem; margin-bottom:32px; }

.login-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  margin-bottom: 20px;
  animation: shakeX 0.5s ease-in-out;
}
@keyframes shakeX {
  0%,100%{ transform:translateX(0); }
  20%    { transform:translateX(-8px); }
  40%    { transform:translateX(8px); }
  60%    { transform:translateX(-4px); }
  80%    { transform:translateX(4px); }
}

/* ================================================================
   Waiting Page
   ================================================================ */
.waiting-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 15%,
    rgba(99,102,241,0.07) 0%, transparent 60%);
}

.waiting-inner {
  width: 100%;
  max-width: 620px;
}

.waiting-card {
  text-align: center;
  padding: 56px 48px;
  margin-bottom: 20px;
}

.waiting-icon {
  width: 90px; height: 90px;
  margin: 0 auto 36px;
  position: relative;
}
.waiting-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: waitPulse 2.2s ease-in-out infinite;
}
.waiting-pulse:nth-child(2){ animation-delay:.6s; }
.waiting-pulse:nth-child(3){ animation-delay:1.2s; }
@keyframes waitPulse {
  0%   { transform:scale(0.7); opacity:1; }
  100% { transform:scale(2.2); opacity:0; }
}
.waiting-dot {
  position: absolute;
  top:50%; left:50%;
  transform: translate(-50%,-50%);
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 24px var(--accent-glow-lg);
}

.waiting-title   { font-size:1.9rem; font-weight:800; letter-spacing:-0.02em; margin-bottom:12px; }
.waiting-text    { color:var(--text-muted); font-size:1rem; line-height:1.7; }

.waiting-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 8px 22px;
  background: var(--accent-glow);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 100px;
  font-size: 0.84rem;
  color: var(--accent-hover);
}
.status-dot {
  width:8px; height:8px;
  background:var(--accent);
  border-radius:50%;
  animation: blink 1.4s ease-in-out infinite;
}

/* Instructions card */
.instructions-card {
  padding: 24px 28px;
  border-left: 3px solid var(--accent);
  text-align: left;
}

.instructions-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-hover);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.8;
  white-space: pre-line;
}

/* ================================================================
   Quiz Interface
   ================================================================ */
.quiz-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  margin-bottom: 24px;
}

.quiz-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-title-text { font-size:1.05rem; font-weight:700; letter-spacing:-0.01em; }
.quiz-meta       { font-size:0.78rem; color:var(--text-muted); }

.timer {
  font-size: 1.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.timer.warning {
  color: var(--danger);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  0%,100%{ opacity:1; transform:scale(1); }
  50%    { opacity:0.6; transform:scale(1.05); }
}
.timer-label { font-size:0.72rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.07em; text-align:right; }

.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 22px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
@media(max-width:900px){
  .quiz-layout{ grid-template-columns:1fr; }
  .quiz-sidebar{
    position:fixed; bottom:0; left:0; right:0; z-index:50;
    border-radius:var(--radius-lg) var(--radius-lg) 0 0;
    max-height:50vh; overflow-y:auto;
  }
}

.question-card {
  padding: 26px;
  margin-bottom: 18px;
  scroll-margin-top: 90px;
  animation: questionIn 0.35s ease-out both;
}
.question-card:nth-child(1){ animation-delay:.04s; }
.question-card:nth-child(2){ animation-delay:.08s; }
.question-card:nth-child(3){ animation-delay:.12s; }
.question-card:nth-child(4){ animation-delay:.16s; }
.question-card:nth-child(5){ animation-delay:.20s; }
@keyframes questionIn {
  from{ opacity:0; transform:translateY(14px); }
  to  { opacity:1; transform:translateY(0); }
}

.question-number {
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:30px;
  background: var(--accent);
  color:#fff;
  border-radius:7px;
  font-size:0.82rem; font-weight:700;
  flex-shrink:0;
}

.question-text { font-size:1rem; font-weight:500; line-height:1.65; margin-bottom:20px; }
.question-marks{ font-size:0.74rem; color:var(--text-dim); margin-top:12px; text-align:right; }

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
@media(max-width:600px){ .options-grid{ grid-template-columns:1fr; } }

.option-input { display:none; }

.option-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--t);
  font-size: 0.88rem;
  user-select: none;
}
.option-label:hover {
  border-color: var(--accent);
  background: rgba(99,102,241,0.06);
  transform: translateY(-1px);
}
.option-key {
  display:flex; align-items:center; justify-content:center;
  width:26px; height:26px;
  border-radius:6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size:0.78rem; font-weight:700;
  flex-shrink:0;
  transition: var(--t);
}
.option-input:checked + .option-label {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 1px var(--accent);
}
.option-input:checked + .option-label .option-key {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Sidebar */
.quiz-sidebar { position:sticky; top:80px; align-self:start; }

.palette-grid {
  display:grid;
  grid-template-columns: repeat(6,1fr);
  gap:5px;
  margin-bottom:18px;
}
.palette-btn {
  width:100%; aspect-ratio:1;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg-input);
  border:1px solid var(--border);
  border-radius:6px;
  color:var(--text-muted);
  font-size:0.76rem; font-weight:600;
  cursor:pointer;
  transition:var(--t);
}
.palette-btn:hover { border-color:var(--accent); color:var(--text); transform:scale(1.08); }
.palette-btn.answered { background:var(--success); border-color:var(--success); color:#fff; }
.palette-btn.current  { box-shadow:0 0 0 2px var(--accent); }

.palette-legend { display:flex; flex-direction:column; gap:7px; font-size:0.78rem; color:var(--text-muted); }
.legend-item    { display:flex; align-items:center; gap:8px; }
.legend-dot     { width:11px; height:11px; border-radius:4px; flex-shrink:0; }
.legend-dot.unanswered { background:var(--bg-input); border:1px solid var(--border); }
.legend-dot.answered   { background:var(--success); }

.answered-count {
  font-size:0.84rem; color:var(--text-muted);
  padding-top:14px; border-top:1px solid var(--border); margin-top:14px;
}
.answered-count strong { color:var(--text); }

/* ================================================================
   Completed Page
   ================================================================ */
.completed-container {
  min-height:100vh; display:flex;
  align-items:center; justify-content:center; padding:20px;
}
.completed-card {
  text-align:center; max-width:480px;
  padding:60px 44px;
}
.completed-icon {
  width:80px; height:80px; margin:0 auto 28px;
  background:var(--success-bg); border:2px solid var(--success);
  border-radius:50%; display:flex; align-items:center; justify-content:center;
  animation: completedPop 0.6s var(--t-bounce);
}
@keyframes completedPop {
  from{ transform:scale(0); opacity:0; }
  to  { transform:scale(1); opacity:1; }
}
.checkmark-svg  { width:40px; height:40px; }
.checkmark-path {
  stroke:var(--success); stroke-width:3; stroke-linecap:round; stroke-linejoin:round;
  fill:none;
  stroke-dasharray:40; stroke-dashoffset:40;
  animation:drawCheck 0.5s ease-out 0.3s forwards;
}
@keyframes drawCheck { to{ stroke-dashoffset:0; } }

.completed-title    { font-size:1.6rem; font-weight:800; letter-spacing:-0.02em; margin-bottom:8px; }
.completed-subtitle { color:var(--text-muted); margin-bottom:32px; font-size:0.95rem; }

.score-display {
  font-size:3.2rem; font-weight:800;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text;
  margin-bottom:8px;
  animation: scoreReveal 0.8s ease-out 0.5s both;
}
@keyframes scoreReveal {
  from{ opacity:0; transform:scale(0.5); }
  to  { opacity:1; transform:scale(1); }
}
.score-bar-track { height:8px; background:var(--bg-input); border-radius:100px; overflow:hidden; margin:16px auto; max-width:280px; }
.score-bar-fill  { height:100%; border-radius:100px; background:linear-gradient(90deg,var(--accent),#a78bfa); transition:width 1s cubic-bezier(0.4,0,0.2,1) 0.6s; }

/* ================================================================
   Email Page
   ================================================================ */
.email-student-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.email-student-row:last-child { border-bottom: none; }
.email-student-row:hover { background: var(--bg-card-hover); }

.email-avatar {
  width:38px; height:38px;
  border-radius:50%; background:var(--bg-input);
  display:flex; align-items:center; justify-content:center;
  font-size:0.8rem; font-weight:700; color:var(--text-muted);
  flex-shrink:0;
}
.email-info { flex:1; min-width:0; }
.email-name { font-size:0.9rem; font-weight:600; }
.email-addr { font-size:0.78rem; color:var(--text-muted); }

/* ================================================================
   Settings Page
   ================================================================ */
.settings-section {
  padding: 28px;
  margin-bottom: 20px;
}
.settings-section-title {
  font-size:0.75rem; font-weight:700;
  text-transform:uppercase; letter-spacing:0.08em;
  color:var(--text-muted);
  margin-bottom:20px;
  padding-bottom:10px;
  border-bottom:1px solid var(--border);
}

/* ================================================================
   Student Activity Detail
   ================================================================ */
.student-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.student-detail-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg-input);
  display:flex; align-items:center; justify-content:center;
  font-size:1.3rem; font-weight:800; color:var(--text-muted);
  border: 2px solid var(--border);
  flex-shrink:0;
}
.student-detail-name { font-size:1.3rem; font-weight:700; letter-spacing:-0.01em; }
.student-detail-meta { font-size:0.84rem; color:var(--text-muted); margin-top:3px; }

.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content:'';
  position:absolute; left:7px; top:0; bottom:0;
  width:2px;
  background:var(--border);
  border-radius:2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  animation: timelineIn 0.35s ease-out both;
}
@keyframes timelineIn {
  from{ opacity:0; transform:translateX(-8px); }
  to  { opacity:1; transform:translateX(0); }
}

.timeline-dot {
  position:absolute;
  left:-28px; top:6px;
  width:14px; height:14px;
  border-radius:50%;
  border:2px solid var(--bg-card);
  flex-shrink:0;
}

.timeline-card {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: var(--t-fast);
}
.timeline-card:hover { border-color:var(--border-hover); }

.timeline-type {
  font-size:0.82rem; font-weight:700;
  margin-bottom:3px;
  display:flex; align-items:center; gap:7px;
}
.timeline-time { font-size:0.75rem; color:var(--text-dim); }

/* Event type colors for timeline */
.tl-login           { background:var(--info); }
.tl-quiz_started    { background:var(--accent); }
.tl-quiz_submitted  { background:var(--success); }
.tl-tab_hidden      { background:var(--warning); }
.tl-copy_attempt    { background:var(--danger); }
.tl-paste_attempt   { background:var(--danger); }
.tl-right_click     { background:var(--warning); }
.tl-fullscreen_exit { background:var(--warning); }
.tl-key_combo_blocked{ background:var(--danger); }

/* ================================================================
   Toast (mini subtle corner notification)
   ================================================================ */
#toast-container {
  position:fixed; bottom:24px; right:24px;
  z-index:8000;
  display:flex; flex-direction:column-reverse; gap:8px;
  pointer-events:none;
}
.toast {
  padding:10px 18px;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  box-shadow:var(--shadow);
  font-size:0.78rem;
  color:var(--text-muted);
  max-width:280px;
  display:flex; align-items:center; gap:9px;
  animation:toastIn 0.4s var(--t-bounce);
  pointer-events:auto;
}
.toast.leaving { animation:toastOut 0.25s ease-in forwards; }
@keyframes toastIn  { from{opacity:0;transform:translateX(30px) scale(0.9)} to{opacity:1;transform:translateX(0) scale(1)} }
@keyframes toastOut { to  {opacity:0;transform:translateX(30px) scale(0.9)} }
.toast-icon { width:7px;height:7px;border-radius:50%;background:var(--warning);flex-shrink:0; }

/* ================================================================
   Utility
   ================================================================ */
.text-muted   { color:var(--text-muted); }
.text-accent  { color:var(--accent-hover); }
.text-success { color:var(--success); }
.text-warning { color:var(--warning); }
.text-danger  { color:var(--danger); }
.text-info    { color:var(--info); }
.text-center  { text-align:center; }
.text-right   { text-align:right; }

.mt-1{ margin-top:8px; }  .mt-2{ margin-top:16px; }  .mt-3{ margin-top:24px; }
.mb-1{ margin-bottom:8px; }.mb-2{ margin-bottom:16px; }.mb-3{ margin-bottom:24px; }

.flex        { display:flex; }
.flex-center { display:flex; align-items:center; justify-content:center; }
.flex-between{ display:flex; align-items:center; justify-content:space-between; }
.gap-1       { gap:8px; }
.gap-2       { gap:16px; }
.hidden      { display:none !important; }

.divider { height:1px; background:var(--border); margin:20px 0; }

.badge {
  display:inline-flex; align-items:center;
  padding:3px 10px; border-radius:100px;
  font-size:0.72rem; font-weight:700;
  letter-spacing:0.03em; text-transform:uppercase;
}

/* Alert / info box */
.alert {
  padding:14px 18px;
  border-radius:var(--radius-sm);
  font-size:0.88rem;
  border: 1px solid;
}
.alert-info    { background:var(--info-bg);    border-color:var(--info-border);    color:var(--info); }
.alert-warning { background:var(--warning-bg); border-color:var(--warning-border); color:var(--warning); }
.alert-success { background:var(--success-bg); border-color:var(--success-border); color:var(--success); }
.alert-danger  { background:var(--danger-bg);  border-color:var(--danger-border);  color:var(--danger); }

/* Stagger animation helper */
.stagger > * { animation:pageFadeIn 0.4s ease-out both; }
.stagger > *:nth-child(1){ animation-delay:.04s; }
.stagger > *:nth-child(2){ animation-delay:.08s; }
.stagger > *:nth-child(3){ animation-delay:.12s; }
.stagger > *:nth-child(4){ animation-delay:.16s; }
.stagger > *:nth-child(5){ animation-delay:.20s; }
.stagger > *:nth-child(6){ animation-delay:.24s; }

/* Scrollbar */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:100px; }
::-webkit-scrollbar-thumb:hover { background:var(--border-hover); }
