/* ============================================
   COMPONENTS — Buttons, Cards, Forms, etc.
   ============================================ */

/* ════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn:disabled,
.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--sm {
  padding: 6px 14px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: 14px 28px;
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}

.btn--full {
  width: 100%;
}

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
}

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.48);
  transition: box-shadow 0.2s, transform 0.1s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(var(--primary-rgb), 0.65), var(--neon-glow);
  text-decoration: none;
  color: white;
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: var(--neon-glow-sm);
}

/* Secondary */
.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-secondary:hover {
  background: rgba(var(--primary-rgb), .06);
  box-shadow: var(--neon-glow-sm);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--primary);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none;
}

/* Danger */
.btn-danger {
  background: var(--error);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(var(--error-rgb), .25);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--error) 80%, #000);
  box-shadow: 0 4px 16px rgba(var(--error-rgb), .4);
  transform: translateY(-1px);
  text-decoration: none;
  color: white;
}

/* Success */
.btn-success {
  background: var(--success);
  color: white;
  border-color: transparent;
}

.btn-success:hover {
  background: color-mix(in srgb, var(--success) 80%, #000);
  box-shadow: 0 4px 16px rgba(var(--success-rgb), .35);
  transform: translateY(-1px);
  text-decoration: none;
  color: white;
}

/* Google */
.btn-google {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  gap: var(--space-3);
}

.btn-google:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--text);
}

.btn-google__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234285F4' d='M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z'/%3E%3Cpath fill='%2334A853' d='M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z'/%3E%3Cpath fill='%23FBBC05' d='M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z'/%3E%3Cpath fill='%23EA4335' d='M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Loading state */
.btn--loading {
  color: transparent;
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  color: white;
  border-top-color: white;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: var(--space-6);
  box-shadow: var(--card-shadow);
  transition: all var(--transition);
}

.card:hover {
  border-color: rgba(var(--primary-rgb), .3);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.card--neon:hover {
  box-shadow: var(--neon-glow), var(--card-shadow-hover);
}

.card--flat {
  box-shadow: none;
}

.card--flat:hover {
  transform: none;
}

.card--clickable {
  cursor: pointer;
}

/* Glass-morphism card variant (from design tokens) */
.card--glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

:root:not([data-theme="dark"]) .card--glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.85), rgba(255,255,255,0.55));
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 10px 30px rgba(var(--primary-rgb),0.1), inset 0 1px 0 rgba(255,255,255,0.8);
}

/* Topic card hover effect */
.topic-card {
  cursor: pointer;
}
.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(var(--primary-rgb), 0.15);
}

.card--sm { padding: var(--space-4); }
.card--lg { padding: var(--space-8); }

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* Stat card */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: var(--space-5);
  box-shadow: var(--card-shadow);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stat-card:hover {
  border-color: rgba(var(--primary-rgb), .3);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card__icon--primary { background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.stat-card__icon--success { background: var(--success-light); color: var(--success); }
.stat-card__icon--warning { background: var(--warning-light); color: var(--warning); }
.stat-card__icon--error   { background: var(--error-light);   color: var(--error); }

.stat-card__value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text);
  line-height: 1;
}

.stat-card__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.stat-card__trend--up   { color: var(--success); }
.stat-card__trend--down { color: var(--error); }

/* ════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text);
}

.form-label .required {
  color: var(--error);
  margin-left: 3px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-right: 44px;
}

.input-group__icon {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input-group__icon--left {
  right: auto;
  left: 14px;
  pointer-events: none;
}

.input-group .input.has-left-icon {
  padding-left: 44px;
}

.input {
  width: 100%;
  padding: 11px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  outline: none;
  line-height: 1.5;
}

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

.input:hover {
  border-color: var(--primary-light);
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}

.input--error {
  border-color: var(--error);
}

.input--error:focus {
  box-shadow: 0 0 0 3px rgba(var(--error-rgb), .12);
}

.input--success {
  border-color: var(--success);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 4px;
}

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

textarea.input {
  resize: vertical;
  min-height: 100px;
}

/* Checkbox & Radio */
.checkbox-group,
.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checkbox-item,
.radio-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

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

.checkbox-item__label,
.radio-item__label {
  font-size: var(--text-sm);
  color: var(--text);
}

/* ════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: slideUp .3s ease;
}

.modal--sm { max-width: 380px; }
.modal--lg { max-width: 720px; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.modal__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal__close:hover {
  background: var(--error-light);
  color: var(--error);
}

.modal__body {
  padding: var(--space-6);
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6) var(--space-6);
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════════
   BADGE / TAG
   ════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1.4;
  white-space: nowrap;
}

.badge--primary { background: rgba(var(--primary-rgb),.12); color: var(--primary-dark); }
.badge--success { background: var(--success-light); color: var(--success); }
.badge--error   { background: var(--error-light);   color: var(--error); }
.badge--warning { background: var(--warning-light); color: var(--warning); }
.badge--neutral { background: var(--surface-2);     color: var(--text-secondary); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: default;
  transition: all var(--transition-fast);
}

.tag:hover {
  background: rgba(var(--primary-rgb),.08);
  border-color: var(--primary-light);
  color: var(--primary);
}

.tag--active {
  background: rgba(var(--primary-rgb),.12);
  border-color: var(--primary-light);
  color: var(--primary);
}

/* ════════════════════════════════════════════
   PROGRESS BAR
   ════════════════════════════════════════════ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar--sm { height: 4px; }
.progress-bar--lg { height: 12px; }

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  transition: width .8s cubic-bezier(.25,.46,.45,.94);
  position: relative;
  overflow: hidden;
}

.progress-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation: shimmer 2s infinite;
}

.progress-bar__fill--success { background: linear-gradient(90deg, color-mix(in srgb, var(--success) 75%, #000), var(--success)); }
.progress-bar__fill--warning { background: linear-gradient(90deg, color-mix(in srgb, var(--warning) 75%, #000), var(--warning)); }
.progress-bar__fill--error   { background: linear-gradient(90deg, color-mix(in srgb, var(--error) 75%, #000), var(--error)); }

/* ════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  border: 1px solid;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.alert__icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert__content { flex: 1; }
.alert__title   { font-weight: var(--font-semibold); margin-bottom: 4px; }

.alert-success {
  background: var(--success-light);
  border-color: rgba(var(--success-rgb), .3);
  color: var(--success);
}

.alert-error {
  background: var(--error-light);
  border-color: rgba(var(--error-rgb), .3);
  color: var(--error);
}

.alert-warning {
  background: var(--warning-light);
  border-color: rgba(var(--warning-rgb), .3);
  color: var(--warning);
}

.alert-info {
  background: var(--info-light);
  border-color: rgba(var(--info-rgb), .3);
  color: var(--info);
}

/* ════════════════════════════════════════════
   SKELETON
   ════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  display: block;
}

.skeleton--text {
  height: 16px;
  border-radius: var(--radius-sm);
}

.skeleton--title {
  height: 24px;
  border-radius: var(--radius-sm);
}

.skeleton--circle {
  border-radius: 50%;
}

.skeleton--card {
  height: 200px;
  border-radius: var(--radius-md);
}

/* ════════════════════════════════════════════
   AVATAR
   ════════════════════════════════════════════ */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  /* Solid theme-accent colour — matches the selected accent hue automatically. */
  background: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: var(--font-semibold);
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
  /* Safety net: if text content somehow overflows, clip rather than break layout. */
  text-overflow: clip;
  white-space: nowrap;
  line-height: 1;
  text-transform: uppercase;
}

.avatar__letter {
  /* Hard-limit the letter to a single character centered in the circle.
     If name ever leaks through as multi-char, this clips it visually. */
  display: block;
  width: 100%;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

.avatar--sm  { width: 28px; height: 28px; font-size: var(--text-xs); min-width: 28px; }
.avatar      { width: 36px; height: 36px; font-size: var(--text-sm); min-width: 36px; }
.avatar--md  { width: 44px; height: 44px; font-size: var(--text-base); min-width: 44px; }
.avatar--lg  { width: 64px; height: 64px; font-size: var(--text-xl); min-width: 64px; }
.avatar--xl  { width: 96px; height: 96px; font-size: var(--text-3xl); min-width: 96px; }

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Prevent text initials from overflowing the circle */
.avatar:not(:has(img)) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  line-height: 1;
}

/* ════════════════════════════════════════════
   DIVIDER
   ════════════════════════════════════════════ */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════════
   TOOLTIP
   ════════════════════════════════════════════ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  font-size: var(--text-xs);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
}

/* ════════════════════════════════════════════
   DROPDOWN
   ════════════════════════════════════════════ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  animation: slideUp .2s ease;
}

.dropdown__menu--left {
  right: auto;
  left: 0;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
}

.dropdown__item:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.dropdown__item--danger:hover {
  background: var(--error-light);
  color: var(--error);
}

.dropdown__divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-2) 0;
}

/* ════════════════════════════════════════════
   TABS
   ════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ════════════════════════════════════════════
   NUMBER NAVIGATION (Exam)
   ════════════════════════════════════════════ */
.question-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.question-nav__btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.question-nav__btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(var(--primary-rgb),.06);
}

.question-nav__btn.current {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: var(--neon-glow-sm);
}

.question-nav__btn.answered {
  background: var(--success-light);
  border-color: rgba(var(--success-rgb),.4);
  color: var(--success);
}

.question-nav__btn.skipped {
  background: var(--warning-light);
  border-color: rgba(var(--warning-rgb),.4);
  color: var(--warning);
}

/* ════════════════════════════════════════════
   RESULT ITEM
   ════════════════════════════════════════════ */
.result-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color var(--transition-fast);
}

.result-item:hover {
  border-color: var(--border-strong);
}

.result-item--correct {
  border-color: rgba(var(--success-rgb),.3);
  background: rgba(var(--success-rgb),.03);
}

.result-item--incorrect {
  border-color: rgba(var(--error-rgb),.3);
  background: rgba(var(--error-rgb),.03);
}

/* ════════════════════════════════════════════
   LOADING SPINNER
   ════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(var(--primary-rgb), .2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--lg { width: 40px; height: 40px; border-width: 4px; }

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* ════════════════════════════════════════════
   MOBILE RESPONSIVE OVERRIDES
   ════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Question card — reduce padding */
  .question-card {
    padding: var(--space-4) var(--space-4) !important;
    border-radius: var(--radius) !important;
  }

  /* Question images — full width */
  .question-card__images img {
    max-height: 200px !important;
  }

  /* Exam navigation — bigger tap targets */
  .question-nav {
    gap: 6px !important;
    flex-wrap: wrap;
  }
  .question-nav__btn {
    min-width: 40px !important;
    min-height: 40px !important;
    font-size: var(--text-sm) !important;
  }

  /* Topics grid — single column on small screens */
  .topics-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-4);
  }

  /* Topic card — reduce padding */
  .topic-card {
    padding: var(--space-4) !important;
  }

  /* Section headers */
  .section__title {
    font-size: var(--text-2xl) !important;
  }
  .section__subtitle {
    font-size: var(--text-sm) !important;
  }

  /* Page titles */
  .page-title {
    font-size: var(--text-2xl) !important;
  }

  /* Tabs — horizontal scroll on mobile */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: var(--text-xs);
  }

  /* Cards — less padding */
  .card {
    padding: var(--space-4);
  }

  /* Hero section */
  .hero-section {
    padding: var(--space-10) 0 var(--space-8) !important;
  }

  /* Buttons — ensure minimum tap target */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }
  .btn--sm {
    min-height: 36px;
    padding: 6px 12px;
  }

  /* Auth box — full width */
  .auth-box {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  /* Modal — near full width on mobile */
  .modal {
    width: calc(100vw - 32px) !important;
    max-width: none !important;
    margin: 16px;
  }

  /* Exam sticky header */
  .exam-header-sticky {
    padding: var(--space-2) 0 !important;
  }

  /* Progress bar in practice */
  .progress-bar {
    height: 6px;
  }

  /* Input group — full width */
  .input-group {
    max-width: none !important;
  }

  /* Divider text */
  .divider {
    font-size: var(--text-xs);
  }

  /* Google button container */
  #google-btn-container {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .main-content {
    padding: var(--space-4) var(--space-3) !important;
  }

  /* Hero — even smaller fonts */
  .hero-section h1 {
    font-size: clamp(1.5rem, 7vw, 2.2rem) !important;
  }

  /* Stats row on landing — 2x2 grid */
  .hero-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-3) !important;
  }

  /* Exam timer — bigger */
  .timer-display {
    font-size: var(--text-xl) !important;
  }

  /* Badge smaller */
  .badge {
    font-size: 10px;
    padding: 2px 8px;
  }

  /* Dashboard stats — tighter */
  .dashboard-stats {
    gap: var(--space-2) !important;
  }
}
