/* =========================
   GLOBAL
   ========================= */
body {
  background: #111;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  --accent-yellow: #F7CF39;
}

/* =========================
   TOPBAR
   ========================= */
.topbar {
  width: min(100%, 1380px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 1.5rem 1rem;
  margin-top: 12px;
  margin-bottom: 1.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-circle {
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: #facc15;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand-text h1 {
  font-size: 1.5rem;
  margin: 0;
  line-height: 1.1;
}

.brand-text .tagline {
  margin: 0.1rem;
  line-height: 1;
  font-size: 0.8rem;
  opacity: 0.7;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.parent-btn {
  background: #333;
  color: #fff;
  border: 1px solid #444;
  border-radius: 0.5rem;
  padding: 0.25rem 0.9rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.parent-btn.unlocked {
  background: #facc15;
  color: #111;
  border-color: #facc15;
}

/* =========================
   APP SHELL
   ========================= */
.app-shell {
  width: min(100%, 1380px);
  display: flex;
  gap: 1rem;
  position: relative;
}

/* left side */
.player-area {
  flex: 1 1 auto;
  min-width: 0;
}

/* =========================
   PLAYER
   ========================= */
.player-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

/* fallback for older browsers */
.player-wrapper::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}

.player-wrapper #player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.status-bar {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #bbbbbb;
}

/* =========================
   CONTROLS
   ========================= */
.controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.8rem;
}

.nav-btn {
  border: 1px solid #333;
  background: #1a1a1a;
  color: #fff;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
}

.nav-btn.primary {
  background: #facc15;
  border-color: #facc15;
  color: #111;
}

/* =========================
   VIDEO LIST (PILLS)
   ========================= */
#videoList {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media (min-width: 980px) {
  #videoList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.video-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: #121212;
  border-radius: 18px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
  border: 1px solid transparent;
  width: 100%;
  box-sizing: border-box;
}

.video-row:hover {
  background: #333333;
}

.video-row.active {
  background: #262310;
  border-color: #facc15;
}

.video-row.watched { opacity: 0.6; }
.video-watched-badge {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.9;
}

.video-thumb {
  width: 45px;
  height: 26px;
  border-radius: 6px;
  background: #000;
  object-fit: cover;
  flex: 0 0 auto;
}

.video-info {
  flex: 1 1 auto;
  min-width: 0;
}

.video-title {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-meta {
  font-size: 0.65rem;
  color: #aaa;
}

/* =========================
   PLAYLIST PANEL (ONE ELEMENT)
   ========================= */
.playlist-panel {
  flex: 0 0 360px;
  width: 360px;
  background: #181818;
  border-left: 1px solid #333;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  transition: width 0.22s ease-out, flex-basis 0.22s ease-out;
  position: relative;
}

.playlist-panel-top {
  position: relative;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 0.45rem 0 0.45rem;
  background: #181818;
  z-index: 3;
}

.playlist-panel-toggle {
  position: absolute;
  top: 6px;
  left: 6px;
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  z-index: 4;
}

.playlist-panel-title {
  margin-left: 40px;
  font-size: 0.8rem;
  white-space: nowrap;
  color: #fff;
  transition: all 0.2s ease-out;
}

.playlist-panel-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* COLLAPSED */
.playlist-panel.collapsed {
  flex: 0 0 46px;
  width: 46px;
}
.playlist-panel.collapsed .playlist-panel-body { display: none; }
.playlist-panel.collapsed .playlist-panel-title {
  position: absolute;
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.25rem;
  color: #808080;
  margin-left: 0;
  white-space: nowrap;
}

/* =========================
   PLAYLIST PANEL CONTENT
   ========================= */
.playlist-search {
  width: 90%;
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  color: #fff;
  font-size: 0.75rem;
  margin: 0.35rem 0.6rem;
}

.playlist-panel .filters {
  display: flex;
  gap: 0.4rem;
  padding: 0 0.6rem 0.4rem;
}

.playlist-panel .filters select {
  background: #111;
  color: #fff;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 0.7rem;
  padding: 0.2rem;
}

/* header now has fav column */
.playlist-header {
  display: grid;
  grid-template-columns: 28px 2fr 45px 90px 50px; /* Fav | Title | Rating | Category | Lang */
  padding: 0.35rem 0.6rem;
  font-size: 0.65rem;
  color: #aaa;
  border-bottom: 1px solid #222;
  background: #181818;
  position: sticky;
  top: 0;
  z-index: 2;
}
.playlist-header [data-sort]::after { content: ""; margin-left: 4px; }
.playlist-header [data-sort].sort-asc::after { content: "▲"; font-size: 0.55rem; color: #aaa; }
.playlist-header [data-sort].sort-desc::after { content: "▼"; font-size: 0.55rem; color: #aaa; }

/* header fav filter button */
.fav-header { display: flex; align-items: center; justify-content: center; }
.fav-filter-heart {
  background: transparent;
  border: none;
  color: #bbb;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.6;
}
.fav-filter-heart.on {
  color: #f43f5e;
  opacity: 1;
}

.fav-filter-lock {
  background: transparent;
  border: none;
  color: #bbb;
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* visible only when heart is ON */
.fav-filter-heart.on + .fav-filter-lock {
  opacity: 0.75;
  pointer-events: auto;
}

/* locked state feedback: tint heart + lock */
.fav-locked .fav-filter-heart {
  color: #ef4444;
}

.fav-locked .fav-filter-lock {
  color: #ef4444;
  opacity: 1;
}

/* table body */
.playlist-list { display: flex; flex-direction: column; font-size: 0.65rem; }

.playlist-list-item {
  display: grid;
  grid-template-columns: 28px 2fr 45px 90px 50px; /* Fav | Title | Rating | Category | Lang */
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.12s ease;
}
.playlist-list-item:hover { background: rgba(255, 255, 255, 0.05); }
.playlist-list-item.active {
  background: rgba(47, 116, 255, 0.15);
  border-left: 3px solid #2f74ff;
}

/* cells */
.pl-fav { text-align: center; }
.pl-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff;
  font-size: 0.65rem;
  display: block;
}
.pl-rating { text-align: center; color: gold; font-size: 0.6rem; }
.pl-category, .pl-language { text-align: center; color: #ddd; font-size: 0.6rem; }

/* row hearts */
.pl-fav-heart { opacity: 0.25; cursor: pointer; font-size: 0.8rem; user-select: none; }
.pl-fav-heart.on { opacity: 1; color: #f43f5e; }

/* collapsed tweaks */
.playlist-panel.collapsed .playlist-panel-top { height: 90px !important; }
.playlist-panel.collapsed .playlist-panel-title {
  top: 46px !important;
  left: 50%;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.25rem;
  color: #808080;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .app-shell { flex-direction: column; width: 100%; }
  .controls { width: 100%; justify-content: center; }
  .playlist-panel {
    position: fixed; right: 0; top: 4.5rem;
    height: calc(100vh - 5rem); z-index: 99;
  }
  .playlist-panel.collapsed { width: 46px; flex: 0 0 46px; }
}

/* ============= MODALS ============= */
.yl-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 200; }
.yl-modal.hidden { display: none; }
.yl-modal-content { background: #181818; border: 1px solid #333; border-radius: 14px; padding: 1rem 1.25rem 1.5rem; min-width: 320px; max-width: 720px; max-height: 90vh; overflow-y: auto; }
.yl-modal-content.wide { min-width: 720px; }
.yl-modal-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.yl-modal-close { background: transparent; border: none; color: #aaa; font-size: 1.5rem; cursor: pointer; }
.yl-input { width: 100%; background: #111; border: 1px solid #333; border-radius: 6px; padding: 0.4rem 0.5rem; color: #fff; margin-bottom: 0.75rem; }
.yl-button { background: #333; border: 1px solid #444; color: #fff; border-radius: 8px; padding: 0.35rem 0.8rem; cursor: pointer; }
.yl-button.primary { background: #facc15; border-color: #facc15; color: #111; }
.yl-button.danger { background: #b91c1c; border-color: #b91c1c; }
.yl-button.small { font-size: 0.75rem; padding: 0.25rem 0.7rem; }

/* parent button gear */
.parent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  gap: 0.3rem;
  height: 36px;              /* lock the height (adjust to your original size) */
  line-height: 1;            /* remove vertical stretch */
}

.parent-btn .parent-gear {
  margin-left: 0.1rem;
  font-size: 1.3rem;         /* visually fills more space */
  line-height: 0;            /* prevents button from growing taller */
  vertical-align: middle;
  display: inline-block;
}

/* parent modal layout */
.parent-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.parent-section h3 {
  margin-top: 0;
}

/* Daily activity – calendar + detail */
.activity-days {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.activity-calendar {
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 0.75rem;
  min-width: 240px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.calendar-month-label {
  font-weight: 600;
}

.calendar-nav-btn {
  background: transparent;
  border: 1px solid #333;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  color: #eee;
  cursor: pointer;
  font-size: 0.8rem;
}

.calendar-nav-btn:hover {
  background: #222;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  font-size: 0.7rem;
}

.calendar-day-name {
  text-align: center;
  opacity: 0.6;
}

.calendar-cell {
  border: 1px solid #222;
  background: #111;
  border-radius: 999px;
  padding: 0.25rem 0;
  text-align: center;
  cursor: pointer;
}

.calendar-cell--empty {
  border: none;
  background: transparent;
  cursor: default;
}

.calendar-cell--has-activity {
  border-color: rgba(34, 197, 94, 0.8);      /* green outline */
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6);
}

.calendar-cell--selected {
  background: rgba(34, 197, 94, 0.25);
}

.calendar-cell:disabled {
  opacity: 0.3;
  cursor: default;
}

/* right-hand detail panel */
.activity-detail {
  flex: 1;
  min-width: 220px;
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 0.75rem;
}

.activity-detail h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.activity-detail-list {
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.activity-detail-item {
  background: #0b0b0b;
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  border: 1px solid #222;
}

@media (max-width: 640px) {
  .activity-days {
    flex-direction: column;
  }
}

/* favorites list in parent modal */
.parent-favorites { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.parent-favorites li { background: #111; border: 1px solid #222; border-radius: 6px; padding: 0.3rem 0.4rem; font-size: 0.75rem; }

/* Donate / About call-to-action buttons */
.yl-donate-trigger,
.yl-about-trigger {
  padding: 8px 14px;
  border-radius: 999px;
  border: 0;
  background: var(--accent, #1d3f89);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.yl-donate-trigger:hover,
.yl-about-trigger:hover {
  opacity: 0.92;
}

/* About modal link color */
#aboutModal a {
  color: var(--accent-yellow);
  font-weight: 600;
  text-decoration: underline; /* optional */
}

#aboutModal a:hover {
  opacity: 0.85;
}

.yl-footer { color:#cdd2e1; padding:20px 16px; margin-top:40px; }
.yl-footer .footer-wrap { max-width:1100px; margin:0 auto; display:flex; gap:24px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.footer-brand .brand { font-weight:800; font-size:18px; color:#fff; }
.footer-brand .tagline { font-size:13px; opacity:0.8; }
.footer-links { display:flex; gap:16px; }
.footer-link { color:#cdd2e1; text-decoration:none; font-size:14px; }
.footer-link:hover { text-decoration:underline; }

.yl-donate-modal[aria-hidden="true"] { display:none; }
.yl-donate-modal { position:fixed; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; z-index:9999; }
.yl-donate-card { width:min(520px, 92vw); background:#fff; color:#111; border-radius:18px; padding:22px 20px 26px; box-shadow:0 10px 30px rgba(0,0,0,.25); position:relative; }
.yl-donate-card h2 { margin:2px 0 10px; font-size:20px; }
.yl-donate-close { position:absolute; right:12px; top:10px; background:transparent; border:0; font-size:22px; cursor:pointer; }

.yl-donate-toggle { display:flex; justify-content:center; margin:12px 0 10px; }
.toggle { display:inline-flex; align-items:center; gap:10px; }
.toggle .track { width:60px; height:30px; border-radius:999px; background:#e5e7eb; display:inline-block; position:relative; }
.toggle .thumb { width:26px; height:26px; border-radius:50%; background:#111; position:absolute; top:2px; left:2px; transition:left .18s ease; }
#donate-monthly-toggle:checked + .track .thumb { left:32px; }
.toggle .label { display:flex; gap:8px; font-size:12px; color:#555; }
.yl-donate-toggle .label-left,
.yl-donate-toggle .label-right { font-weight: 600; user-select: none; }
.toggle input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }

.yl-amounts { display:flex; gap:10px; flex-wrap:wrap; margin:12px 0 10px; }
.yl-amounts .amt { padding:8px 12px; border-radius:10px; border:1px solid #d0d7e2; background:#f9fafb; cursor:pointer; }
.yl-amounts .amt.active { background:#111; color:#fff; border-color:#111; }
.custom-amt { display:flex; align-items:center; gap:8px; }
.custom-amt input { width:110px; padding:7px 8px; border-radius:8px; border:1px solid #d0d7e2; }

.yl-monthly-note { font-size:14px; color:#333; margin:8px 0 6px; }
.yl-legal-note { font-size:12px; color:#666; margin-top:10px; }


/* ===== Favorites header column: exact sizing & alignment ===== */
.playlist-header {
  align-items: center;
  height: 34px;            /* consistent header height */
  line-height: 1;
}

/* Increase first column width to fit heart+lock without invading Title */
.playlist-header,
.playlist-list .playlist-list-item {
  /* Fav | Title | Rating | Category | Lang */
  grid-template-columns: 40px 2fr 45px 90px 50px !important;
}

/* Header cell with heart+lock */
.fav-header {
  width: 40px;             /* match column width */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;                /* small gap so they look “together” */
}

/* Icon buttons: small, uniform, centered */
.fav-filter-heart,
.fav-filter-lock {
  background: transparent;
  border: none;
  font-size: 14px;         /* smaller icon size */
  line-height: 1;
  padding: 0;
  margin: 0;
  width: 14px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  vertical-align: middle;
}

/* Heart visuals */
.fav-filter-heart { color: #bdbdbd; opacity: 0.7; }
.fav-filter-heart.on { color: #f43f5e; opacity: 1; }

/* Lock visibility logic (hidden unless heart is on or state is locked) */
.fav-filter-lock { opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
.fav-filter-heart.on + .fav-filter-lock,
.fav-locked .fav-filter-lock { opacity: 0.85; pointer-events: auto; }

/* Locked tint */
.fav-locked .fav-filter-heart,
.fav-locked .fav-filter-lock { color: #ef4444; }

/* Body rows: ensure the first column lines up perfectly with header */
.playlist-list-item { align-items: center; }
.pl-fav { text-align: center; }
.pl-fav-heart {
  font-size: 14px;         /* match header icon size */
  line-height: 1;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
}
.pl-fav-heart.on { opacity: 1; color: #f43f5e; }

/* Keep the hamburger fixed-size at the top-right of the playlist panel */
.playlist-panel-top {
  position: relative;          /* ensure absolute child anchors here */
  height: 42px;                /* consistent top bar height */
}

.playlist-panel-toggle {
  position: absolute;
  top: 6px;
  right: 6px;                  /* anchor to right edge — same screen spot */
  left: auto !important;       /* prevent any left anchoring from older rules */
  width: 32px;
  height: 28px;
  padding: 0;                  /* stop stretching */
  display: inline-flex;        /* exact size, no grow */
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  white-space: nowrap;         /* keep ☰ on one line */
}

/* Make sure it NEVER stretches due to flexbox */
.playlist-panel-top > .playlist-panel-toggle {
  flex: 0 0 auto !important;
}

/* When collapsed, don’t let the taller header push the button down */
.playlist-panel.collapsed .playlist-panel-top {
  height: 42px !important;
}

/* Ensure the "Playlists" title doesn't collide with the button */
.playlist-panel-title {
  margin-left: 10px;
  padding-right: 42px;         /* reserve a bit of space for the button */
}

/* Collapsed title: perfectly centered, upright, no animation */
.playlist-panel.collapsed .playlist-panel-title {
  position: absolute;
  top: 172px;
  left: 50%;
 /* transform: translate(-50%, -50%);   /* no rotation */
  transform: translateX(-50%);
  writing-mode: vertical-rl;          /* vertical flow */
  text-transform: uppercase;
  letter-spacing: 0.25rem;
  color: #808080;
  margin: 20px;
  white-space: nowrap;
  font-size: 0.75rem;
  text-align: center;
}

/* Donate modal bullet list */
.yl-donate-points {
  margin: 0 0 14px 0;
  padding-left: 1.2rem;
  color: #333;
  font-size: 15px;
  line-height: 1.45;
}

.yl-donate-points li {
  margin-bottom: 6px;
}

.yl-donate-card h2 {
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 20px;
  color: #111;
}
