/* ========== GLOBAL STYLES ========== */
:root {
  --brand: #28a7e1;
  --brand-hover: #1e8bc3;
  --brand-soft: #d6f0fa;
  --surface: #f8fafc;
  --surface-raised: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--surface);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ========== LOGIN PAGE ========== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
}

.login-card {
  background: var(--surface-raised);
  padding: 48px 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 400px;
  text-align: center;
}

.login-card .logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 8px;
}

.login-card .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-card .input-group {
  margin-bottom: 20px;
  text-align: left;
}

.login-card .input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.login-card .input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.2s;
}

.login-card .input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.2s;
  -webkit-text-security: none;
}

.login-card .input-group input[autocomplete="off"] {
  background: white;
}

input[type="date"],
input[type="time"] {
  min-height: 40px;
  font-size: 18px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  box-sizing: border-box;
  line-height: 1.2;
}

/* Enlarge the native calendar picker icon */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  width: 28px;
  height: 28px;
  cursor: pointer;
  padding: 4px;
  margin-right: 4px;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.login-btn .countdown {
  font-size: 13px;
  opacity: 0.9;
  margin-left: 4px;
}

/* Security badge */
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-top: 12px;
}

.security-badge.locked {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* Login security log */
.login-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.login-log-table th {
  background: var(--brand);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

.login-log-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.login-log-table tr:hover td { background: var(--surface); }

.login-log-table .log-success { color: var(--success); font-weight: 600; }
.login-log-table .log-failed { color: var(--danger); font-weight: 600; }
.login-log-table .log-warning { color: var(--warning); font-weight: 600; }

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-btn:hover { background: var(--brand); }
.login-btn:active { transform: scale(0.98); }

/* ========== APP LAYOUT ========== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top Bar */
.top-bar {
  height: 64px;
  background: white;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--brand);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.top-bar .logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.top-bar .logo-area .logo-icon {
  width: 32px;
  height: 32px;
  background: white;
  color: var(--brand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
}

.top-bar .nav-tabs {
  display: flex;
  gap: 4px;
}

.nav-tab {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  color: var(--text-muted);
  border: none;
  background: transparent;
}

.nav-tab:hover { background: var(--brand-soft); color: var(--brand); }
.nav-tab.active { background: var(--brand); color: white; font-weight: 600; }

.top-bar .logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.top-bar .user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
}

.user-area .logout-btn {
  background: var(--brand-soft);
  border: none;
  color: var(--brand);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.user-area .logout-btn:hover { background: var(--brand); color: white; }

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 16px;
  gap: 16px;
}

/* Left Panel: Question Selector (48%) */
.left-panel {
  width: 48%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-card {
  background: var(--surface-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 14px 18px;
  background: linear-gradient(90deg, var(--brand), var(--brand));
  color: white;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-body {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
}

/* Part Tabs */
.part-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.part-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  color: var(--text);
}

.part-tab:hover { border-color: var(--brand); color: var(--brand); }
.part-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.part-tab .part-label { font-size: 12px; opacity: 0.8; }

/* Question List */
.question-list { display: flex; flex-direction: column; gap: 8px; }

.question-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.question-item:hover { border-color: var(--brand); background: var(--surface); }
.question-item.active {
  border-color: var(--brand);
  background: linear-gradient(90deg, var(--brand-soft), var(--surface));
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.question-item .q-num {
  width: 24px;
  height: 24px;
  background: var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.question-item.active .q-num { background: var(--brand); color: white; }

.question-item .q-text { font-size: 14px; line-height: 1.5; flex: 1; }
.question-item .q-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Question Detail Area */
.question-detail {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--brand);
}

.question-detail .detail-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand);
  margin-bottom: 10px;
}

.question-detail .detail-text { font-size: 14px; line-height: 1.7; margin-bottom: 12px; }

.question-detail .hints-box {
  background: white;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.question-detail .hints-box .hints-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.question-detail .hints-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.question-detail .hints-box ul li {
  font-size: 13px;
  padding: 4px 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.question-detail .hints-box ul li::before {
  content: "•";
  color: var(--brand);
  font-weight: 700;
}

/* Right Panels Container (52%) */
.right-panels {
  width: 52%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.right-top-row {
  display: flex;
  gap: 16px;
  height: 75%;
}

.right-bottom-row {
  display: flex;
  gap: 16px;
  height: 25%;
}

/* Timer Panel */
.timer-panel {
  width: 58%;
  display: flex;
  flex-direction: column;
}

.timer-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.timer-box {
  width: 220px;
  height: 100px;
  border-radius: var(--radius);
  border: 4px solid var(--border);
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.3s, background-color 0.3s;
  box-shadow: var(--shadow-sm);
}

.timer-box.running { border-color: var(--brand); }
.timer-box.warning { border-color: var(--warning); animation: pulse-box 1s infinite; }
.timer-box.danger { border-color: var(--danger); background: #fef2f2; animation: pulse-box 0.5s infinite; }

@keyframes pulse-box {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.timer-value {
  font-size: 56px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  line-height: 1;
  letter-spacing: 2px;
}

.timer-value.warning { color: var(--warning); }
.timer-value.danger { color: var(--danger); }

.timer-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.timer-type-badge {
  margin-top: 12px;
  padding: 6px 18px;
  background: var(--surface);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}

.timer-controls {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand); transform: translateY(-1px); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.92); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.92); }

.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Scoring Panel */
.scoring-panel {
  width: 38%;
  display: flex;
  flex-direction: column;
}

.scoring-mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.scoring-mode-toggle button {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.scoring-mode-toggle button.active { background: white; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.scoring-dimension {
  margin-bottom: 12px;
}

.scoring-dimension .dim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.scoring-dimension .dim-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.scoring-dimension .dim-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
}

.scoring-dimension input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 4px;
}

.scoring-dimension input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.scoring-dimension .dim-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.scoring-dimension .dim-ticks {
  position: relative;
  height: 16px;
  margin-bottom: 2px;
}

.scoring-dimension .dim-ticks .tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  background: var(--text-muted);
  height: 5px;
  opacity: 0.5;
}

.scoring-dimension .dim-ticks .tick.major {
  height: 10px;
  background: var(--text);
  opacity: 1;
}

.scoring-dimension .dim-ticks .tick span {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.scoring-dimension .dim-ticks .tick:nth-child(1) { left: calc(100% / 17 * 0); }
.scoring-dimension .dim-ticks .tick:nth-child(2) { left: calc(100% / 17 * 1); }
.scoring-dimension .dim-ticks .tick:nth-child(3) { left: calc(100% / 17 * 2); }
.scoring-dimension .dim-ticks .tick:nth-child(4) { left: calc(100% / 17 * 3); }
.scoring-dimension .dim-ticks .tick:nth-child(5) { left: calc(100% / 17 * 4); }
.scoring-dimension .dim-ticks .tick:nth-child(6) { left: calc(100% / 17 * 5); }
.scoring-dimension .dim-ticks .tick:nth-child(7) { left: calc(100% / 17 * 6); }
.scoring-dimension .dim-ticks .tick:nth-child(8) { left: calc(100% / 17 * 7); }
.scoring-dimension .dim-ticks .tick:nth-child(9) { left: calc(100% / 17 * 8); }
.scoring-dimension .dim-ticks .tick:nth-child(10) { left: calc(100% / 17 * 9); }
.scoring-dimension .dim-ticks .tick:nth-child(11) { left: calc(100% / 17 * 10); }
.scoring-dimension .dim-ticks .tick:nth-child(12) { left: calc(100% / 17 * 11); }
.scoring-dimension .dim-ticks .tick:nth-child(13) { left: calc(100% / 17 * 12); }
.scoring-dimension .dim-ticks .tick:nth-child(14) { left: calc(100% / 17 * 13); }
.scoring-dimension .dim-ticks .tick:nth-child(15) { left: calc(100% / 17 * 14); }
.scoring-dimension .dim-ticks .tick:nth-child(16) { left: calc(100% / 17 * 15); }
.scoring-dimension .dim-ticks .tick:nth-child(17) { left: calc(100% / 17 * 16); }
.scoring-dimension .dim-ticks .tick:nth-child(18) { left: calc(100% / 17 * 17); }

.total-score-box {
  margin-top: 12px;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand));
  border-radius: var(--radius-sm);
  text-align: center;
  color: white;
}

.total-score-box .total-label { font-size: 13px; opacity: 0.9; }
.total-score-box .total-value { font-size: 36px; font-weight: 800; line-height: 1.2; }

/* Tags Section */
.tags-section {
  margin-top: 12px;
}

.tags-section .tags-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tags-section .tags-title .reference-btn {
  font-size: 11px;
  color: var(--brand);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
}

.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tag:hover { border-color: var(--brand); }
.tag.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* Notes Panel */
.notes-panel {
  width: 62%;
  display: flex;
  flex-direction: column;
}

.notes-panel .panel-body { padding: 0; }

.notes-toolbar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.template-btn {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: white;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.template-btn:hover { border-color: var(--brand); color: var(--brand); }

.notes-textarea {
  width: 100%;
  flex: 1;
  border: none;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  font-family: inherit;
  color: var(--text);
  background: white;
}

.notes-textarea:focus { outline: none; }

.notes-textarea::placeholder { color: var(--border); }

/* Recording Panel */
.recording-panel {
  width: 42%;
  display: flex;
  flex-direction: column;
}

.recording-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.rec-dot.recording {
  background: var(--danger);
  animation: blink 1.2s infinite;
}

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

.rec-info { flex: 1; }
.rec-info .rec-title { font-size: 14px; font-weight: 600; }
.rec-info .rec-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.recording-panel .panel-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.recording-visual {
  width: 100px;
  height: 60px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.rec-bar {
  width: 6px;
  background: var(--brand);
  border-radius: 3px;
  transition: height 0.1s;
}

.recording-visual.inactive .rec-bar { height: 4px !important; background: var(--border); }

/* Compact bottom-row timer & recording */
.right-bottom-row .timer-panel .timer-display {
  flex-direction: row;
  padding: 4px 8px;
  gap: 8px;
}

.right-bottom-row .timer-panel .timer-box {
  width: 140px;
  height: 56px;
  border-width: 3px;
  border-radius: var(--radius-sm);
}

.right-bottom-row .timer-panel .timer-value {
  font-size: 24px;
}

.right-bottom-row .timer-panel .timer-label {
  font-size: 9px;
  margin-top: 1px;
}

.right-bottom-row .timer-panel .timer-type-badge {
  margin-top: 0;
  padding: 3px 12px;
  font-size: 13px;
}

.right-bottom-row .timer-panel .timer-controls {
  padding: 4px 6px;
  gap: 4px;
}

.right-bottom-row .timer-panel .timer-controls .btn {
  padding: 6px 12px;
  font-size: 13px;
}

.right-bottom-row .recording-panel .recording-status {
  padding: 6px 8px;
}

.right-bottom-row .recording-panel .panel-body {
  padding: 6px;
  gap: 4px;
}

.right-bottom-row .recording-panel .recording-visual {
  width: 60px;
  height: 28px;
  gap: 2px;
}

.right-bottom-row .recording-panel .rec-bar {
  width: 4px;
}

.right-bottom-row .recording-panel .rec-info .rec-title {
  font-size: 11px;
}

.right-bottom-row .recording-panel .rec-info .rec-time {
  font-size: 10px;
}

.autosave-indicator {
  font-size: 11px;
  color: white;
  opacity: 0;
  transition: opacity 0.3s;
  font-weight: 500;
}

/* Action Bar (moved to top) */
.bottom-bar {
  height: 56px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 12px;
}

.bottom-bar .bottom-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bottom-bar .bottom-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-selector label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.student-selector select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  color: var(--text);
  cursor: pointer;
}

.status-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
}

.status-pill.active { background: #d6f0fa; color: var(--brand); }
.status-pill.recording { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.show .modal { transform: translateY(0); }

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

.modal-header h3 { font-size: 18px; color: var(--brand); }

.modal-header .close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-header .close-btn:hover { color: var(--text); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

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

/* Score Reference Table */
.score-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.score-ref-table th {
  background: var(--surface);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--brand);
  border-bottom: 2px solid var(--border);
}

.score-ref-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.score-ref-table tr:hover td { background: var(--surface); }

/* Exam Report */
.report-content {
  line-height: 1.8;
}

.report-content .report-section {
  margin-bottom: 20px;
}

.report-content .report-section h4 {
  color: var(--brand);
  font-size: 15px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.report-item {
  background: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.report-item .report-label { font-size: 12px; color: var(--text-muted); }
.report-item .report-value { font-size: 15px; font-weight: 600; color: var(--text); }

/* Student Page */
.student-page .main-content { flex-direction: column; overflow-y: auto; }

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.student-card {
  background: var(--surface-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.student-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.student-card .student-name { font-size: 18px; font-weight: 700; color: var(--brand); margin-bottom: 4px; }
.student-card .student-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.student-card .student-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}
.student-card .student-stats .stat { text-align: center; }
.student-card .student-stats .stat-value { font-size: 22px; font-weight: 800; color: var(--brand); }
.student-card .student-stats .stat-label { font-size: 11px; color: var(--text-muted); }

/* Student Toolbar */
.student-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--surface-raised);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.student-search {
  flex: 1;
  min-width: 200px;
}

.student-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  transition: border-color 0.2s;
}

.student-search input:focus {
  outline: none;
  border-color: var(--brand);
}

.student-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-sort label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.sort-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: white;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sort-btn:hover { border-color: var(--brand); color: var(--brand); }
.sort-btn.active { border-color: var(--brand); background: var(--brand); color: white; }

.student-view-toggle {
  display: flex;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.view-btn {
  padding: 8px 14px;
  border: none;
  background: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.view-btn:hover { background: var(--surface); }
.view-btn.active { background: var(--brand); color: white; }

/* Student List Table */
.student-list-table {
  background: var(--surface-raised);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* Calendar View */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.calendar-weekday {
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}

.calendar-weekday:last-child { border-right: none; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: 400px;
}

.calendar-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  min-height: 100px;
  background: white;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
}

.calendar-day:hover { background: var(--surface); }

.calendar-day.other-month { background: var(--surface); color: var(--text-muted); }
.calendar-day.today { background: var(--brand-soft); }
.calendar-day.today .calendar-day-number { color: var(--brand); font-weight: 800; }

.calendar-day-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  text-align: right;
}

.calendar-day-number.weekend { color: var(--danger); }

.calendar-class-item {
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin-bottom: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.1s;
}

.calendar-class-item:hover { transform: translateX(2px); }

.calendar-class-item.mock { background: #d6f0fa; color: var(--brand); }
.calendar-class-item.lesson { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.calendar-class-item.trial { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.calendar-class-item.completed { opacity: 0.6; text-decoration: line-through; }

.calendar-class-item .time { font-weight: 700; }

.calendar-more {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
  cursor: pointer;
}

.calendar-more:hover { color: var(--brand); text-decoration: underline; }

/* Responsive toolbar */
@media (max-width: 800px) {
  .student-toolbar { flex-direction: column; align-items: stretch; }
  .student-sort, .student-view-toggle { justify-content: center; }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); }
  .calendar-day { min-height: 60px; font-size: 12px; }
}

@media (max-width: 600px) {
  .calendar-weekdays { display: none; }
  .calendar-grid { grid-template-columns: 1fr; }
  .calendar-day { border-right: none; min-height: auto; }
  .calendar-day.other-month { display: none; }
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--surface-raised);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
  text-align: center;
}

.admin-tab:hover { background: var(--surface); color: var(--brand); }
.admin-tab.active { background: var(--brand); color: white; }

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

/* History Page */
.history-page .main-content { flex-direction: column; overflow-y: auto; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-raised);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.history-table th {
  background: var(--brand);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}

.history-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.history-table tr:hover td { background: var(--surface); }

.history-table .score-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
}

.score-badge.high { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.score-badge.mid { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.score-badge.low { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Chart Placeholder */
.chart-container {
  height: 200px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--text); }

/* Full Screen Question Mode - optimized for screen sharing */
.fullscreen-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  z-index: 3000;
  display: none;
  flex-direction: column;
  overflow: auto;
}

.fullscreen-overlay.active { display: flex; }

/* Fullscreen top bar */
.fs-top-bar {
  height: 64px;
  background: white;
  border-bottom: 2px solid var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.fs-top-bar .fs-logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.fs-top-bar .fs-logo-area img {
  height: 40px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
}

.fs-top-bar .fs-close-btn {
  padding: 8px 20px;
  background: var(--brand-soft);
  color: var(--brand);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.fs-top-bar .fs-close-btn:hover { background: var(--brand); color: white; }

/* Fullscreen content area */
.fs-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 60px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* Part 2 timer banner */
.fs-part2-banner {
  width: 100%;
  max-width: 900px;
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.fs-timer-instruction {
  display: flex;
  gap: 32px;
  background: white;
  padding: 16px 36px;
  border-radius: 50px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.fs-prep-time, .fs-talk-time {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fs-prep-time { color: #f59e0b; }
.fs-talk-time { color: #10b981; }

/* Fullscreen card - matches Part 2 card style */
.fs-card {
  width: 100%;
  max-width: 900px;
  background: var(--surface-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fs-card .fs-card-header {
  padding: 18px 28px;
  background: var(--brand);
  color: white;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fs-card .fs-card-body {
  padding: 32px;
  flex: 1;
  overflow-y: auto;
}

.fs-card .fs-card-title {
  font-weight: 700;
  font-size: 32px;
  color: var(--brand);
  margin-bottom: 20px;
  line-height: 1.5;
}

.fs-card .fs-card-text {
  font-size: 28px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 28px;
}

.fs-card .fs-hints-box {
  background: white;
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.fs-card .fs-hints-box .fs-hints-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.fs-card .fs-hints-box .fs-hint-item {
  font-size: 22px;
  padding: 8px 0;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.fs-card .fs-hints-box .fs-hint-item::before {
  content: "•";
  color: var(--brand);
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

/* Hide follow-up in fullscreen (teacher only) */
.fs-followup { display: none !important; }

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

/* Responsive */
@media (max-width: 1200px) {
  .main-content { flex-direction: column; overflow-y: auto; }
  .left-panel { width: 100%; height: auto; }
  .right-panels { width: 100%; height: auto; }
  .right-top-row, .right-bottom-row { flex-direction: column; height: auto; }
  .timer-panel, .scoring-panel, .notes-panel, .recording-panel { width: 100%; }
}

/* Bank Tabs */
.bank-tab {
  padding: 10px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.bank-tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.bank-tab.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

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

/* Page sections */
.page-section { display: none; flex: 1; overflow: hidden; }
.page-section.active { display: flex; }
#examPage.page-section.active { flex-direction: column; }
#examPage .main-content { flex: 1; overflow: hidden; }
