/* ═══════════════════════════════════════
   CSS VARIABLES
═══════════════════════════════════════ */
:root {
  --primary:    #1e1b4b;
  --primary-lt: #312e81;
  --accent:     #6366f1;
  --accent-lt:  #a5b4fc;
  --red:        #dc2626;
  --bg:         #f5f5f9;
  --surface:    #ffffff;
  --text:       #1a1a2e;
  --muted:      #6b7280;
  --border:     #e5e7eb;
  --radius:     14px;
  --shadow:     0 1px 12px rgba(0,0,0,0.07);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Urbanist', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Urbanist', sans-serif; }
.brand { font-family: 'JetBrains Mono', monospace; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp .32s ease forwards; }

/* ═══════════════════════════════════════
   PROGRAM SELECTOR SCREEN
═══════════════════════════════════════ */
.selector-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.selector-card {
  background: #fff;
  border-radius: 22px;
  padding: 2.4rem 2.2rem;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 28px 70px rgba(0,0,0,.32);
  animation: fadeUp .4s ease;
}

.selector-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--primary-lt));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.1rem;
}

.selector-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: var(--primary);
  margin-bottom: .3rem;
}

.selector-sub {
  text-align: center;
  color: var(--muted);
  font-size: .83rem;
  margin-bottom: 1.8rem;
  line-height: 1.55;
}

/* ── Program cards ── */
.program-grid {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-bottom: 1.4rem;
}

.program-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.program-card:hover {
  border-color: var(--accent);
  background: #f5f3ff;
  transform: translateX(4px);
}
.program-card.selected {
  border-color: var(--accent);
  background: #ede9fe;
}

.program-emoji { font-size: 1.7rem; flex-shrink: 0; }

.program-label {
  font-family: 'Urbanist', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.2;
}

.program-desc {
  font-size: .74rem;
  color: var(--muted);
  margin-top: .2rem;
  line-height: 1.4;
}

/* ── Year pills ── */
.selector-year { margin-bottom: 1.4rem; }

.year-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .55rem;
}

.year-pills {
  display: flex;
  gap: .5rem;
}

.year-pill {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: .55rem;
  font-family: 'Urbanist', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  color: var(--muted);
  cursor: pointer;
  transition: all .16s;
}
.year-pill:hover { border-color: var(--accent); color: var(--accent); }
.year-pill.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ── Enter button with red hover ── */
.btn-enter {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .88rem;
  font-family: 'Urbanist', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background .22s, transform .14s, box-shadow .22s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.btn-enter:hover {
  background: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220,38,38,.35);
}
.btn-enter:active { background: #b91c1c; transform: translateY(0); }

.selector-footer {
  text-align: center;
  font-size: .7rem;
  color: var(--muted);
  margin: 0;
}

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: .9rem 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 20px rgba(0,0,0,.2);
}

.header-logo {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.brand   { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.tagline { font-size: .7rem; opacity: .6; font-family: 'DM Sans', sans-serif; }

.header-search-wrap { position: relative; }

.header-search {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  padding: .48rem 2.6rem .48rem .85rem;
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  width: 230px;
  transition: background .2s, border-color .2s;
}
.header-search::placeholder { color: rgba(255,255,255,.45); }
.header-search:focus {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.5);
  outline: none;
}

.header-search-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: rgba(255,255,255,.7);
  cursor: pointer; font-size: .88rem; transition: color .14s;
}
.header-search-btn:hover { color: #fff; }

.switch-btn {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: 8px;
  padding: .4rem .85rem;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s;
  font-family: 'DM Sans', sans-serif;
}
.switch-btn:hover { background: var(--red); border-color: var(--red); }

/* ═══════════════════════════════════════
   TAB BAR
═══════════════════════════════════════ */
.tab-bar {
  background: var(--primary-lt);
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.tab-btn {
  background: none; border: none;
  color: rgba(255,255,255,.55);
  padding: .78rem 1.2rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600; font-size: .82rem;
  cursor: pointer; position: relative;
  display: flex; align-items: center; gap: .3rem;
  transition: color .15s;
}
.tab-btn::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-lt);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform .2s;
}
.tab-btn:hover { color: rgba(255,255,255,.9); }
.tab-btn.active { color: #fff; }
.tab-btn.active::after { transform: scaleX(1); }

.saved-badge {
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  padding: .07rem .42rem;
  font-size: .63rem;
  font-weight: 800;
  margin-left: .2rem;
}

/* ═══════════════════════════════════════
   PAGE TITLES
═══════════════════════════════════════ */
.page-title { font-family: 'Urbanist', sans-serif; font-size: 1.38rem; font-weight: 700; color: var(--primary); }
.page-sub   { font-size: .82rem; color: var(--muted); }

/* ═══════════════════════════════════════
   COURSE GRID
═══════════════════════════════════════ */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.course-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .14s, box-shadow .14s;
}
.course-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(0,0,0,.1); }

.course-header {
  padding: .85rem 1.2rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background .15s;
}
.course-header:hover { background: #f0f0fa; }

.course-icon {
  width: 10px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
}

.course-name { font-family: 'Urbanist', sans-serif; font-size: .92rem; font-weight: 800; color: var(--text); line-height: 1.25; }
.course-meta { font-size: .68rem; color: var(--muted); font-weight: 600; }
.course-videos { padding: 0 1.2rem 1.2rem; }

/* ── Video row inside course card ── */
.video-row {
  display: flex; gap: .6rem;
  padding: .55rem .45rem; margin: 0 -.45rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer; border-radius: 8px;
  transition: background .12s; align-items: flex-start;
}
.video-row:last-child { border-bottom: none; }
.video-row:hover { background: #f3f4f6; }

.thumb-wrap { position: relative; flex-shrink: 0; }
.thumb { width: 92px; height: 52px; border-radius: 6px; object-fit: cover; background: #e5e7eb; display: block; }

.play-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.3); border-radius: 6px;
  opacity: 0; transition: opacity .14s;
}
.video-row:hover .play-icon { opacity: 1; }
.play-icon i { color: #fff; font-size: 1.3rem; }

.vt {
  font-size: .78rem; font-weight: 600; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vm { font-size: .68rem; color: var(--muted); margin-top: .15rem; display: flex; align-items: center; gap: .3rem; }

.save-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: .18rem; border-radius: 5px; font-size: .82rem;
  flex-shrink: 0; margin-left: auto;
  transition: color .13s, background .13s;
}
.save-btn:hover { color: var(--accent); background: #ede9fe; }
.save-btn.saved { color: var(--accent); }

/* ── Skeleton loaders ── */
.sk-thumb {
  width: 92px; height: 52px; flex-shrink: 0; border-radius: 6px;
  background: linear-gradient(90deg,#f0f0f0 25%,#e8e8e8 50%,#f0f0f0 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
.sk-line {
  height: 9px; border-radius: 5px; margin-bottom: 6px;
  background: linear-gradient(90deg,#f0f0f0 25%,#e8e8e8 50%,#f0f0f0 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ═══════════════════════════════════════
   SEARCH BAR
═══════════════════════════════════════ */
.search-input {
  flex: 1;
  border: 2px solid var(--border); border-radius: 10px;
  padding: .78rem 1rem;
  font-family: 'DM Sans', sans-serif; font-size: .92rem;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.14);
  outline: none;
}

.search-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: .78rem 1.3rem;
  font-family: 'Urbanist', sans-serif; font-weight: 700; font-size: .88rem;
  cursor: pointer; white-space: nowrap; transition: background .2s;
}
.search-btn:hover { background: var(--red); }

/* Quick chips */
.chip {
  border: 1.5px solid var(--accent); color: var(--accent); background: #fff;
  border-radius: 99px; padding: .28rem .88rem; font-size: .76rem; font-weight: 600;
  cursor: pointer; transition: all .14s;
}
.chip:hover { background: var(--accent); color: #fff; }

/* ═══════════════════════════════════════
   VIDEO GRID  (Search + Saved)
═══════════════════════════════════════ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.video-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; cursor: pointer;
  transition: transform .14s, box-shadow .14s;
}
.video-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(0,0,0,.1); }

.card-thumb-wrap { position: relative; }
.card-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #e5e7eb; display: block; }

.card-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); opacity: 0; transition: opacity .14s;
}
.video-card:hover .card-play { opacity: 1; }
.card-play i { color: #fff; font-size: 2rem; }

.card-body-inner { padding: .75rem; }
.ct {
  font-family: 'Urbanist', sans-serif; font-size: .82rem; font-weight: 700;
  line-height: 1.35; color: var(--text); margin-bottom: .35rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cm { font-size: .7rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }

.card-save-btn {
  background: none; border: 1.5px solid var(--border); border-radius: 6px;
  padding: .18rem .55rem; font-size: .68rem; font-weight: 700;
  cursor: pointer; transition: all .13s; color: var(--muted); flex-shrink: 0;
}
.card-save-btn:hover { border-color: var(--accent); color: var(--accent); }
.card-save-btn.saved { background: #ede9fe; border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════
   VIDEO MODAL
═══════════════════════════════════════ */
.modal-content { border-radius: 16px; border: none; box-shadow: 0 24px 60px rgba(0,0,0,.3); }

.modal-video-title {
  font-family: 'Urbanist', sans-serif; font-size: .85rem; font-weight: 700;
  line-height: 1.4; max-width: 88%; margin: 0;
}

.modal-save-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: .35rem .85rem; font-size: .75rem; font-weight: 700; cursor: pointer;
  transition: background .2s; display: flex; align-items: center;
}
.modal-save-btn:hover  { background: var(--red); }
.modal-save-btn.saved  { background: #16a34a; }

.modal-yt-btn {
  background: #ff0000; color: #fff; border-radius: 8px;
  padding: .35rem .85rem; font-size: .75rem; font-weight: 700;
  text-decoration: none; display: flex; align-items: center; transition: background .2s;
}
.modal-yt-btn:hover { background: #cc0000; color: #fff; }

/* ═══════════════════════════════════════
   EMPTY + ERROR STATES
═══════════════════════════════════════ */
.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
}
.empty i { font-size: 2.4rem; opacity: .22; display: block; margin-bottom: .7rem; }
.empty p { font-size: .86rem; line-height: 1.65; }

.err-box {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px;
  padding: 1rem 1.2rem; color: var(--red); font-size: .84rem;
  display: flex; align-items: center; gap: .5rem;
}

/* ═══════════════════════════════════════
   MISC
═══════════════════════════════════════ */
/* ═══════════════════════════════════════
   SORT / FILTER BAR
═══════════════════════════════════════ */
.sort-select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .3rem .65rem; font-size: .78rem; font-weight: 600;
  cursor: pointer; outline: none;
}
.sort-select:focus { border-color: var(--accent); }

.year-chip {
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px;
  padding: .2rem .65rem; font-size: .72rem; font-weight: 700;
  cursor: pointer; transition: all .15s;
}
.year-chip:hover       { border-color: var(--accent); color: var(--accent); }
.year-chip.active      { background: var(--accent); color: #fff; border-color: var(--accent); }

/* offline banner */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
  background: #dc2626; color: #fff; text-align: center;
  font-size: .82rem; font-weight: 700; padding: .45rem;
  display: none;
}
.offline-banner.show { display: block; }

.yt-badge {
  background: #ff0000; color: #fff;
  border-radius: 4px; padding: .07rem .32rem;
  font-size: .6rem; font-weight: 800;
}

@media (max-width: 768px) {
  .header-search { width: 150px; }
  .course-grid   { grid-template-columns: 1fr; }
  .video-grid    { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .video-grid    { grid-template-columns: 1fr; }
  .header-search { display: none; }
}


 