/* ============================================================
   Sammie's Revision Help — Neumorphism design system
   Tokens adapted from sleekacademia.com (approved neumorphism reskin)
   ============================================================ */

:root {
  --surface: #e7e4f1;
  --shadow-dark: #c3bdd8;
  --shadow-light: #ffffff;
  --text: #372f52;
  --muted: #6b6488;
  --placeholder: #9a92b8;
  --accent: #702ae1;
  --accent-2: #9d6bff;
  --accent-glow: rgba(112, 42, 225, .35);
  --danger: #d64562;
  --success: #2fa36b;
  --warning: #d9932c;
  --r: 22px;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4, .heading-font {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.2;
}

/* ---------- Neumorphic primitives ---------- */

.neu {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
  transition: box-shadow .35s var(--ease), transform .35s var(--ease);
}

.neu.lift:hover {
  transform: translateY(-4px);
  box-shadow: 16px 16px 34px var(--shadow-dark), -14px -14px 30px var(--shadow-light);
}

.well {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: inset 7px 7px 14px var(--shadow-dark), inset -7px -7px 14px var(--shadow-light);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  border-radius: 50px;
  padding: 14px 28px;
  box-shadow: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
  transition: all .25s var(--ease);
  text-decoration: none;
  user-select: none;
}

.btn:hover { transform: translateY(-2px); color: var(--accent); }

.btn:active, .btn.pressed {
  transform: scale(.98);
  box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 8px 8px 20px var(--accent-glow), -8px -8px 18px var(--shadow-light),
              inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 0 1px rgba(112, 42, 225, .2);
}

.btn.primary:hover { color: #fff; filter: brightness(1.06); }

.btn.primary:active {
  box-shadow: inset 6px 6px 14px rgba(60, 10, 140, .55), inset -6px -6px 14px rgba(200, 160, 255, .5);
}

.btn.ghost { box-shadow: none; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--accent); transform: none; }

.btn.small { padding: 9px 18px; font-size: 13px; }
.btn.danger-hover:hover { color: var(--danger); }

.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- Forms ---------- */

.neu-field {
  width: 100%;
  border: none;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15.5px;
  border-radius: 16px;
  padding: 15px 18px;
  box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
  transition: box-shadow .25s var(--ease);
}

.neu-field::placeholder { color: var(--placeholder); }

.neu-field:focus {
  box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light),
              0 0 0 2px rgba(112, 42, 225, .28);
}

textarea.neu-field { min-height: 110px; resize: vertical; }

label.field-label {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px 6px;
}

/* ---------- Chips / badges ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .4px;
  color: var(--muted);
  border-radius: 30px;
  padding: 6px 14px;
  box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
}

.chip.accent { color: var(--accent); }
.chip.danger { color: var(--danger); }
.chip.success { color: var(--success); }
.chip.warning { color: var(--warning); }

/* ---------- Layout ---------- */

.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
}

.brand h1 { font-size: 22px; }
.brand .sub { color: var(--muted); font-size: 13px; }

.eyebrow {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.gradient-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Dashboard cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 26px;
}

.subject-card { padding: 24px; display: flex; flex-direction: column; gap: 14px; }

.subject-card .card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.subject-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
}

.subject-card h3 { font-size: 19px; }
.subject-card .papers { color: var(--muted); font-size: 13px; }

.score-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 12.5px;
  border-radius: 30px;
  padding: 6px 13px;
  white-space: nowrap;
  box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
}
.score-badge.weak { color: var(--danger); }
.score-badge.mid { color: var(--warning); }
.score-badge.strong { color: var(--success); }

.progress-track {
  height: 14px;
  border-radius: 30px;
  box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 30px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s var(--ease);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: -6px;
}

.card-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Quiz view ---------- */

.quiz-shell { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.quiz-head .meta { color: var(--muted); font-size: 13.5px; }

.streak-dots { display: inline-flex; gap: 7px; align-items: center; }

.streak-dot {
  width: 16px; height: 16px; border-radius: 50%;
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}
.streak-dot.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 4px 4px 10px var(--accent-glow), -3px -3px 8px var(--shadow-light);
}

.question-card { padding: 28px; display: flex; flex-direction: column; gap: 18px; }

.question-banner {
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
  color: var(--danger);
}
.question-banner.ok { color: var(--success); }

.context-block {
  padding: 16px 18px;
  font-size: 14.5px;
  color: var(--text);
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
}

.context-block .ctx-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.question-text { font-size: 17.5px; font-weight: 500; white-space: pre-wrap; }
.question-text b { font-weight: 700; }

.subpart { padding: 14px 16px; border-radius: 14px; }
.subpart + .subpart { margin-top: 10px; }

.answer-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.hint-row { color: var(--muted); font-size: 13px; }

/* Feedback / ELI5 panel */

.feedback-panel { padding: 24px; display: flex; flex-direction: column; gap: 14px; }

.feedback-panel.correct-glow { box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light), 0 0 0 2px rgba(47, 163, 107, .45); }
.feedback-panel.wrong-glow { box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light), 0 0 0 2px rgba(214, 69, 98, .4); }

.feedback-title { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.feedback-body { font-size: 15px; white-space: pre-wrap; color: var(--text); }
.feedback-body p { margin-bottom: 10px; }

.eli5-badge {
  display: inline-flex;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 11.5px;
  letter-spacing: 1.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 30px;
  padding: 5px 13px;
}

/* AI similar question callout */
.similar-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--accent);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(55, 47, 82, .35);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }

.modal-card {
  width: 100%; max-width: 440px;
  padding: 28px;
  display: flex; flex-direction: column; gap: 16px;
}

.modal-card h3 { font-size: 18px; }
.modal-card p { color: var(--muted); font-size: 14.5px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Login view ---------- */

.login-shell { max-width: 430px; margin: 8vh auto 0; padding: 34px 30px; display: flex; flex-direction: column; gap: 18px; }
.login-shell .logo { text-align: center; font-size: 44px; }
.login-shell h1 { text-align: center; font-size: 24px; }
.login-shell .tagline { text-align: center; color: var(--muted); font-size: 14px; margin-top: -10px; }

.auth-tabs {
  display: flex; gap: 8px; padding: 6px;
  background: var(--surface); border-radius: 14px;
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}
.auth-tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px;
  color: var(--muted); font-family: inherit; transition: all .15s ease;
}
.auth-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

/* ---------- Spinner / loading ---------- */

.spinner {
  width: 20px; height: 20px; flex: 0 0 20px;
  border-radius: 50%;
  border: 3px solid var(--shadow-dark);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14.5px; }

.thinking {
  display: flex; gap: 6px; padding: 8px 2px;
}
.thinking span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  opacity: .35;
  animation: bounce 1.2s infinite var(--ease);
}
.thinking span:nth-child(2) { animation-delay: .15s; }
.thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-7px); opacity: 1; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border-radius: 40px;
  padding: 13px 24px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
  opacity: 0;
  pointer-events: none;
  transition: all .35s var(--ease);
  z-index: 80;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { color: var(--success); }
.toast.error { color: var(--danger); }

/* ---------- Utility ---------- */

.hidden { display: none !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }

.footer-note {
  margin-top: 44px;
  text-align: center;
  color: var(--placeholder);
  font-size: 12.5px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .container { padding: 18px 14px 70px; }
  .question-card { padding: 20px; }
  .brand h1 { font-size: 18px; }
  .btn { padding: 13px 22px; font-size: 14px; }
  .cards { grid-template-columns: 1fr; gap: 20px; }
}
