/* ============================================================
   get2learn — Design System & Application Layout
   Dark Theme (Premium Developer Workspace)
   ============================================================ */

/* ── 1. TOKENS ─────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Backgrounds — rich warm-dark neutrals */
  --bg:               #0F1117;
  --bg-2:             #141720;
  --surface:          #1C202C;
  --surface-raised:   #222636;
  --surface-subtle:   #252A38;
  --surface-hover:    #2A3042;
  --surface-glass:    rgba(28, 32, 44, 0.80);

  /* Text */
  --ink:              #F0F2F8;
  --ink-muted:        #9BA3BF;
  --ink-faint:        #5C6580;

  /* Accent — signature emerald green */
  --accent:           #0F8F68;
  --accent-dark:      #0BCC90;
  --accent-tint:      rgba(15, 143, 104, 0.14);
  --accent-glow:      0 0 20px rgba(15, 143, 104, 0.35);

  /* Semantic */
  --success:          #22C55E;
  --success-tint:     rgba(34, 197, 94, 0.12);
  --warning:          #F59E0B;
  --warning-tint:     rgba(245, 158, 11, 0.12);
  --error:            #EF4444;
  --error-tint:       rgba(239, 68, 68, 0.12);
  --info:             #3B82F6;
  --info-tint:        rgba(59, 130, 246, 0.12);

  /* Structural */
  --border:           rgba(255, 255, 255, 0.07);
  --border-strong:    rgba(255, 255, 255, 0.14);
  --shadow-sm:        0 1px 3px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow-md:        0 4px 16px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg:        0 12px 40px rgba(0,0,0,.6), 0 4px 8px rgba(0,0,0,.35);

  /* Radius */
  --radius-sm:        8px;
  --radius-md:        14px;
  --radius-lg:        20px;
  --radius-xl:        28px;
  --radius-full:      999px;

  /* Spacing (4-base scale) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Motion */
  --dur-fast:   120ms;
  --dur-base:   200ms;
  --dur-slow:   320ms;
  --ease:       cubic-bezier(.16, 1, .3, 1);

  /* Legacy compat aliases */
  --green:       var(--accent);
  --green-dark:  var(--accent-dark);
  --coral:       #F97066;
  --amber:       #F59E0B;
  --blue:        #3B82F6;
  --shadow:      var(--shadow-lg);
  --line:        var(--border);
  --muted:       var(--ink-muted);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Helvetica, Arial, sans-serif;
  font-feature-settings: "kern" 1, "liga" 1;
}


/* ── 2. RESET & BASE ────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(15,143,104,0.08) 0%, transparent 60%);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin-top: 0;
  margin-bottom: var(--sp-4);
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── 3. TYPOGRAPHY ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.eyebrow {
  margin: 0 0 var(--sp-1);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── 4. ACCESSIBILITY & FOCUS SYSTEM ────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: 16px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── 5. BUTTONS ─────────────────────────────────────────────── */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 42px;
  padding: 0 var(--sp-5);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-dark);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-tint);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-tint);
}

.button-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 42px;
  padding: 0 var(--sp-5);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
}

.primary-link:hover,
.primary-link:focus-visible {
  background: var(--accent-dark);
}

.link-btn {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ── 6. FORMS ───────────────────────────────────────────────── */
label {
  display: grid;
  gap: var(--sp-1);
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}

input,
select {
  min-height: 42px;
  padding: 0 var(--sp-3);
}

textarea {
  resize: vertical;
  padding: var(--sp-2) var(--sp-3);
  line-height: 1.5;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

/* ── 7. TOPBAR ───────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 60px;
  padding: var(--sp-3) clamp(var(--sp-4), 3vw, var(--sp-8));
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.88);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #0a6f51 100%);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: var(--accent-glow);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.api-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.api-status[data-status="online"],
.api-status[data-status="synced"] {
  border-color: rgba(15, 143, 104, 0.4);
  color: var(--accent-dark);
  background: var(--accent-tint);
}

.api-status[data-status="partial"] {
  border-color: rgba(180, 83, 9, 0.35);
  color: var(--warning);
  background: var(--warning-tint);
}

/* ── 8. NAV RAIL (DESKTOP) ──────────────────────────────────── */
.nav-rail {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-3);
  z-index: 30;
  overflow-y: auto;
}

.nav-rail ul {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 10px var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--dur-fast) var(--ease);
  min-height: 44px;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.nav-item[aria-current="page"],
.nav-item--active {
  color: var(--accent-dark);
  background: var(--accent-tint);
  font-weight: 700;
  border-left: 2px solid var(--accent-dark);
  padding-left: calc(var(--sp-3) - 2px);
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-rail-footer {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.nav-item--add {
  color: var(--accent-dark);
  background: var(--accent-tint);
  font-weight: 700;
}

.nav-item--add:hover {
  background: var(--accent);
  color: #fff;
}

.storage-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--accent-tint);
  border: 1px solid rgba(15, 143, 104, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--accent-dark);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.storage-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-dark);
  box-shadow: 0 0 6px var(--accent-dark);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── 9. APP LAYOUT BODY ─────────────────────────────────────── */
.layout-body {
  margin-left: 220px;
  display: block;
  max-width: 100%;
  padding: var(--sp-6) clamp(var(--sp-5), 3vw, var(--sp-10)) var(--sp-12);
}

.main-content {
  min-width: 0;
}

.page[hidden] {
  display: none !important;
}

.workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  margin: var(--sp-6) 0 var(--sp-4);
}

.section-head p {
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}

.panel-head .panel-close {
  flex-shrink: 0;
}

.metric-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.metric-strip span {
  min-width: 88px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.metric-strip strong {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

/* ── 10. HOME DASHBOARD ─────────────────────────────────────── */
.home-welcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: var(--sp-8) clamp(var(--sp-6), 4vw, var(--sp-10));
  background: linear-gradient(135deg,
    var(--surface) 0%,
    rgba(15, 143, 104, 0.08) 60%,
    var(--surface-raised) 100%
  );
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--sp-8);
  overflow: hidden;
}

.home-welcome::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15,143,104,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.home-welcome__text {
  flex: 1;
  min-width: 0;
}

.home-greeting {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-2);
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-subline {
  color: var(--ink-muted);
  font-size: 1rem;
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

.home-resume-btn {
  flex-shrink: 0;
  min-height: 48px;
  padding: 0 var(--sp-6);
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  box-shadow: var(--accent-glow);
  transition: all var(--dur-base) var(--ease);
}

.home-resume-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(15, 143, 104, 0.5);
}

.home-section {
  margin-bottom: var(--sp-10);
}

/* ── Continue Learning Carousel ──────────────────────────────── */
.continue-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 280px;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-3);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  scroll-snap-type: x mandatory;
}

.continue-carousel::-webkit-scrollbar {
  height: 4px;
}
.continue-carousel::-webkit-scrollbar-track {
  background: transparent;
}
.continue-carousel::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.continue-item {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-fast) var(--ease);
  cursor: pointer;
}

.continue-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.continue-item__thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #0d1520, #1a2d45);
  flex-shrink: 0;
}

.continue-item__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}

.continue-item:hover .continue-item__thumb {
  transform: scale(1.04);
}

.continue-item__dur {
  position: absolute;
  bottom: var(--sp-2);
  right: var(--sp-2);
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.continue-item__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  flex: 1;
}

.continue-item__title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--ink);
}

.continue-item__provider {
  color: var(--ink-faint);
  font-size: 0.78rem;
  margin: 0;
}

/* Per-video progress bar */
.video-progress-bar {
  height: 3px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: auto;
}

.video-progress-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
  transition: width var(--dur-slow) var(--ease);
}

.continue-item__resume-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 40px;
  margin: var(--sp-2) 0 var(--sp-1);
  background: var(--accent);
  color: #fff;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.continue-item__resume-btn:hover {
  background: #0e7a59;
  transform: translateY(-1px);
}

/* Legacy single continue-card (keep for fallback) */
.continue-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--sp-5);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  align-items: center;
}

.continue-card__thumb-wrap {
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(135deg, #0d1520, #1a2d45);
}

.continue-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continue-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.continue-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0;
}

.continue-card__meta {
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin-bottom: 0;
}

.continue-card__actions {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

/* ── Progress Snapshot ───────────────────────────────────────── */
.progress-snapshot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.progress-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

.progress-tile {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-5) var(--sp-5);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease);
  position: relative;
  overflow: hidden;
}

.progress-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-tint) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}

.progress-tile:hover {
  border-color: rgba(15, 143, 104, 0.3);
  transform: translateY(-2px);
}

.progress-tile:hover::before {
  opacity: 1;
}

.progress-tile__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.02em;
  position: relative;
}

.progress-tile__label {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
}

.home-progress-track {
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--surface-subtle);
  margin-top: var(--sp-1);
}

/* ── 11. CONTROL SURFACE & FILTERS ──────────────────────────── */
.control-surface {
  display: grid;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.search-field input {
  min-height: 48px;
  font-size: 0.95rem;
  padding-left: var(--sp-4);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: var(--sp-3);
}

.quick-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.quick-toggles label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 36px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.quick-toggles label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-dark);
}

.quick-toggles input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

/* ── 12. PROGRESS BAND ──────────────────────────────────────── */
.progress-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  margin: var(--sp-5) 0;
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.progress-content {
  display: grid;
  gap: var(--sp-2);
  flex: 1;
  min-width: 200px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.progress-content p {
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

/* ── 13. RECOMMENDATION BAND ────────────────────────────────── */
.recommendation-band {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
  padding: var(--sp-4) 0;
  border-block: 1px solid var(--border);
}

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 260px);
  gap: var(--sp-3);
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.rail-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-height: 96px;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--dur-fast) var(--ease);
}

.rail-card strong {
  font-size: 0.875rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rail-card small {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.rail-card__reason {
  color: var(--accent-dark) !important;
  font-weight: 600;
  font-size: 0.75rem !important;
  display: block;
  margin-top: auto;
}

.rail-card:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

/* ── 14. VIDEO GRID & CARDS ─────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: var(--sp-4);
}

.video-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.video-card:hover {
  box-shadow: var(--shadow-md);
}

.video-card[data-completed="true"] {
  border-color: rgba(15, 143, 104, 0.45);
  background: linear-gradient(180deg, #fff, #F2FBF7);
}

.thumb-link {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #1d2733, #31485f);
  flex-shrink: 0;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-pill {
  position: absolute;
  right: var(--sp-2);
  bottom: var(--sp-2);
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  background: rgba(26, 31, 46, 0.85);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  backdrop-filter: blur(4px);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.topic-pill,
.level-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.topic-pill {
  color: var(--accent-dark);
  background: var(--accent-tint);
}

.level-pill {
  color: var(--warning);
  background: var(--warning-tint);
}

.card-body h3 {
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.description {
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  min-height: 24px;
}

.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-full);
  background: var(--info-tint);
  color: var(--info);
  font-size: 0.72rem;
  font-weight: 700;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-1);
  margin-top: auto;
}

.card-actions button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.card-actions button:hover,
.card-actions button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-tint);
}

.card-actions button[aria-pressed="true"] {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.reaction-button[data-active="true"] {
  border-color: var(--amber);
  color: var(--warning);
  background: var(--warning-tint);
}

.details-button {
  border-color: rgba(37, 99, 235, 0.3) !important;
  color: var(--info) !important;
}

.details-button:hover,
.details-button:focus-visible {
  border-color: var(--info) !important;
  color: #fff !important;
  background: var(--info) !important;
}

/* ── 15. MY LEARNING & TABS ─────────────────────────────────── */
.tab-strip {
  display: flex;
  gap: var(--sp-2);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-6);
}

.tab-btn {
  padding: var(--sp-3) var(--sp-4);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--dur-fast) var(--ease);
}

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

.tab-btn[aria-selected="true"],
.tab-btn--active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.tab-panel[hidden] {
  display: none !important;
}

/* Playlist Cards Grid & Cards */
.playlist-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.playlist-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.playlist-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-2);
}

.playlist-card__header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.playlist-card__count {
  font-size: 0.78rem;
  font-weight: 700;
  padding: var(--sp-1) var(--sp-2);
  background: var(--accent-tint);
  color: var(--accent-dark);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.playlist-card__description {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 0;
}

.playlist-card__meta {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 0;
  font-weight: 500;
}

.playlist-card__bar .progress-track {
  height: 6px;
}

.playlist-card__actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: auto;
}

/* Notes Tab */
.notes-search-label {
  margin-bottom: var(--sp-4);
  max-width: 400px;
}

.note-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-sm);
}

.note-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
}

.note-item__title {
  font-size: 0.95rem;
  font-weight: 700;
}

.note-item__text {
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--surface-subtle);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.note-item__actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

/* ── 16. SIDE PANEL (PLAYLISTS) ─────────────────────────────── */
.side-panel {
  position: sticky;
  top: 80px;
  align-self: start;
  display: grid;
  gap: var(--sp-4);
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  scrollbar-width: thin;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--sp-2);
}

.playlist-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.playlist-tab {
  min-height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.playlist-tab[aria-selected="true"] {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.playlist-tab:hover:not([aria-selected="true"]) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-tint);
}

.playlist-items {
  display: grid;
  gap: var(--sp-2);
  padding-left: 0;
}

.playlist-items li {
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.playlist-item-title {
  display: block;
  margin-bottom: var(--sp-2);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.35;
}

.playlist-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.playlist-item-actions button {
  min-height: 30px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
}

.playlist-item-actions button:hover,
.playlist-item-actions button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-tint);
}

/* ── 17. MOBILE BOTTOM BAR ──────────────────────────────────── */
.bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--sp-2);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.bottom-nav-item[aria-current="page"],
.bottom-nav-item--active {
  color: var(--accent);
  font-weight: 700;
}

.bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav-fab {
  position: relative;
  top: -12px;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}

.fab-icon {
  font-size: 1.5rem;
  color: #fff;
}

/* ── 18. TOAST NOTIFICATIONS ────────────────────────────────── */
.toast-region {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}

.toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--hiding {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}

.toast__message {
  flex: 1;
  line-height: 1.4;
}

.toast__undo {
  color: #6EE7B7;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: underline;
  padding: 2px 6px;
  border-radius: 4px;
}

.toast__undo:hover {
  background: rgba(255, 255, 255, 0.1);
}

.toast__close {
  color: var(--ink-faint);
  font-size: 0.9rem;
  padding: 2px;
}

.toast__close:hover {
  color: #fff;
}

/* ── 19. EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  padding: var(--sp-8) var(--sp-6);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── 20. DIALOGS & DRAWER ────────────────────────────────────── */
.feedback-dialog,
.ingest-dialog,
.video-dialog {
  width: min(580px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.video-dialog {
  width: min(800px, calc(100vw - 28px));
}

.feedback-dialog::backdrop,
.ingest-dialog::backdrop,
.video-dialog::backdrop {
  background: rgba(26, 31, 46, 0.5);
  backdrop-filter: blur(4px);
}

.dialog-card,
.detail-card {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--surface);
}

.detail-card {
  max-height: min(86vh, 900px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.detail-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1d2733, #31485f);
}

.detail-description {
  margin-bottom: 0;
  color: var(--ink-muted);
  line-height: 1.6;
  font-size: 0.9375rem;
}

.detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.detail-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.detail-primary-actions {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-block: 1px solid var(--border);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.detail-actions [aria-pressed="true"] {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.detail-reason {
  font-size: 0.82rem;
  color: var(--accent-dark);
  background: var(--accent-tint);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  font-weight: 600;
}

.storage-notice, .ingest-storage-notice {
  font-size: 0.78rem;
  color: var(--ink-muted);
  background: var(--surface-subtle);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.ingest-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}

.ingest-thumb-preview {
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 240px;
  border: 1px solid var(--border);
}

.field-error {
  color: var(--error);
  font-size: 0.78rem;
  font-weight: 600;
}

.required-mark {
  color: var(--error);
}

.char-count {
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-align: right;
}

/* ── 21. REDUCED MOTION ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 22. RESPONSIVE BREAKPOINTS ─────────────────────────────── */
@media (max-width: 1080px) {
  .nav-rail {
    display: none;
  }

  .layout-body {
    margin-left: 0;
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: fixed;
    inset: auto 12px 12px;
    z-index: 30;
    max-height: 76vh;
    transform: translateY(calc(100% + 24px));
    transition: transform var(--dur-slow) var(--ease);
  }

  .side-panel.is-open {
    transform: translateY(0);
  }

  .bottom-bar {
    display: flex;
  }

  .toast-region {
    bottom: 80px;
  }
}

@media (max-width: 768px) {
  .topbar {
    position: static;
    min-height: 56px;
    padding: var(--sp-3) var(--sp-4);
  }

  .topbar,
  .workspace-head,
  .section-head,
  .progress-band {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions {
    width: 100%;
  }

  .icon-button {
    flex: 1;
    justify-content: center;
  }

  .metric-strip {
    justify-content: stretch;
  }

  .metric-strip span {
    flex: 1 1 88px;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .continue-card {
    grid-template-columns: 1fr;
  }

  .progress-tiles {
    grid-template-columns: 1fr 1fr;
  }

  .home-welcome {
    flex-direction: column;
    align-items: flex-start;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .ingest-grid {
    grid-template-columns: 1fr 1fr;
  }

  .button-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .ingest-grid {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .detail-actions .ghost-button,
  .primary-link {
    width: 100%;
  }

  .video-dialog,
  .ingest-dialog,
  .feedback-dialog {
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: auto 0 0;
  }

  .progress-tiles {
    grid-template-columns: 1fr;
  }
}
