/* ─── DESIGN TOKENS ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=IBM+Plex+Mono:wght@400;500;600&family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root {
  --ink:      #16150f;
  --paper:    #f5f0e8;
  --rust:     #c94a24;
  --rust-dim: #a33a18;
  --fog:      #e8e0d0;
  --muted:    #7a7260;
  --charcoal: #2b2820;
  --highlight:#f0c87a;
  --r-blob:   60% 40% 30% 70% / 60% 30% 70% 40%;
  --r-card:   3px 18px 4px 14px / 16px 4px 18px 3px;
  --serif:    'DM Serif Display', Georgia, serif;
  --mono:     'IBM Plex Mono', monospace;
  --sans:     'Instrument Sans', sans-serif;
  --shadow-soft:
    0 2px 4px rgba(22,21,15,.06),
    0 8px 24px rgba(22,21,15,.09),
    0 32px 64px rgba(22,21,15,.07);
  --shadow-card:
    2px 4px 0px rgba(22,21,15,.12),
    6px 12px 32px rgba(22,21,15,.10);

  /* ── semantic aliases so every component below just works ── */
  --bg:        var(--paper);
  --surface:   var(--fog);
  --surface2:  #ece5d5;      /* slightly deeper fog for modals */
  --border:    rgba(22,21,15,.08);
  --border2:   rgba(22,21,15,.14);
  --accent:    var(--rust);
  --accent2:   var(--rust-dim);
  --green:     #2e7d5e;
  --amber:     #c47c1a;
  --red:       #b83232;
  --text:      var(--ink);
  --subtle:    var(--fog);
}

/* ─── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── BASE ───────────────────────────────────────────────────── */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); color: var(--charcoal); }

/* ─── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8bfad; border-radius: 999px; }

/* ─── PAPER TEXTURE OVERLAY ──────────────────────────────────── */
/* replaces the dark "noise" overlay with a warm grain that sits
   on top of the cream background without dimming it              */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  opacity: 0.55;
  mix-blend-mode: multiply;
}

.app-wrapper { position: relative; z-index: 1; }

/* ─── ORB / AMBIENT GLOW ─────────────────────────────────────── */
/* warm amber/rust blobs instead of cool purple blobs             */
.orb {
  position: fixed; border-radius: 50%;
  filter: blur(120px); pointer-events: none; z-index: 0;
  opacity: 0.18;
}

/* ─── GLASS / CARD ───────────────────────────────────────────── */
/* "glass" becomes a tactile paper card with organic border-radius */
.glass {
  background: var(--fog);
  border: 1px solid rgba(22,21,15,.12);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}
.glass:hover {
  border-color: rgba(22,21,15,.22);
  box-shadow: var(--shadow-soft);
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(22,21,15,.45);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-box {
  background: var(--surface2);
  border: 1px solid rgba(22,21,15,.15);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  width: 100%; max-width: 480px;
  padding: 32px;
  animation: slideUp 0.2s ease;
}
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ─── INPUT ──────────────────────────────────────────────────── */
.inp {
  width: 100%;
  background: var(--paper);
  border: 1.5px solid rgba(22,21,15,.18);
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 1px 3px rgba(22,21,15,.06);
}
.inp:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(201,74,36,.12), inset 0 1px 3px rgba(22,21,15,.06);
}
.inp::placeholder { color: var(--muted); }
select.inp option  { background: var(--fog); color: var(--ink); }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
  letter-spacing: 0.02em;
}

/* primary — rust fill */
.btn-primary {
  background: var(--rust);
  color: #fff;
  box-shadow: 2px 3px 0 var(--rust-dim);
}
.btn-primary:hover {
  background: var(--rust-dim);
  transform: translateY(-1px);
  box-shadow: 2px 5px 0 #7a2a10, 0 8px 20px rgba(201,74,36,.25);
}

/* ghost — outlined ink */
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid rgba(22,21,15,.18);
}
.btn-ghost:hover {
  color: var(--ink);
  border-color: rgba(22,21,15,.35);
  background: rgba(22,21,15,.04);
}

/* danger — rust tint */
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid rgba(184,50,50,.25);
}
.btn-danger:hover { background: rgba(184,50,50,.08); }

/* ─── PROGRESS BAR ───────────────────────────────────────────── */
.prog-track {
  width: 100%; height: 5px;
  background: rgba(22,21,15,.1);
  border-radius: 999px; overflow: hidden;
}
.prog-fill {
  height: 100%; border-radius: 999px;
  background: var(--rust);
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* ─── TAB PILLS ──────────────────────────────────────────────── */
.tab-pill {
  font-family: var(--sans);
  font-size: 12px; font-weight: 700;
  padding: 6px 14px; border-radius: 6px;
  cursor: pointer; border: none;
  transition: all 0.15s; letter-spacing: 0.03em;
  background: transparent; color: var(--muted);
  text-transform: uppercase;
}
.tab-pill.active {
  background: var(--ink);
  color: var(--paper);
}
.tab-pill:hover:not(.active) { color: var(--ink); }

/* ─── CHECKBOX ───────────────────────────────────────────────── */
.cb-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.cb-wrap input[type=checkbox] {
  appearance: none; width: 17px; height: 17px; flex-shrink: 0;
  border: 2px solid rgba(22,21,15,.25); border-radius: 4px; cursor: pointer;
  transition: all 0.15s; background: var(--paper);
}
.cb-wrap input[type=checkbox]:checked {
  background: var(--rust); border-color: var(--rust);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 70%; background-repeat: no-repeat; background-position: center;
}

/* ─── VIDEO ROW ──────────────────────────────────────────────── */
.video-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 8px;
  transition: background 0.15s;
}
.video-row:hover { background: rgba(22,21,15,.05); }

/* ─── BADGE ──────────────────────────────────────────────────── */
.badge {
  font-family: var(--mono);
  font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: 4px;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--highlight);
  color: var(--charcoal);
  border: 1px solid rgba(22,21,15,.1);
}

/* ─── COURSE CARD ────────────────────────────────────────────── */
.course-card {
  transition: transform 0.2s, box-shadow 0.2s;
  border-radius: var(--r-card);
}
.course-card:hover {
  transform: translateY(-3px) rotate(-0.3deg);
  box-shadow: var(--shadow-soft);
}

/* ─── STAT CARD ──────────────────────────────────────────────── */
.stat-card {
  background: var(--fog);
  border: 1px solid rgba(22,21,15,.1);
  border-radius: var(--r-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-dashed {
  border: 2px dashed rgba(22,21,15,.15);
  border-radius: 12px;
  padding: 60px 20px; text-align: center;
  color: var(--muted);
}

/* ─── SIDE NAV ───────────────────────────────────────────────── */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; color: var(--muted);
  border: none; background: none; width: 100%;
  font-family: var(--sans);
}
.nav-item:hover { color: var(--ink); background: rgba(22,21,15,.06); }
.nav-item.active {
  color: var(--ink);
  background: var(--fog);
  box-shadow: inset 2px 0 0 var(--rust);
}

/* ─── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--charcoal);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: 12px 18px;
  font-size: 13px; font-weight: 600;
  color: var(--paper);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 8px 32px rgba(22,21,15,.35);
  font-family: var(--sans);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}

/* ─── SEARCH ─────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); pointer-events: none;
  color: var(--muted);
}
.search-wrap input { padding-left: 38px; }

/* ─── SECTION LABEL ──────────────────────────────────────────── */
.section-label {
  font-family: var(--mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}
