/* ============================================
   THE STACK — Shared Styles
   Colour system: kelvindoesit dark blue / electric blue
   ============================================ */

:root {
  --bg: #0a0e17;
  --bg-2: #111827;
  --bg-3: #1a2332;
  --bg-4: #1e293b;
  --border: rgba(148, 163, 184, 0.08);
  --border-solid: #1e293b;
  --border-hot: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-dark: #1e40af;
  --green: #10b981;
  --warning: #f59e0b;
  --red: #ef4444;
  --display: 'Sora', sans-serif;
  --mono: 'DM Sans', sans-serif;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.08), transparent 50%),
    radial-gradient(circle at 85% 100%, rgba(96, 165, 250, 0.05), transparent 50%);
  background-attachment: fixed;
  display: flex;
}

/* === SIDEBAR === */
.sidebar {
  width: 280px;
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border-solid);
  padding: 32px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text);
}

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

.tagline {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 40px;
  font-weight: 500;
}

.nav-section { margin-bottom: 32px; }

.nav-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 12px;
  padding-left: 12px;
  font-weight: 600;
}

.nav-link {
  display: block;
  padding: 10px 12px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  border-radius: 0 6px 6px 0;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-3);
}

.nav-link.active {
  color: var(--accent-2);
  border-left-color: var(--accent);
  background: var(--bg-3);
}

.nav-link .num {
  color: var(--text-faint);
  font-size: 11px;
  margin-right: 8px;
  font-weight: 600;
}

/* === MAIN CONTENT === */
.main {
  flex: 1;
  padding: 48px 64px 80px;
  max-width: 1100px;
  width: 100%;
}

/* === PAGE HEADER === */
.page-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-solid);
}

.eyebrow {
  font-size: 12px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 16px;
  font-weight: 600;
}

h1 {
  font-family: var(--display);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 20px;
  color: var(--text);
}

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

.lead {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 700px;
  line-height: 1.65;
}

.lead strong { color: var(--text); font-weight: 600; }

/* === TYPOGRAPHY === */
h2 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 56px;
  margin-bottom: 16px;
  color: var(--text);
}

h2 .icon { color: var(--accent); margin-right: 6px; font-weight: 700; }

h3 {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text);
}

h4 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  margin-top: 24px;
  margin-bottom: 10px;
}

p {
  margin-bottom: 16px;
  color: var(--text);
}

strong { color: var(--text); font-weight: 600; }
em { color: var(--accent-2); font-style: normal; font-weight: 500; }

a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

a:hover { border-bottom-color: var(--accent-2); }

ul, ol { margin-bottom: 16px; padding-left: 24px; }

ul li, ol li { margin-bottom: 8px; color: var(--text); }

ul li::marker { color: var(--accent); }
ol li::marker { color: var(--accent); font-weight: 700; }

/* === BLOCKQUOTE === */
blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  padding: 20px 24px;
  margin: 24px 0;
  font-size: 16px;
  color: var(--text);
  border-radius: 0 6px 6px 0;
}

blockquote strong { color: var(--accent-2); }

/* === TABLES === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
  background: var(--bg-2);
  border-radius: 6px;
  overflow: hidden;
}

th {
  background: var(--bg-3);
  color: var(--accent-2);
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border-solid);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-solid);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-3); }

hr {
  border: none;
  border-top: 1px solid var(--border-solid);
  margin: 48px 0;
}

/* === INFO BLOCK (replaces salesy CTA) === */
.info-block {
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  padding: 28px 32px;
  margin: 32px 0;
  position: relative;
  border-radius: 10px;
}

.info-block::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 10px 10px 0 0;
}

.info-block h3 {
  margin-top: 0;
  color: var(--accent-2);
}

.info-block p:last-child { margin-bottom: 0; }

/* === BUTTONS (used for tracker interactions only) === */
.btn {
  display: inline-block;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-hot);
  padding: 12px 22px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border-radius: 8px;
  margin-right: 8px;
  margin-bottom: 8px;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent-2);
  background: var(--bg-3);
  border-bottom-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-2);
  color: #ffffff;
  border-color: var(--accent-2);
}

.btn-danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

/* === RATINGS === */
.stars {
  color: var(--warning);
  letter-spacing: 2px;
}

/* === FORM ELEMENTS === */
input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
  background: var(--bg-3);
  border: 1px solid var(--border-hot);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 11px 14px;
  width: 100%;
  border-radius: 6px;
  transition: border-color 0.15s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(0.5) sepia(1) saturate(5) hue-rotate(190deg);
}

textarea { resize: vertical; min-height: 80px; }

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}

.form-group { margin-bottom: 20px; }

.form-row,
.form-row-3 {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

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

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

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

.checkbox-group label {
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  font-weight: 400;
}

/* === COLLAPSIBLE === */
details {
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  margin-bottom: 12px;
  padding: 0;
  border-radius: 8px;
}

details summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color 0.15s ease;
}

details summary::-webkit-details-marker { display: none; }

details summary::after {
  content: '+';
  font-size: 22px;
  color: var(--accent);
  font-weight: 400;
  line-height: 1;
}

details[open] summary::after { content: '−'; }

details summary:hover { color: var(--accent-2); }

details .details-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border-solid);
  padding-top: 20px;
}

/* === STATS CARDS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  padding: 22px;
  position: relative;
  border-radius: 10px;
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-card .stat-value {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent-2);
  line-height: 1;
}

.stat-card .stat-meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 8px;
}

/* === METHOD CARDS GRID === */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.method-card {
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: all 0.15s ease;
  position: relative;
  border-radius: 10px;
}

.method-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  border-bottom-color: var(--accent);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.method-card .method-num {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.18em;
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.method-card .method-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.method-card .method-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.55;
}

.method-card .method-arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  color: var(--text-faint);
  font-size: 18px;
  transition: color 0.15s ease;
}

.method-card:hover .method-arrow { color: var(--accent-2); }

/* === HISTORY ITEMS === */
.history-item {
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  padding: 20px 24px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 20px;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.history-item:hover { border-color: var(--accent); }

.history-item .h-date {
  font-size: 13px;
  color: var(--accent-2);
  font-weight: 600;
}

.history-item .h-topic {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.history-item .h-method {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.history-item .h-score {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-2);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border-hot);
  margin: 20px 0;
  border-radius: 10px;
}

.empty-state .empty-icon {
  font-family: var(--display);
  font-size: 42px;
  color: var(--text-faint);
  margin-bottom: 16px;
  font-weight: 700;
}

/* === WRONG ANSWER LOG === */
.wrong-answer {
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  border-left: 3px solid var(--red);
  padding: 20px 24px;
  margin-bottom: 12px;
  border-radius: 0 8px 8px 0;
}

.wrong-answer .wa-question {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 15px;
}

.wrong-answer .wa-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.wrong-answer .wa-row {
  font-size: 14px;
  margin-bottom: 6px;
}

.wrong-answer .wa-label {
  color: var(--text-faint);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-right: 8px;
  font-weight: 600;
}

.wrong-answer .wa-wrong { color: var(--red); }
.wrong-answer .wa-right { color: var(--green); }

.wrong-answer .wa-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.wrong-answer .wa-actions .btn {
  padding: 6px 12px;
  font-size: 11px;
}

/* === WEEKLY TRACKER === */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.day-cell {
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 8px;
}

.day-cell:hover { border-color: var(--accent); }

.day-cell.done {
  background: var(--bg-3);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.day-cell.done::after {
  content: '✓';
  display: block;
  color: var(--accent-2);
  font-size: 18px;
  margin-top: 4px;
  font-weight: 700;
}

.day-cell .day-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.day-cell .day-num {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

/* === EXAMPLE BOX (for the new written assessments examples) === */
.example-box {
  background: var(--bg-3);
  border: 1px solid var(--border-solid);
  border-left: 3px solid var(--green);
  padding: 18px 22px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
}

.example-box .example-label {
  font-size: 10px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-bottom: 8px;
}

.example-box strong { color: var(--accent-2); }

/* === MOBILE === */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    min-height: auto;
    padding: 24px;
  }
  .main { padding: 32px 24px 60px; }
  h1 { font-size: 38px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(4, 1fr); }
  .history-item { grid-template-columns: 1fr; gap: 8px; }
}

/* === UTILITY === */
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent-2); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hot); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================
   FLOATING SAVE WIDGET
   ============================================ */
#save-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: var(--mono);
}

#sw-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sw-fab:hover { transform: scale(1.08); background: var(--accent-2); }
#sw-fab.open { transform: rotate(8deg); }

#sw-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 280px;
  background: var(--bg-2);
  border: 1px solid var(--border-solid);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

#sw-panel .sw-head {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.sw-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-dim);
}
.sw-stats strong { color: var(--accent-2); font-size: 18px; display: block; font-family: var(--display); }

.sw-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-hot);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.sw-btn:hover { border-color: var(--accent); color: var(--accent-2); background: var(--bg-3); }
.sw-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.sw-primary:hover { background: var(--accent-2); color: #fff; }
.sw-link { font-size: 12px; color: var(--text-dim); }

.sw-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.4;
}

.sw-toast {
  position: fixed;
  bottom: 90px;
  right: 24px;
  background: var(--green);
  color: #04110b;
  padding: 12px 18px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  z-index: 1001;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.sw-toast.show { opacity: 1; transform: translateY(0); }
.sw-toast.danger { background: var(--red); color: #fff; }

@media (max-width: 900px) {
  #save-widget { bottom: 16px; right: 16px; }
  #sw-panel { width: 260px; }
}

/* === Embedded reflection box === */
.reflect-box {
  background: var(--bg-card, #131a2b);
  border: 1px solid var(--border, #243049);
  border-left: 4px solid var(--accent, #3b82f6);
  border-radius: 12px;
  padding: 24px;
  margin: 20px 0 40px;
}
.reflect-box .form-group:last-of-type { margin-bottom: 16px; }
.rf-saved {
  margin-left: 12px;
  color: #4ade80;
  font-weight: 600;
  font-size: 0.95rem;
}

/* === Essay Builder 5W grid === */
.essay-5w {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}
@media (max-width: 700px) { .essay-5w { grid-template-columns: 1fr; } }
