@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══════════════════════════════════════
   DESIGN TOKENS
   ══════════════════════════════════════ */

:root {
  --background: #ffffff; --foreground: #0a0a0a;
  --card: #ffffff; --card-foreground: #0a0a0a;
  --primary: #171717; --primary-foreground: #fafafa;
  --secondary: #f5f5f5; --secondary-foreground: #171717;
  --muted: #f5f5f5; --muted-foreground: #737373;
  --accent: #f5f5f5; --accent-foreground: #171717;
  --destructive: #ef4444;
  --border: #e5e5e5; --ring: #a3a3a3;
  --radius: 0.625rem;
  --warm-bg: #F5E6D3;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: var(--font); background: #09090b;
  color: var(--foreground); -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   SLIDES (base)
   ══════════════════════════════════════ */

.slide {
  position: absolute; inset: 0;
  display: flex;
  visibility: hidden; opacity: 0;
  background-color: var(--warm-bg);
  background-size: cover; background-position: center;
  transition: opacity 0.4s ease, visibility 0.4s;
}
.slide.active { visibility: visible; opacity: 1; }

/* ══════════════════════════════════════
   BUTTONS (shadcn)
   ══════════════════════════════════════ */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  font-family: var(--font); font-size: 14px; font-weight: 500;
  height: 36px; padding: 8px 16px;
  background: var(--primary); color: var(--primary-foreground);
  border: none; cursor: pointer; user-select: none; transition: background-color 0.15s;
}
.btn:hover { background: rgba(23,23,23,0.9); }
.btn:disabled { pointer-events: none; opacity: 0.5; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  font-family: var(--font); font-size: 14px; font-weight: 500;
  height: 36px; padding: 8px 16px;
  background: transparent; color: var(--foreground); border: none;
  cursor: pointer; user-select: none; transition: background-color 0.15s;
}
.btn-ghost:hover { background: var(--accent); }

/* ══════════════════════════════════════
   CARDS (shadcn)
   ══════════════════════════════════════ */

.card {
  display: flex; flex-direction: column; gap: 10px;
  border-radius: calc(var(--radius) * 1.4);
  border: 1px solid var(--border); background: var(--card);
  padding: 14px 0; color: var(--card-foreground);
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.card-header { display: grid; gap: 4px; padding: 0 24px; }
.card-title { font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.card-content { padding: 0 24px; }
.card-content ul { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.card-content ul li {
  font-size: 19px; line-height: 1.5; color: var(--card-foreground);
  padding-left: 22px; position: relative;
}
.card-content ul li::before {
  content: ""; position: absolute; left: 0; top: 12px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
}
.card.warn .card-content ul li { padding-left: 30px; }
.card.warn .card-content ul li::before {
  content: "⚠️"; background: none; width: auto; height: auto; border-radius: 0; top: 50%; transform: translateY(-50%); font-size: 20px;
}

/* ══════════════════════════════════════
   BADGES
   ══════════════════════════════════════ */

/* Cover-slide badges */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; border: 1px solid transparent;
  padding: 8px 14px; font-size: 18px; font-weight: 600;
  background: var(--primary); color: var(--primary-foreground);
}
.badge-outline {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; border: 1px solid var(--border);
  padding: 8px 14px; font-size: 18px; font-weight: 600;
  background: var(--card); color: var(--foreground);
}
.badges { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.badge-draft {
  position: fixed; top: 18px; right: 24px;
  padding: 6px 16px; font-size: 14px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  background: var(--destructive); color: #fff;
  border-radius: 6px; z-index: 100;
}

/* Shared header-badge base — fixed height so all badges render identically */
.module-badge, .type-badge, .sws-badge {
  display: inline-flex; align-items: center;
  border-radius: 9999px;
  font-size: 13px; font-weight: 600;
  white-space: nowrap; letter-spacing: 0.02em;
  height: 24px; line-height: 1;
}

/* Module badge */
.module-badge { padding: 0 14px; }

/* Slide-type badges */
.type-badge { padding: 0 12px; }
.type-exercise { background: #dbeafe; color: #1e40af; }
.type-demo { background: #dcfce7; color: #166534; }
.type-industry { background: #fef3c7; color: #92400e; }
.type-mistake { background: #fee2e2; color: #991b1b; }
.type-takeaway { background: #f3e8ff; color: #6b21a8; }
.type-important { background: #dc2626; color: #fff; }

/* Credit/hours badge (e.g. SWS) — inherits sizing from shared base above */
.sws-badge { padding: 0 12px; background: #e23c58; color: #fff; font-weight: 400; }

/* "2 SWS only" filter in All Slides view: hide non-SWS rows; hide cards left empty
   (!important is needed because rows carry inline display:grid on their style attribute) */
#toc-slides.sws-filtered .toc-slide-row[data-sws="no"] { display: none !important; }
#toc-slides.sws-filtered .card-toc:not(:has(.toc-slide-row[data-sws="yes"])):not(:has(.toc-slide-row[data-sws="title"])) { display: none !important; }

/* ══════════════════════════════════════
   CODE BLOCKS
   ══════════════════════════════════════ */

.card-code { padding: 0 24px; }
.card-code pre {
  background: #1e1e1e; color: #d4d4d4;
  border-radius: var(--radius);
  padding: 14px 18px; font-size: 16px; line-height: 1.5;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-variant-ligatures: none;
  overflow-x: auto;
}
.card-code pre .kw { color: #569cd6; }
.card-code pre .str { color: #ce9178; }
.card-code pre .cmt { color: #6a9955; }
.card-code pre .fn { color: #dcdcaa; }

/* ══════════════════════════════════════
   TABLES
   ══════════════════════════════════════ */

.card-table { padding: 0 24px; }
.card-table table { width: 100%; border-collapse: collapse; font-size: 17px; }
.card-table th {
  text-align: left; font-weight: 600; padding: 7px 12px;
  border-bottom: 2px solid var(--border);
}
.card-table td {
  padding: 7px 12px; border-bottom: 1px solid var(--border);
}
.card-table tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════
   QUOTES
   ══════════════════════════════════════ */

.card-quote-card { background: var(--secondary); border: 1px solid var(--border); }
.quote {
  font-size: 19px; line-height: 1.5; font-weight: 500;
  color: var(--foreground); font-style: italic;
}
.quote-src { font-size: 14px; color: var(--muted-foreground); margin-top: 4px; }

/* ══════════════════════════════════════
   TABLE OF CONTENTS
   ══════════════════════════════════════ */

.card-toc { padding: 12px 0; gap: 0; }
.toc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 24px; font-size: 17px;
  border-bottom: 1px solid var(--border);
}
.toc-row:last-child { border-bottom: none; }
.toc-slide-row { border-bottom: 1px solid var(--border); }
.toc-slide-row:last-child { border-bottom: none; }
.toc-row[onclick]:hover { background: var(--accent); border-radius: 6px; }
.toc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.toc-label { font-weight: 700; font-size: 13px; min-width: 72px; flex-shrink: 0; letter-spacing: 0.02em; }
.toc-title { font-weight: 600; color: var(--foreground); min-width: 360px; flex-shrink: 0; }
.toc-topics { color: var(--muted-foreground); font-size: 15px; }

/* ══════════════════════════════════════
   RESOURCE LINKS
   ══════════════════════════════════════ */

.card-resource { background: #f0fdf4; border: 1px solid #bbf7d0; }
.resource-link {
  display: inline-block; font-size: 16px; font-weight: 500;
  color: #2563eb; text-decoration: none;
  padding: 4px 12px; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: calc(var(--radius) - 2px); transition: background 0.15s;
}
.resource-link:hover { background: #dbeafe; text-decoration: underline; }

/* ══════════════════════════════════════
   COVER SLIDE LAYOUT
   ══════════════════════════════════════ */

.slide-cover { align-items: center; justify-content: center; flex-direction: row; gap: 32px; }

.cover-card {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  border-radius: calc(var(--radius) * 1.4);
  border: 1px solid var(--border); background: var(--card);
  padding: 80px 80px; color: var(--card-foreground);
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  max-width: 1200px; width: 85vw; text-align: center; flex-shrink: 1;
}
.cover-card h1 {
  font-size: clamp(40px, 5vw, 60px); font-weight: 700;
  line-height: 1.1; letter-spacing: -0.025em;
}
.cover-card p.lead {
  font-size: clamp(24px, 3vw, 36px); font-weight: 400;
  color: var(--muted-foreground); margin-top: -12px;
}
.cover-card p.sub { font-size: 20px; color: var(--muted-foreground); }

/* Cover slide with contents: side-by-side layout */
.slide-cover:has(.cover-contents) {
  gap: 24px;
}

/* Cover slide contents listing (module agenda) */
.cover-contents {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  padding: 16px 20px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 530px;
  flex-shrink: 0;
}
.cover-contents::-webkit-scrollbar { width: 4px; }
.cover-contents::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ══════════════════════════════════════
   CONTENT SLIDE LAYOUT
   ══════════════════════════════════════ */

.slide-content {
  flex-direction: column; padding: 20px 36px 48px; gap: 14px;
}

.slide-header {
  background: var(--card); border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  padding: 10px 24px;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  z-index: 2;
}
.header-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.header-badges {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0; padding-top: 4px;
}
.slide-title {
  font-size: clamp(28px, 3.5vw, 40px); font-weight: 700;
  letter-spacing: -0.025em;
}
.slide-desc { font-size: 17px; color: var(--muted-foreground); margin-top: 2px; }

.cols {
  display: flex; flex-direction: column; gap: 10px; z-index: 2;
}

/* Layout: left (default) */
.layout-left { align-items: flex-start; }
.layout-left .slide-header,
.layout-left .cols { width: 85vw; max-width: 1200px; }

/* Layout: center */
.layout-center { align-items: center; }
.layout-center .slide-header,
.layout-center .cols { width: 70vw; max-width: 900px; }
.layout-center .slide-header { text-align: center; }
.layout-center .header-row { flex-direction: column; align-items: center; }
.layout-center .header-badges { padding-top: 0; }

/* Exercise overlay */
.slide-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.12); z-index: 1;
}
.slide-overlay ~ .cols .card { border-left: 3px solid #3b82f6; }

/* ══════════════════════════════════════
   NAVIGATION BAR
   ══════════════════════════════════════ */

#nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 52px;
  background: #171717; border-top: 1px solid #262626;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  z-index: 1000; transition: opacity 0.3s;
}
#nav.hidden { opacity: 0; pointer-events: none; }
#nav .btn { background: #fafafa; color: #171717; font-size: 13px; height: 32px; padding: 6px 14px; }
#nav .btn:hover { background: #e5e5e5; }
#nav .btn:disabled { opacity: 0.4; }
#nav .btn-ghost { color: #a3a3a3; font-size: 13px; height: 32px; padding: 6px 14px; }
#nav .btn-ghost:hover { background: #262626; color: #fafafa; }
#counter { color: #a3a3a3; font-size: 13px; font-weight: 500; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-hint { position: absolute; left: 16px; color: #525252; font-size: 11px; }
.nav-fs { position: absolute; right: 12px; }

/* ══════════════════════════════════════
   PROGRESS BAR & CLICK ZONES
   ══════════════════════════════════════ */

#progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--primary); z-index: 1001; transition: width 0.35s cubic-bezier(0.4,0,0.2,1); }
.zone { position: absolute; top: 0; width: 18%; height: calc(100% - 52px); z-index: 1; cursor: pointer; }
.zone-l { left: 0; } .zone-r { right: 0; }
