/* BBX player — languages (subtitles renderer, audio, settings sheet). Loaded by templates/public/watch.html
   after bbx.css; base player chrome (.player, .pl-controls, .pl-icon…) stays in bbx.css. */

/* ---------- forensic watermark (moved by player.js; stays in fullscreen because it lives in .player) */
.pl-wm {
  position: absolute; z-index: 3; pointer-events: none; user-select: none;
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px;
  color: #fff; opacity: .22; font: 600 12px/1 var(--font); letter-spacing: .02em; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6); transition: left 1.2s ease, top 1.2s ease;
}
.pl-wm img { width: 18px; height: 18px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.pl-wm b { font-weight: 700; opacity: .9; }
@media (min-width: 769px) { .pl-wm { font-size: 13px; opacity: .2; } .pl-wm img { width: 20px; height: 20px; } }
.player.in-ad .pl-wm { display: none; }

/* ---------- subtitles overlay */
.pl-cues {
  position: absolute; left: 4%; right: 4%; bottom: 7%; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: .18em;
  text-align: center; pointer-events: none;
  font: 600 var(--cue-size, 22px)/1.3 var(--font); letter-spacing: .005em;
  transition: bottom .25s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.player.controls-on .pl-cues, .player.paused .pl-cues { bottom: calc(var(--pl-ctrl-h, 96px) + 4px); }
.player.in-ad .pl-cues, .player.show-next .pl-cues { display: none; }
.player-v .pl-cues { bottom: 18%; }
.player-v.controls-on .pl-cues { bottom: calc(var(--pl-ctrl-h, 96px) + 40px); }

.pl-cue-line { display: block; max-width: 100%; }
.pl-cue-line > span {
  display: inline; padding: .08em .38em; border-radius: .18em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  color: #fff; background: rgba(0, 0, 0, .62);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
}
/* appearance options (data attributes set by player.js on .player) */
.player[data-sub-color="yellow"] .pl-cue-line > span { color: #FFE14D; }
.player[data-sub-color="cyan"] .pl-cue-line > span { color: #7FE6FF; }
.player[data-sub-bg="none"] .pl-cue-line > span { background: transparent; }
.player[data-sub-bg="solid"] .pl-cue-line > span { background: #000; }
.player[data-sub-edge="none"] .pl-cue-line > span { text-shadow: none; }
.player[data-sub-edge="outline"] .pl-cue-line > span {
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 3px #000;
}
.player[data-sub-bg="none"][data-sub-edge="none"] .pl-cue-line > span { text-shadow: 0 0 2px rgba(0,0,0,.6); }

/* ---------- control bar additions */
.pl-cc { position: relative; }
.pl-cc.on { color: #fff; }
.pl-cc.on::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 7px; height: 3px; border-radius: 2px; background: var(--brand);
}
.pl-cc:not(.on) svg { opacity: .8; }
.pl-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; margin: 0 2px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .25);
  color: #fff; font: 800 12px/1 var(--font); letter-spacing: .04em; cursor: pointer; flex-shrink: 0;
}
.pl-chip:hover { border-color: var(--sky); }
.pl-chip .ico-sm, .pl-chip svg { width: 15px; height: 15px; }
.pl-menu-wrap, .pl-menu { display: none !important; } /* legacy menu (replaced by the sheet) */

/* ---------- settings: popover (wide) */
.pl-sheet {
  position: absolute; z-index: 8; right: 10px; bottom: calc(var(--pl-ctrl-h, 96px) - 8px);
  width: min(340px, calc(100% - 20px)); max-height: calc(100% - var(--pl-ctrl-h, 96px) - 16px);
  overflow: hidden auto; overscroll-behavior: contain;
  background: rgba(5, 15, 36, .97); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55); backdrop-filter: blur(12px);
  color: var(--text); font-size: 14px;
}
.pl-sheet[hidden], .pl-sheet-backdrop[hidden] { display: none; }
.pl-panel { padding: 6px 6px 10px; }
.pl-panel[hidden] { display: none; }
.pl-sheet-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 4px; min-height: 48px;
  padding: 0 4px 0 10px; margin: -6px -6px 4px; background: inherit; border-bottom: 1px solid var(--border-soft);
}
.pl-sheet-head strong { flex: 1; font-size: 15px; }
.pl-sheet-head .pl-icon:first-child { margin-left: -6px; }
.pl-sheet-head .pl-icon { width: 40px; height: 40px; }

.pl-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 10px;
  border: 0; border-radius: 10px; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.pl-row:hover, .pl-row:focus-visible { background: var(--surface-2); }
.pl-row.static { cursor: default; }
.pl-row.static:hover { background: none; }
.pl-row > svg:first-child { width: 20px; height: 20px; color: var(--text-muted); flex-shrink: 0; }
.pl-row .k { font-weight: 700; flex-shrink: 0; }
.pl-row .v { margin-left: auto; color: var(--text-muted); font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pl-row .chev { width: 18px; height: 18px; color: var(--text-dim); flex-shrink: 0; }
.pl-row.static .v { margin-left: auto; }

.pl-list { display: flex; flex-direction: column; }
.pl-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 12px;
  border: 0; border-radius: 10px; background: none; color: inherit; font: 600 14px/1.2 var(--font); text-align: left; cursor: pointer;
}
.pl-opt:hover, .pl-opt:focus-visible { background: var(--surface-2); }
.pl-opt > span { flex: 1; }
.pl-opt .tick { width: 18px; height: 18px; color: var(--sky); visibility: hidden; flex-shrink: 0; }
.pl-opt.on { color: #fff; }
.pl-opt.on .tick { visibility: visible; }
.pl-badge {
  font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 5px; background: rgba(85, 183, 232, .16); color: var(--sky-light); margin-left: 6px; vertical-align: 1px;
}
.pl-empty { margin: 6px 12px 10px; color: var(--text-dim); font-size: 13px; }

/* appearance */
.pl-style-preview {
  position: relative; margin: 6px 6px 12px; height: 92px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; padding: 0 10px; text-align: center;
  background: linear-gradient(135deg, #2b4f82, #7c4a3a 60%, #2a2140);
  font: 600 clamp(14px, var(--cue-size, 20px), 24px)/1.3 var(--font);
}
.pl-opt-group { padding: 4px 6px 8px; }
.pl-opt-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin: 2px 4px 6px; }
.pl-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-seg button {
  flex: 1 1 auto; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: inherit; font: 600 13px/1 var(--font); cursor: pointer;
}
.pl-seg button:hover { border-color: var(--sky); }
.pl-seg button.on { background: var(--sky); border-color: var(--sky); color: var(--navy-ink); }

/* ---------- settings: bottom sheet (phones / narrow players) */
/* fixed to the viewport (escapes the small 16:9 box on phones; in fullscreen the viewport is the screen) */
.pl-sheet-backdrop { position: fixed; inset: 0; z-index: 79; background: rgba(0, 0, 0, .5); }
.player.pl-narrow .pl-sheet {
  position: fixed; z-index: 80;
  left: 0; right: 0; bottom: 0; width: auto; max-height: min(78vh, 560px); max-height: min(78dvh, 560px);
  border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: pl-sheet-up .22s ease-out;
}
.player.pl-narrow .pl-sheet::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .28); margin: 8px auto 0;
}
.player.pl-narrow .pl-sheet-head { margin-top: 0; }
.player.pl-narrow.sheet-open .pl-controls { opacity: 0; pointer-events: none; }
@keyframes pl-sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* phones in landscape: the screen is short, use almost all of it */
@media (max-height: 520px) and (orientation: landscape) {
  .player.pl-narrow .pl-sheet { max-height: 92vh; left: auto; width: min(420px, 100%); border-radius: 18px 0 0 0; }
}
.player.pl-narrow .pl-row, .player.pl-narrow .pl-opt { min-height: 52px; }
.player.pl-narrow .pl-chip { height: 30px; padding: 0 8px; }

@media (prefers-reduced-motion: reduce) { .player.pl-narrow .pl-sheet { animation: none; } .pl-cues { transition: none; } }
