/* BNI Podcast Tiếng Việt — giao diện kiểu trình phát nhạc (tối, tím than) */
:root {
  --bg: #ffffff;
  --bg-2: #ffffff;
  --card: #f5f5f7;
  --card-hover: #ececf0;
  --line: #e4e4e8;
  --text: #1d1d1f;
  --muted: #6e6e76;
  --accent: #cf2030;
  --accent-2: #b0141f;
  --accent-soft: #fdecee;
  --bar: #ffffff;
  --radius: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 "Be Vietnam Pro", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: 104px;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
header.top { padding: 28px 0 8px; display: flex; align-items: center; gap: 14px; }
.logo { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
header.top h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }
header.top p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* thanh công cụ */
.tools { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 0; }
.searchbox { position: relative; }
.searchbox .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbox input {
  width: 100%; height: 46px; padding: 0 16px 0 44px; font: inherit; font-size: 15px;
  background: var(--card); color: var(--text); border: 1px solid transparent; border-radius: 999px; outline: none;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.searchbox input::placeholder { color: var(--muted); }
.searchbox input:focus { border-color: var(--accent); background: var(--card-hover); }
.row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.select {
  height: 40px; padding: 0 34px 0 14px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a59fb4' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: 999px; appearance: none; cursor: pointer; max-width: 100%;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background .2s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--card-hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .4; cursor: default; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; transition: all .2s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* danh sách tập */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; padding: 10px;
  border-radius: 10px; text-decoration: none; cursor: pointer; transition: background .15s var(--ease);
}
.item:hover { background: var(--card); }
.item.playing { background: var(--accent-soft); }
.tile {
  width: 52px; height: 52px; border-radius: 8px; display: grid; place-items: center; text-align: center;
  font-weight: 700; font-size: 15px; line-height: 1; color: #fff; position: relative; overflow: hidden;
}
.tile small { display: block; font-size: 9px; font-weight: 500; opacity: .8; margin-bottom: 3px; letter-spacing: .04em; }
.item .vi { font-weight: 600; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .en { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; margin-top: 3px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.tag .icon { width: 12px; height: 12px; }
mark { background: #ffe1e4; color: inherit; border-radius: 3px; padding: 0 1px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.pager { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 22px 0 6px; }
.pager button { min-width: 40px; height: 40px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.pager button.on { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.pager button:disabled { opacity: .35; cursor: default; }
.pager span { color: var(--muted); }
footer { color: var(--muted); font-size: 12px; padding: 30px 0 20px; border-top: 1px solid var(--line); margin-top: 30px; }

/* trang chi tiết tập */
.back { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; color: var(--muted); text-decoration: none; cursor: pointer; background: none; border: 0; padding: 6px 0; font-size: 14px; }
.back:hover { color: var(--text); }
.ep-head { display: grid; grid-template-columns: 140px 1fr; gap: 22px; align-items: center; margin: 18px 0 8px; }
.ep-head .tile { width: 140px; height: 140px; border-radius: 16px; font-size: 34px; }
.ep-head .tile small { font-size: 12px; }
.ep-head h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.25; letter-spacing: -.01em; }
.ep-head .sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.ep-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.orig { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin: 18px 0 6px; }
.orig h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.orig audio { width: 100%; height: 36px; }
.tabs { display: flex; gap: 6px; margin: 22px 0 10px; }
.tabs button { height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.text p { margin: 0 0 12px; }
.text h2 { font-size: 18px; margin: 26px 0 12px; }
.seg { margin: 0 0 14px; line-height: 1.7; }
.seg b { color: var(--accent-2); font-weight: 600; }
.seg .en { color: var(--muted); font-size: 14px; margin-top: 4px; }
.note { background: var(--accent-soft); padding: 12px 14px; border-radius: var(--radius); font-size: 14px; }

/* thanh phát nhạc */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 90px; padding: 0 20px;
  background: var(--bar); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(0,0,0,.06);
  display: grid; grid-template-columns: minmax(0, 30%) 1fr minmax(0, 30%); align-items: center; gap: 16px;
  transform: translateY(100%); transition: transform .3s var(--ease);
}
.player.show { transform: none; }
.np { display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.np .tile { width: 56px; height: 56px; }
.np-text { min-width: 0; }
.np-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.ctrls { display: flex; align-items: center; gap: 10px; }
.ib {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--text);
  display: grid; place-items: center; cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.ib:hover { background: var(--card); }
.ib.on { color: var(--accent-2); }
.ib[disabled] { opacity: .35; cursor: default; }
.ib.play { width: 48px; height: 48px; background: var(--accent); color: #fff; }
.ib.play:hover { background: var(--accent-2); color: #fff; }
.ib.play .icon { width: 22px; height: 22px; }
.ib.speed { width: auto; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.prog { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.range { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 4px; background: var(--line); cursor: pointer; outline-offset: 6px; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 0; opacity: 0; transition: opacity .15s; }
.range:hover::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { opacity: 1; }
.range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 0; }
.right { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.right .range { max-width: 90px; }

/* bảng danh sách phát */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; width: min(420px, 100%);
  background: var(--bg-2); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s var(--ease);
}
.drawer.show { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px; }
.drawer-head h2 { margin: 0; font-size: 18px; flex: 1; }
.drawer-tabs { display: flex; gap: 6px; padding: 0 16px 10px; }
.drawer-tabs button { flex: 1; height: 36px; border-radius: 999px; border: 0; background: var(--card); color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; }
.drawer-tabs button.on { background: var(--accent); color: #fff; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.quick { display: grid; gap: 8px; padding: 4px 8px 12px; }
.quick .btn { justify-content: flex-start; width: 100%; height: 44px; border-radius: 10px; }
.qhead { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 6px; color: var(--muted); font-size: 13px; }
.qitem { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.qitem:hover { background: var(--card); }
.qitem.cur { background: var(--accent-soft); }
.qitem .tile { width: 40px; height: 40px; font-size: 12px; border-radius: 6px; }
.qitem .tile small { font-size: 7px; margin-bottom: 2px; }
.qitem .t { font-size: 13px; font-weight: 500; line-height: 1.3; cursor: pointer; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qitem.cur .t { color: var(--accent-2); }
.qitem .acts { display: flex; }
.qitem .ib { width: 36px; height: 36px; color: var(--muted); }
.qitem .ib:hover { color: var(--text); }
.qitem .ib .icon { width: 16px; height: 16px; }
.drawer .searchbox { margin: 4px 8px 10px; }
.drawer .searchbox input { height: 42px; }

@media (max-width: 760px) {
  body { padding-bottom: 132px; }
  .player { height: auto; padding: 10px 12px 12px; grid-template-columns: 1fr auto; grid-template-areas: "np right" "center center"; row-gap: 6px; }
  .np { grid-area: np; }
  .np .tile { width: 44px; height: 44px; }
  .center { grid-area: center; }
  .right { grid-area: right; }
  .right .range, .right .vol, .ctrls .opt { display: none; }
  .ep-head { grid-template-columns: 96px 1fr; gap: 14px; }
  .ep-head .tile { width: 96px; height: 96px; font-size: 24px; }
  .ep-head h1 { font-size: 20px; }
  .count { width: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
