/* ============================================================================
   ECHIDNA — RACP BPT Question Bank
   Comprehensive CSS Stylesheet
   Design: Clean Minimal
   ========================================================================== */

:root {
  /* Colors */
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --text: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --accent: #4F46E5;
  --accent-light: #EEF2FF;
  --accent-hover: #4338CA;
  --success: #059669;
  --success-light: #ECFDF5;
  --success-bg: #D1FAE5;
  --error: #DC2626;
  --error-light: #FEF2F2;
  --error-bg: #FEE2E2;
  --warning: #D97706;
  --warning-light: #FFFBEB;
  --warning-bg: #FEF3C7;
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  /* Spacing & Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

  /* Transitions */
  --transition: all 0.15s ease;

  /* Fonts */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-heading: 'Bitcount Prop Single Ink', 'Inter', sans-serif;
}

/* ============================================================================
   RESET & GLOBAL
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h1 { font-size: 2.0rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.0rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.9rem; }

/* Typography Utility Classes */
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

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

.text-secondary {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

.text-warning {
  color: var(--warning);
}

.text-accent {
  color: var(--accent);
}

.text-small {
  font-size: 0.875rem;
}

.text-large {
  font-size: 1.125rem;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================================
   LAYOUT
   ========================================================================== */

main {
  min-height: calc(100vh - 64px);
  padding: 30px 0;
}

.page-header {
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 2.0rem;
  margin-bottom: 10px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Flex Utilities */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-col {
  flex-direction: column;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

/* ============================================================================
   FORM ELEMENTS
   ========================================================================== */

input,
textarea,
select {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-body);
}

select {
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%234F46E5'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 20px;
  appearance: none;
}

input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

input[type="range"] {
  width: 100%;
  height: 4px;
  border: none;
  background: var(--border);
  border-radius: 2px;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* ============================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #047857;
}

.btn-error {
  background: var(--error);
  color: white;
}

.btn-error:hover {
  background: #B91C1C;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #B45309;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--accent-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1.1rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Icon buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon.sm {
  width: 32px;
  height: 32px;
}

/* ============================================================================
   CARDS & CONTAINERS
   ========================================================================== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--border-light);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ============================================================================
   AUTH PAGES (LOGIN)
   ========================================================================== */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg) 100%);
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  max-width: 400px;
  width: 100%;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-image {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: block;
}

.auth-logo-text {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--accent);
  font-weight: 700;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.form-input {
  padding: 12px;
  font-size: 0.95rem;
}

.form-error {
  font-size: 0.85rem;
  color: var(--error);
  margin-top: 4px;
}

.form-success {
  font-size: 0.85rem;
  color: var(--success);
  margin-top: 4px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ============================================================================
   NAVIGATION BAR
   ========================================================================== */

.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.nav-brand-logo {
  width: 32px;
  height: 32px;
}

.nav-center {
  display: flex;
  gap: 32px;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--accent);
}

.nav-link.active {
  color: var(--accent);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

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

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent);
}

.nav-streak {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--warning-light);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--warning);
}

.nav-streak-icon {
  font-size: 1.2rem;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
}

/* Mobile hamburger menu */
@media (max-width: 768px) {
  .nav-center {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav-center.active {
    display: flex;
  }

  .nav-link {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
  }

  .nav-link.active::after {
    display: none;
  }

  .hamburger {
    display: flex;
  }
}

/* ============================================================================
   DASHBOARD
   ========================================================================== */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.daily-goal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.daily-goal-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.daily-goal-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.daily-goal-text h3 {
  margin: 0 0 8px 0;
}

.daily-goal-text p {
  color: var(--text-secondary);
  margin: 0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.category-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.category-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.category-name {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.category-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.activity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.activity-info {
  flex: 1;
}

.activity-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.activity-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.activity-stat {
  font-weight: 600;
  color: var(--accent);
}

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

.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--border-light);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.8rem;
}

.badge-icon {
  font-size: 2.5rem;
}

/* ============================================================================
   QUIZ CREATION / FILTERS
   ========================================================================== */

.filter-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.filter-group {
  margin-bottom: 24px;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.filter-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.filter-checkbox:hover {
  border-color: var(--accent);
}

.filter-checkbox input:checked ~ label {
  font-weight: 600;
  color: var(--accent);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

.chip-remove {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.chip-remove:hover {
  opacity: 1;
}

.quiz-config {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 24px 0;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-field label {
  font-weight: 500;
}

.config-field input,
.config-field select {
  padding: 10px 12px;
}

.quiz-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ============================================================================
   QUIZ PLAYING
   ========================================================================== */

.q-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.q-breadcrumb {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.q-pills {
  display: flex;
  gap: 8px;
}

.q-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.q-counter {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.q-progress-bar {
  height: 3px;
  background: var(--border-light);
  margin-bottom: 24px;
  border-radius: 2px;
  overflow: hidden;
}

.q-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.q-stem-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 24px;
  line-height: 1.7;
}

.q-stem-card h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.q-stem-card pre {
  background: var(--border-light);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin: 12px 0;
  white-space: pre-line;
  word-wrap: break-word;
}

.q-stem-card img {
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: var(--radius-md);
}

.q-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.q-opt {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.q-opt:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.q-opt.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.q-opt.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.q-opt.incorrect {
  border-color: var(--error);
  background: var(--error-light);
}

.q-opt.dimmed {
  opacity: 0.5;
  cursor: default;
}

.q-opt-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-light);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.q-opt.selected .q-opt-letter {
  background: var(--accent);
  color: white;
}

.q-opt.correct .q-opt-letter {
  background: var(--success);
  color: white;
}

.q-opt.incorrect .q-opt-letter {
  background: var(--error);
  color: white;
}

.q-opt-text {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.q-opt-icon {
  flex-shrink: 0;
  font-size: 1.2rem;
}

.explanation-panel {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.exp-header {
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exp-header:hover {
  background: var(--border-light);
}

.exp-body {
  padding: 20px;
}

.exp-text {
  margin-bottom: 20px;
  line-height: 1.7;
}

.exp-text:last-child {
  margin-bottom: 0;
}

.pearl-box {
  padding: 16px;
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  margin: 16px 0;
}

.pearl-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
}

.knowledge-box {
  padding: 16px;
  background: var(--success-light);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-sm);
  margin: 16px 0;
}

.knowledge-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--success);
}

.refs {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.refs h4 {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
}

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

.ref-item {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ref-item a {
  color: var(--accent);
}

.q-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 12px;
}

.q-toolbar-left,
.q-toolbar-right {
  display: flex;
  gap: 12px;
}

.q-timer {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--card);
  border: 2px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--warning);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.q-timer.critical {
  border-color: var(--error);
  color: var(--error);
}

/* ============================================================================
   QUIZ REVIEW
   ========================================================================== */

.review-summary {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 32px;
  text-align: center;
}

.review-score {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}

.review-percent {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.review-feedback {
  font-size: 1.1rem;
  margin-top: 16px;
}

.review-feedback.pass {
  color: var(--success);
}

.review-feedback.fail {
  color: var(--error);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
}

.review-item {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.review-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.review-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.review-item-question {
  font-weight: 600;
  flex: 1;
}

.review-item-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.review-item-status.correct {
  color: var(--success);
}

.review-item-status.incorrect {
  color: var(--error);
}

.review-item-expanded {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* ============================================================================
   ANALYTICS
   ========================================================================== */

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

.period-selector {
  display: flex;
  gap: 8px;
}

.period-btn {
  padding: 8px 16px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.period-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.bar-chart {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.bar-chart-title {
  font-weight: 600;
  margin-bottom: 20px;
}

.bar-cols {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  height: 200px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar {
  width: 100%;
  background: var(--accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: background 0.15s;
  cursor: pointer;
}

.bar:hover {
  background: var(--accent-hover);
}

.bar-day {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.bar-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 20px 0;
}

.hm-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.hm-cell:hover {
  box-shadow: var(--shadow-md);
}

.hm-0 { background: var(--border-light); }
.hm-1 { background: #C6E9D4; }
.hm-2 { background: #7FD0B8; }
.hm-3 { background: #3BB393; }
.hm-4 { background: #059669; }

.weak-callout {
  background: var(--error-light);
  border: 1px solid var(--error-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.weak-callout strong {
  color: var(--error);
}

.cat-table {
  width: 100%;
  border-collapse: collapse;
}

.cat-table th {
  text-align: left;
  padding: 12px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  background: var(--border-light);
}

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

.cat-table tr:hover {
  background: var(--border-light);
}

.mini-bar-bg {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  background: var(--accent);
}

.indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.indicator.strong {
  background: var(--success-light);
  color: var(--success);
}

.indicator.ok {
  background: var(--warning-light);
  color: var(--warning);
}

.indicator.weak {
  background: var(--error-light);
  color: var(--error);
}

/* ============================================================================
   ADMIN PANEL
   ========================================================================== */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.admin-stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.admin-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.admin-table th {
  background: var(--border-light);
  padding: 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.admin-table th:hover {
  background: var(--border);
}

.admin-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-light);
}

.admin-table tr:hover {
  background: var(--border-light);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.q-id {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.diff-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.diff-badge.easy {
  background: var(--success-light);
  color: var(--success);
}

.diff-badge.moderate {
  background: var(--warning-light);
  color: var(--warning);
}

.diff-badge.difficult {
  background: var(--error-light);
  color: var(--error);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill.active {
  background: var(--success-light);
  color: var(--success);
}

.status-pill.draft {
  background: var(--warning-light);
  color: var(--warning);
}

.status-pill.suspended {
  background: var(--error-light);
  color: var(--error);
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--border-light);
}

.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-zone-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.upload-zone-text {
  font-weight: 500;
  margin-bottom: 4px;
}

.upload-zone-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row.full {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-weight: 500;
  font-size: 0.95rem;
}

.form-input,
.form-textarea,
.form-select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.form-textarea {
  min-height: 150px;
  resize: vertical;
}

.markdown-preview {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  max-height: 300px;
  overflow-y: auto;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

/* ============================================================================
   MODALS
   ========================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
}

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

.modal-body {
  padding: 24px;
}

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

/* ============================================================================
   IMAGE EDITOR
   ========================================================================== */

.image-editor-container {
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}

.editor-canvas {
  width: 100%;
  max-height: 400px;
  background: var(--border-light);
}

.editor-actions {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-light);
  justify-content: flex-end;
}

/* ============================================================================
   REPORT MODAL
   ========================================================================== */

.report-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-form label {
  font-weight: 500;
}

.report-form select,
.report-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
}

.report-form textarea {
  min-height: 120px;
  resize: vertical;
}

/* ============================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.25s ease;
}

/* ============================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  body {
    font-size: 15px;
  }

  main {
    padding: 20px 0;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stat-card {
    padding: 20px 16px;
  }

  .daily-goal {
    flex-direction: column;
    text-align: center;
  }

  .daily-goal-ring {
    width: 100px;
    height: 100px;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .filter-options {
    grid-template-columns: 1fr;
  }

  .quiz-config {
    grid-template-columns: 1fr;
  }

  .q-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .q-stem-card {
    padding: 20px;
  }

  .q-stem-card h2 {
    font-size: 1.1rem;
  }

  .q-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .q-toolbar-left,
  .q-toolbar-right {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .admin-toolbar {
    flex-direction: column;
  }

  .admin-toolbar .btn {
    width: 100%;
  }

  .admin-table {
    font-size: 0.85rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px;
  }

  .modal-content {
    max-width: 100%;
    border-radius: var(--radius-md);
  }

  .auth-card {
    padding: 30px 20px;
  }

  .auth-logo-image {
    width: 60px;
    height: 60px;
  }

  .auth-logo-text {
    font-size: 1.5rem;
  }

  .achievements {
    grid-template-columns: repeat(3, 1fr);
  }

  .bar-cols {
    gap: 8px;
  }

  .heatmap-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .q-timer {
    top: 70px;
    right: 10px;
    left: 10px;
    padding: 10px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  body {
    font-size: 14px;
  }

  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 1rem; }

  .navbar-content {
    padding: 0 12px;
  }

  .nav-center {
    left: 0;
  }

  .nav-right {
    gap: 12px;
  }

  .nav-streak {
    display: none;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px 12px;
  }

  .stat-value {
    font-size: 2rem;
  }

  .filter-chips {
    gap: 6px;
  }

  .chip {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .q-stem-card {
    padding: 16px;
  }

  .q-options {
    gap: 10px;
  }

  .q-opt {
    padding: 12px;
    gap: 12px;
  }

  .q-opt-letter {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .achievements {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }

  .auth-card {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }

  .cat-table th,
  .cat-table td {
    padding: 8px;
    font-size: 0.85rem;
  }

  .admin-stat-value {
    font-size: 1.5rem;
  }

  .upload-zone {
    padding: 32px 16px;
  }
}
