/* By Veda Offline — design system */

:root {
  /* Brand palette — derived from the By Veda logo (dusty mauve circle) */
  --rose:        #C9B3BC;
  --rose-light:  #EAE0E4;
  --rose-dark:   #A89099;
  --rose-subtle: #F5F0F2;

  /* Page chrome */
  --bg:          #FDFAF7;
  --bg-card:     #FFFFFF;
  --video-bg:    #000000;
  --text:        #2A2A2A;
  --text-muted:  #8A8A8A;
  --border:      #EEE6E9;

  /* Semantic status colors */
  --color-success: #27ae60;
  --color-danger:  #c0392b;
  --border-danger: #e0b0aa;
  --color-offline: #f0a500;

  /* Shadows */
  --shadow:       0 2px 12px rgba(169, 144, 153, 0.12);
  --shadow-hover: 0 4px 20px rgba(169, 144, 153, 0.22);

  /* Geometry */
  --radius:      14px;
  --radius-sm:   8px;
  --radius-pill: 999px;

  /* Typography */
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h:     60px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Header ────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 250, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.header-logo img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.header-logo-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.header-nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: background-color 0.2s, color 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
  background: var(--rose-light);
  color: var(--text);
}

.offline-badge {
  display: none;
  font-size: 0.75rem;
  background: var(--color-offline);
  color: white;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}

body.offline .offline-badge { display: block; }

/* ── Layout ────────────────────────────────────────── */

.main { padding: 20px 20px 80px; max-width: 900px; margin: 0 auto; }

/* ── Filters ───────────────────────────────────────── */

.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}
.filter-row::-webkit-scrollbar { display: none; }

.filter-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.chip {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background-color 0.18s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.chip:hover { border-color: var(--rose); color: var(--text); }

.chip.active {
  background: var(--rose);
  border-color: var(--rose);
  color: white;
}


/* ── Lesson grid ───────────────────────────────────── */

.lessons-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.lessons-header .lesson-count { margin-left: auto; }

.lessons-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 400;
}

.lesson-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 600px) {
  .lessons-grid { grid-template-columns: repeat(3, 1fr); }
}

.lesson-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  /* Only transition the two properties that change on hover — cheaper than transition: all */
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  text-decoration: none;
  color: inherit;
  display: block;
}

.lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.lesson-card:active { transform: scale(0.98); }

.lesson-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--rose-light);
  display: block;
}

.lesson-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--rose-light), var(--rose-subtle));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.lesson-body {
  padding: 10px 12px 12px;
}

.lesson-form {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rose-dark);
  font-weight: 500;
  margin-bottom: 3px;
}

.lesson-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 6px;
}

.lesson-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.lesson-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lesson-dosha {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--rose-subtle);
  color: var(--rose-dark);
}

.lesson-offline-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--rose);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 400; margin-bottom: 8px; color: var(--text); }

/* ── Lesson detail ─────────────────────────────────── */

#view-lesson { display: none; }
#view-lesson.active { display: block; }
#view-catalog { display: block; }
#view-catalog.hidden { display: none; }
#view-downloads { display: none; }
#view-downloads.active { display: block; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 20px;
  transition: color 0.2s; /* single property — no need for transition: all */
}
.back-btn:hover { color: var(--text); }

.lesson-detail-video {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--video-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
}

.lesson-detail-video iframe,
.lesson-detail-video video {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.video-offline-msg {
  /* WHY no display:none here: this element is only injected into the DOM when it
     should be visible (see renderLesson() in app.js). No CSS toggle needed. */
  position: absolute;
  inset: 0;
  background: var(--rose-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

.lesson-detail-header {
  margin-bottom: 16px;
}

.lesson-detail-form {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--rose-dark);
  font-weight: 500;
  margin-bottom: 4px;
}

.lesson-detail-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 12px;
}

.lesson-detail-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tag {
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--rose-light);
  color: var(--rose-dark);
}

.lesson-detail-desc {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 24px;
}

.lesson-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background: var(--rose-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 24px;
}

.meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-item-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.meta-item-value { font-size: 0.875rem; font-weight: 500; }

/* ── Download button ───────────────────────────────── */

.download-section {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.download-section-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.quality-picker + .btn { margin-top: 10px; }

.quality-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quality-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.quality-chips {
  display: flex;
  gap: 8px;
}

.quality-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background-color 0.18s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.3;
}

.quality-chip .quality-size {
  font-size: 0.7rem;
  font-weight: 400;
  color: inherit;
  opacity: 0.75;
}

.quality-chip:hover { border-color: var(--rose); color: var(--text); }

.quality-chip.active {
  background: var(--rose-light);
  border-color: var(--rose);
  color: var(--text);
}

.download-saved {
  font-size: 0.875rem;
  color: var(--color-success);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}

.btn-primary {
  background: var(--rose);
  color: white;
}

.btn-primary:hover { background: var(--rose-dark); }

.btn-danger {
  background: var(--rose-subtle);
  color: var(--color-danger);
  border: 1.5px solid var(--border-danger);
}

.btn-cancel {
  background: var(--rose-subtle);
  color: var(--text-muted);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.download-progress {
  display: none;
  flex-direction: column;
  gap: 6px;
}

.download-progress.visible { display: flex; }

.progress-bar {
  height: 4px;
  background: var(--rose-light);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--rose);
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.download-status {
  font-size: 0.8rem;
  text-align: center;
  padding: 4px;
}

.download-status.success { color: var(--color-success); }
.download-status.error   { color: var(--color-danger); }

/* ── Downloads view ────────────────────────────────── */

.downloads-header {
  margin-bottom: 24px;
}

.downloads-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 6px;
}

.downloads-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.storage-info {
  background: var(--rose-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ── About view ────────────────────────────────────── */

#view-about { display: none; }
#view-about.active { display: block; }

.about-header { margin-bottom: 28px; }

.about-tagline {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--rose-dark);
  font-weight: 500;
  margin-bottom: 6px;
}

.about-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 400;
}

.about-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  float: right;
  margin: 4px 0 20px 24px;
  border: 3px solid var(--rose-light);
}

.about-body {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text);
}

.about-body p { margin-bottom: 16px; }

.about-body::after { content: ''; display: table; clear: both; }

.about-quote {
  border-left: 3px solid var(--rose);
  padding: 10px 20px;
  margin: 20px 0;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.65;
}

.about-memorial {
  margin-top: 32px;
  padding: 16px 20px;
  background: var(--rose-subtle);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Loading skeleton ──────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, var(--rose-subtle) 25%, var(--rose-light) 50%, var(--rose-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.skeleton-thumb { aspect-ratio: 16/9; }
.skeleton-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line-sm { height: 10px; width: 40%; }
.skeleton-line { height: 14px; width: 80%; }

/* ── Install prompt ────────────────────────────────── */

.install-banner {
  display: none;
  background: var(--rose);
  color: white;
  padding: 12px 20px;
  text-align: center;
  font-size: 0.875rem;
  cursor: pointer;
  position: sticky;
  bottom: 0;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.install-banner.visible { display: flex; }

.install-banner button {
  background: white;
  color: var(--rose-dark);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.install-banner .dismiss {
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 1.2rem;
  padding: 4px 8px;
}
