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

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e5e8ed;
  --border-hover: #c8cdd6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-bg: #eff6ff;
  --accent-light: #dbeafe;
  --green: #059669;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --nav-h: 60px;
  --transition: 0.18s ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Navbar ────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 18px; height: 18px; stroke: white; }
.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.brand-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.nav-actions { display: flex; gap: 8px; align-items: center; }
.btn-nav {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: var(--transition);
}
.btn-nav svg { width: 14px; height: 14px; }
.btn-nav:hover {
  background: var(--accent-bg);
  border-color: var(--accent-light);
  color: var(--accent);
}

/* ─── Main & Views ──────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}
.view { display: none; }
.view.active { display: block; }

/* ─── Catalog ───────────────────────────────────────────────────────── */
.catalog-header { margin-bottom: 24px; }
.catalog-title-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.course-count-badge {
  display: inline-block;
  padding: 2px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
}

/* Filter tabs */
.filter-tabs { display: flex; gap: 6px; }
.tab {
  padding: 6px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.tab:hover { border-color: var(--accent-light); color: var(--accent); background: var(--accent-bg); }
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Course Grid */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Course Card */
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border-hover);
}
.course-card.skeleton {
  height: 280px;
  background: linear-gradient(90deg, #f0f2f5 25%, #e5e8ed 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  cursor: default;
}
.course-card.skeleton:hover { transform: none; box-shadow: none; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.card-thumb {
  width: 100%; aspect-ratio: 16/9;
  overflow: hidden; background: var(--surface-2);
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s ease;
}
.course-card:hover .card-thumb img { transform: scale(1.03); }
.card-body { padding: 16px; }
.card-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; margin-bottom: 8px;
}
.card-name {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  line-height: 1.4; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-stats {
  display: flex; gap: 12px; margin-bottom: 12px;
}
.card-stat {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.card-stat svg { width: 12px; height: 12px; flex-shrink: 0; }
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.card-price {
  display: flex; align-items: baseline; gap: 6px;
}
.price-final {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
}
.price-mrp {
  font-size: 12px; color: var(--text-muted); text-decoration: line-through;
}
.card-discount {
  padding: 2px 7px;
  background: var(--green-bg); color: var(--green);
  border-radius: 4px; font-size: 11px; font-weight: 600;
}
.btn-card-view {
  padding: 6px 14px;
  background: var(--accent);
  color: white; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  transition: background var(--transition);
}
.btn-card-view:hover { background: var(--accent-hover); }

/* ─── Detail View ───────────────────────────────────────────────────── */
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; margin-bottom: 24px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: var(--transition);
}
.btn-back svg { width: 15px; height: 15px; }
.btn-back:hover { border-color: var(--accent-light); color: var(--accent); background: var(--accent-bg); }

.detail-hero {
  display: flex; gap: 28px; margin-bottom: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
}
.detail-thumb-col { flex-shrink: 0; }
.detail-thumb-col img {
  width: 200px; aspect-ratio: 16/9;
  border-radius: var(--radius); object-fit: cover;
}
.detail-info-col { flex: 1; min-width: 0; }
.detail-badge {
  display: inline-block; padding: 3px 10px; margin-bottom: 10px;
  background: var(--accent-bg); color: var(--accent);
  border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.detail-info-col h2 {
  font-size: 18px; font-weight: 700; line-height: 1.4;
  color: var(--text-primary); margin-bottom: 12px;
}
.detail-stats { display: flex; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.detail-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary);
}
.detail-stat svg { width: 15px; height: 15px; color: var(--accent); }
.detail-stat strong { color: var(--text-primary); font-weight: 600; }
.detail-price { display: flex; align-items: baseline; gap: 8px; }
.detail-price-final {
  font-size: 22px; font-weight: 700; color: var(--text-primary);
}
.detail-price-mrp {
  font-size: 14px; color: var(--text-muted); text-decoration: line-through;
}
.detail-price-disc {
  padding: 2px 8px;
  background: var(--green-bg); color: var(--green);
  border-radius: 4px; font-size: 12px; font-weight: 600;
}

/* Breadcrumb */
.breadcrumb-bar {
  display: flex; align-items: center; margin-bottom: 12px;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
}
.breadcrumb-item { cursor: pointer; color: var(--accent); }
.breadcrumb-item:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-secondary); font-weight: 500; }

/* Content Filter Tabs */
.content-filter-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.ctab {
  padding: 8px 16px;
  border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: var(--transition); margin-bottom: -1px;
}
.ctab:hover { color: var(--text-secondary); }
.ctab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Content List */
.content-list { display: flex; flex-direction: column; gap: 2px; }
.content-loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 48px; color: var(--text-muted);
}

/* Content Row */
.content-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  transition: background var(--transition);
  cursor: pointer;
}
.content-row:hover { background: var(--surface-2); }
.content-row.folder-row { background: var(--surface); border: 1px solid var(--border); margin-bottom: 4px; }
.content-row.folder-row:hover { background: var(--accent-bg); border-color: var(--accent-light); }

.content-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.content-icon.video-icon { background: #fef3c7; }
.content-icon.video-icon svg { width: 18px; height: 18px; color: #d97706; }
.content-icon.pdf-icon { background: #fef2f2; }
.content-icon.pdf-icon svg { width: 18px; height: 18px; color: var(--red); }
.content-icon.folder-icon { background: var(--accent-bg); }
.content-icon.folder-icon svg { width: 18px; height: 18px; color: var(--accent); }

.content-info { flex: 1; min-width: 0; }
.content-name {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.content-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}
.content-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-action {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-secondary);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: var(--transition); white-space: nowrap;
}
.btn-action svg { width: 12px; height: 12px; }
.btn-action.btn-watch {
  background: var(--accent); border-color: var(--accent); color: white;
}
.btn-action.btn-watch:hover { background: var(--accent-hover); }
.btn-action:not(.btn-watch):hover {
  background: var(--surface-2); border-color: var(--border-hover);
}
.content-folder-count {
  font-size: 11px; color: var(--text-muted); flex-shrink: 0;
}

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; display: block; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ─── Modals ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(4px);
}
.modal-overlay.active {
  opacity: 1; pointer-events: all;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.2s ease;
  overflow: hidden;
}
.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}
.video-modal-card { max-width: 880px; }
.pdf-modal-card { max-width: 760px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 500px;
}
.modal-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--surface); color: var(--text-secondary);
  font-size: 12px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: var(--transition);
}
.btn-chip svg { width: 12px; height: 12px; }
.btn-chip:hover { background: var(--accent-bg); border-color: var(--accent-light); color: var(--accent); }
.btn-icon-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: var(--surface); cursor: pointer;
  transition: var(--transition);
}
.btn-icon-close svg { width: 14px; height: 14px; }
.btn-icon-close:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-icon-close:hover svg { stroke: var(--red); }

.modal-body { padding: 0; }

/* Video player */
.video-player-wrap {
  position: relative; background: #000;
  aspect-ratio: 16/9; width: 100%;
}
.video-player-wrap video {
  width: 100%; height: 100%; display: block;
}
.video-overlay-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; background: rgba(0,0,0,0.75);
  color: rgba(255,255,255,0.9);
}
.video-overlay-loading.hidden { display: none; }
.video-overlay-loading p { font-size: 13px; }

/* PDF body */
.pdf-body { max-height: 75vh; overflow: hidden; }
.pdf-body iframe { width: 100%; height: 70vh; border: none; display: block; }
.pdf-fallback {
  padding: 36px; text-align: center; color: var(--text-muted);
}
.pdf-fallback svg { width: 40px; height: 40px; margin: 0 auto 12px; display: block; opacity: 0.3; }
.pdf-fallback p { font-size: 14px; margin-bottom: 16px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px;
  background: var(--accent); color: white;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); }

/* Spinner */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.white {
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main { padding: 20px 16px 48px; }
  .nav-inner { padding: 0 16px; }
  .brand-sub { display: none; }
  .course-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
  .detail-hero { flex-direction: column; gap: 16px; }
  .detail-thumb-col img { width: 100%; }
  .filter-tabs { flex-wrap: wrap; }
  .modal-overlay { padding: 12px; }
  .video-modal-card { max-width: 100%; }
}
@media (max-width: 480px) {
  .course-grid { grid-template-columns: 1fr; }
}
