/* ==========================================================================
   Free TV — Modern UI base + Android TV (10-foot) experience
   Loaded after enhancements.css. Two layers:
     1) MODERN BASE  — every device (keyboard focus, scrollbars, feedback)
     2) TV MODE      — html.tv-mode (remote/DPAD friendly, large UI, focus rings)
   ========================================================================== */

/* ------------------- 1. MODERN BASE (all devices) ------------------- */

:root {
  --tv-focus: #22d3ee;
  --tv-ring: 0 0 0 4px rgba(2, 6, 23, .92), 0 0 0 7px #22d3ee, 0 18px 44px rgba(0, 0, 0, .55);
}

/* Keyboard focus must always be visible — a11y on desktop + TV alike. */
:focus-visible {
  outline: 3px solid var(--tv-focus);
  outline-offset: 2px;
  border-radius: 12px;
}

/* Instant tactile feedback for every tap / click. */
button, .btn-primary, .content-tab, select, .channel, .media-tile, .program, .quick-browse button {
  -webkit-tap-highlight-color: transparent;
}
button:active, .btn-primary:active, .content-tab:active, .quick-browse button:active {
  transform: scale(.97);
}

/* Modern slim scrollbars. */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 211, 238, .45);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

/* Buttery horizontal rows. */
.media-row { scroll-behavior: smooth; }
.media-tile { scroll-snap-align: start; }

/* ------------------- 2. ANDROID TV / 10-FOOT LAYER ------------------- */

/* Overscan-safe padding + calmer ambience + no cursor on remote-first screens. */
html.tv-mode body {
  font-size: 17px;
  padding: 2.2vmin 2.4vmin 3.6vmin;
  user-select: none;
  -webkit-user-select: none;
}
html.tv-mode body::before { animation: none; }
html.tv-mode:not(.has-pointer) body { cursor: none; }

/* Replace default outlines with a loud, leanback-style focus ring. */
html.tv-mode :focus { outline: none; }
html.tv-mode :focus-visible { outline: none; }

html.tv-mode button:focus,
html.tv-mode a:focus,
html.tv-mode select:focus,
html.tv-mode input:focus,
html.tv-mode .content-tab:focus,
html.tv-mode .channel:focus,
html.tv-mode .media-tile:focus,
html.tv-mode .program:focus,
html.tv-mode .quick-browse button:focus {
  border-color: var(--tv-focus) !important;
  background: rgba(34, 211, 238, .16) !important;
  box-shadow: var(--tv-ring) !important;
  z-index: 6;
  position: relative;
}
html.tv-mode button:focus,
html.tv-mode .content-tab:focus,
html.tv-mode .channel:focus,
html.tv-mode .media-tile:focus,
html.tv-mode .program:focus,
html.tv-mode .quick-browse button:focus,
html.tv-mode .hero-play:focus,
html.tv-mode .hero-secondary:focus {
  transform: scale(1.045);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
html.tv-mode .media-tile:focus .media-art img { transform: scale(1.06); }

/* Nav — bigger everything. */
html.tv-mode .nav { border-radius: 34px; padding: 16px; gap: 16px; top: 14px; }
html.tv-mode .logo { width: 66px; height: 66px; border-radius: 22px; }
html.tv-mode h1 { font-size: 29px; }
html.tv-mode .subtitle { font-size: 13px; }
html.tv-mode .searchbar { border-radius: 26px; padding: 8px; }
html.tv-mode .searchbar input { min-height: 48px; font-size: 16px; }
html.tv-mode .searchbar select { min-width: 190px; min-height: 48px; font-size: 15px; }
html.tv-mode .nav button { min-height: 54px; padding: 13px 19px; font-size: 14px; border-radius: 20px; }

/* Content tabs — chunky pill row. */
html.tv-mode .content-tabs { padding: 8px; gap: 12px; border-radius: 999px; margin-top: 22px; }
html.tv-mode .content-tab {
  min-width: 180px !important;
  min-height: 60px !important;
  padding: 15px 26px !important;
  font-size: 16px !important;
  border-radius: 999px !important;
}

/* Layout — wider sidebar for the channel grid. */
html.tv-mode .layout { grid-template-columns: minmax(0, 1fr) 540px; gap: 22px; margin-top: 22px; }
html.tv-mode .sidebar { border-radius: 30px; padding: 16px; max-height: calc(100vh - 96px); top: 96px; }
html.tv-mode .side-head { margin-bottom: 14px; }
html.tv-mode .side-title { font-size: 17px; }
html.tv-mode .channels {
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  max-height: calc(100vh - 290px);
  padding: 2px 8px 8px 2px;
}
html.tv-mode .channel {
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 14px;
  border-radius: 20px;
  min-height: 88px;
}
html.tv-mode .channel img { width: 54px; height: 44px; border-radius: 14px; }
html.tv-mode .channel .tag { display: none; }
html.tv-mode .ch-name { font-size: 15px; }
html.tv-mode .ch-sub { font-size: 12px; }
html.tv-mode .channel.active { border-color: rgba(34, 211, 238, .45); }

/* Player — cinema-sized controls. */
html.tv-mode .player-card { border-radius: 38px; }
html.tv-mode .player-top { padding: 20px 24px; }
html.tv-mode .now-title { font-size: 28px; }
html.tv-mode .now-meta { font-size: 14px; }
html.tv-mode .status { font-size: 13px; padding: 12px 16px; }
html.tv-mode .content-description { padding: 14px 24px 16px; }
html.tv-mode .description-kind { font-size: 12px; }
html.tv-mode .description-text { font-size: 15px; line-height: 1.65; }
html.tv-mode .video-wrap { margin: 16px 18px 0; border-radius: 28px; overflow: hidden; }
html.tv-mode .player-actions { padding: 16px 18px; gap: 12px; }
html.tv-mode .player-actions button,
html.tv-mode .player-actions select {
  min-height: 56px;
  padding: 13px 20px;
  font-size: 14px;
  border-radius: 18px;
}
html.tv-mode .pill { font-size: 13px; padding: 11px 15px; border-radius: 999px; }

/* Utility bar — remote reachable. */
html.tv-mode .utility-bar {
  border-radius: 26px;
  margin-top: 14px;
  padding: 14px 16px;
  gap: 12px;
}
html.tv-mode .utility-bar button { min-height: 52px; padding: 12px 17px; font-size: 13px; border-radius: 17px; }
html.tv-mode .network-pill { font-size: 12px; }

/* Info cards. */
html.tv-mode .info-grid { gap: 16px; margin-top: 22px; }
html.tv-mode .info-card { padding: 20px; border-radius: 26px; }
html.tv-mode .info-label { font-size: 13px; }
html.tv-mode .info-value { font-size: 31px; }

/* Warning + log — readable from the sofa. */
html.tv-mode .warning { font-size: 14px; padding: 16px 18px; border-radius: 24px; }
html.tv-mode .log { font-size: 13px; max-height: 180px; }

/* Rewind library. */
html.tv-mode .replay-card { border-radius: 36px; }
html.tv-mode .replay-head { padding: 18px 22px; }
html.tv-mode .replay-title { font-size: 22px; }
html.tv-mode .replay-sub { font-size: 14px; }
html.tv-mode .replay-tools { padding: 14px 18px; }
html.tv-mode .replay-tools input, html.tv-mode .replay-tools select { min-height: 52px; font-size: 14px; }
html.tv-mode .program { border-radius: 24px; padding: 14px; min-height: 74px; margin-bottom: 11px; }
html.tv-mode .program-title { font-size: 16px; }
html.tv-mode .program-timebox { font-size: 12px; padding: 12px 8px; }
html.tv-mode .program-buttons button { min-height: 50px; padding: 12px 17px; font-size: 13px; }

/* Home — hero + tiles sized for the sofa. */
html.tv-mode .home-view { margin-top: 22px; }
html.tv-mode .home-hero { height: min(560px, 52vw); min-height: 440px; border-radius: 36px; }
html.tv-mode .home-hero h2 { font-size: clamp(46px, 6.4vw, 84px); }
html.tv-mode .home-hero p { font-size: 16px; max-width: 620px; }
html.tv-mode .hero-kicker { font-size: 12px; }
html.tv-mode .hero-play, html.tv-mode .hero-secondary {
  min-height: 62px;
  padding: 0 28px !important;
  font-size: 15px !important;
  border-radius: 999px !important;
}
html.tv-mode .hero-stats { font-size: 13px; gap: 26px; }
html.tv-mode .hero-stats b { font-size: 18px; }
html.tv-mode .quick-browse { gap: 14px; margin: 16px 0 30px; }
html.tv-mode .quick-browse button { min-height: 96px; padding: 18px; border-radius: 24px; }
html.tv-mode .quick-browse span { width: 48px; height: 48px; font-size: 21px; border-radius: 15px; }
html.tv-mode .quick-browse b { font-size: 15px; }
html.tv-mode .quick-browse small { font-size: 12px; }
html.tv-mode .section-head { margin-bottom: 15px; }
html.tv-mode .section-head h3 { font-size: 22px; }
html.tv-mode .media-row { grid-auto-columns: minmax(215px, 255px); gap: 17px; padding: 6px 2px 18px; }
html.tv-mode .media-tile { min-height: 312px; border-radius: 26px; }
html.tv-mode .media-art { height: 205px; }
html.tv-mode .media-tile img { height: 205px; }
html.tv-mode .media-tile-title { font-size: 15px; }
html.tv-mode .media-tile-sub { font-size: 12px; }
html.tv-mode .media-tile-info { padding: 14px; }
/* On TV there is no hover — play/favourite must always be visible. */
html.tv-mode .tile-play { opacity: 1; transform: none; width: 46px; height: 46px; font-size: 17px; }
html.tv-mode .tile-fav { opacity: 1; width: 36px; height: 36px; }

/* Modals — big buttons, big text. */
html.tv-mode .modal-box { border-radius: 34px; padding: 26px; width: min(820px, 100%); }
html.tv-mode .modal-box h3 { font-size: 23px; }
html.tv-mode .modal-box h4 { font-size: 15px; }
html.tv-mode .modal-box button, html.tv-mode .modal-box input {
  min-height: 54px;
  font-size: 15px;
  border-radius: 17px;
}
html.tv-mode .subtitle-file-label { min-height: 54px; font-size: 14px; border-radius: 17px; }
html.tv-mode .subtitle-notice { font-size: 13px; }

/* Now & Next / episode browsers. */
html.tv-mode .episode-browser, html.tv-mode .now-next { padding: 18px 22px; }
html.tv-mode .episode-card { padding: 15px; border-radius: 18px; font-size: 14px; }
html.tv-mode .epg-item { padding: 16px; border-radius: 20px; }
html.tv-mode .epg-title { font-size: 15px; }
html.tv-mode .epg-time { font-size: 13px; }
html.tv-mode .epg-label { font-size: 11px; }

/* TV-mode toast sits higher so it never hides under the player. */
html.tv-mode .toast-stack { bottom: 4.5vmin; }
html.tv-mode .toast { font-size: 14px; padding: 14px 18px; border-radius: 18px; }

/* Compact 720p TVs — trim so nothing overflows. */
@media (max-width: 1500px) {
  html.tv-mode .layout { grid-template-columns: minmax(0, 1fr) 480px; }
  html.tv-mode .media-row { grid-auto-columns: minmax(195px, 230px); }
  html.tv-mode .media-art, html.tv-mode .media-tile img { height: 185px; }
  html.tv-mode .media-tile { min-height: 280px; }
}
@media (max-width: 1280px) {
  html.tv-mode .layout { grid-template-columns: 1fr; }
  html.tv-mode .sidebar { position: relative; top: auto; max-height: none; }
  html.tv-mode .channels { max-height: 520px; }
  html.tv-mode .home-hero { height: min(520px, 78vw); min-height: 380px; }
}

/* TV-mode hint pill (first activation). */
.tv-hint {
  position: fixed;
  left: 50%;
  bottom: 4.5vmin;
  transform: translateX(-50%);
  z-index: 300;
  padding: 13px 22px;
  border: 1px solid rgba(34, 211, 238, .45);
  border-radius: 999px;
  background: rgba(2, 6, 23, .92);
  color: #e8faff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .02em;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  animation: tv-hint-in .3s ease;
  pointer-events: none;
}
@keyframes tv-hint-in { from { transform: translate(-50%, 14px); opacity: 0; } }
