:root {
  --red: #e53935;
  --gold: #f0a202;
  --blue: #4fc3f7;
  --bg: #050505;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Roboto, Arial, sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* LOGIN */
#screen-login {
  background: #000 url("../img/bg_login.jpg") center/cover no-repeat;
}
.login-dim { position: absolute; inset: 0; background: rgba(5, 16, 24, 0.4); }
.login-logo {
  position: absolute;
  top: 22px;
  left: 36px;
  font-size: 28px;
  font-weight: 700;
}
.login-logo b { color: var(--red); margin-left: 8px; }
.login-panel {
  position: absolute;
  right: 56px;
  top: 50%;
  transform: translateY(-50%);
  width: 380px;
  background: rgba(13, 13, 18, 0.8);
  padding: 28px 32px;
}
.login-panel h2 {
  margin: 0;
  text-align: center;
  letter-spacing: 0.1em;
  font-size: 15px;
}
.login-row {
  display: flex;
  align-items: center;
  margin-top: 22px;
  gap: 14px;
}
.login-row input {
  flex: 1;
  height: 48px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 15px;
  outline: none;
}
.login-row input::placeholder { color: rgba(255, 255, 255, 0.6); }
.login-line { height: 1px; background: rgba(255, 255, 255, 0.4); }
.login-err { color: #ff5252; font-size: 13px; margin-top: 14px; line-height: 1.45; }
.btn-login {
  width: 100%;
  height: 52px;
  margin-top: 24px;
  background: var(--red);
  border: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  border-radius: 4px;
}
.btn-login:focus { outline: 2px solid #fff; }

/* LOADING */
#screen-loading {
  background: #050505 url("../img/bg_dashboard.jpg") center/cover no-repeat;
}
.load-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.7); }
.load-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.load-logo { font-size: 32px; font-weight: 700; }
.load-logo b { color: var(--red); margin-left: 10px; }
.load-sub {
  margin-top: 6px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}
.load-bar {
  width: 220px;
  height: 3px;
  margin: 36px auto 0;
  background: #333;
}
.load-bar > i {
  display: block;
  height: 100%;
  width: 8%;
  background: var(--red);
}
.load-status { margin-top: 16px; color: rgba(255, 255, 255, 0.8); font-size: 13px; letter-spacing: 0.06em; }

/* DASHBOARD */
#screen-dash {
  background: #050505 url("../img/bg_dashboard.jpg") center/cover no-repeat;
}
.dash-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.dash {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 12px 28px 18px;
}
.dash-top {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 10px;
  flex-shrink: 0;
}
.brand { font-size: 22px; font-weight: 700; }
.brand b { color: var(--red); margin-left: 6px; }
.dash-time { font-size: 14px; font-weight: 700; margin-left: 8px; }
.dash-date { font-size: 13px; color: rgba(255, 255, 255, 0.7); }
.dash-top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.search-box {
  display: flex;
  align-items: center;
  height: 34px;
  margin-right: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.33);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  gap: 6px;
}
.search-box:focus-within {
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.27);
}
.search-box input {
  width: 120px;
  background: transparent;
  border: 0;
  color: #fff;
  outline: none;
  font-size: 12px;
}
.search-box input::placeholder { color: rgba(255, 255, 255, 0.6); }
.ico-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  margin-right: 4px;
}
.ico-btn:last-child { margin-right: 0; }
.ico-btn svg { width: 22px; height: 22px; fill: #fff; }
.ico-btn:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.33);
  box-shadow: inset 0 0 0 2px #fff;
}

.cards-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 0;
  padding: 8px 12px 16px;
}
.cards {
  width: 100%;
  height: 54%;
  min-height: 260px;
  max-height: 420px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.card {
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card.live { background: rgba(240, 162, 2, 0.6); }
.card.movies { background: rgba(229, 57, 53, 0.6); }
.card.series { background: rgba(79, 195, 247, 0.6); }
.card-hit {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: #fff;
  width: 100%;
  border-radius: 14px 14px 0 0;
}
.card-hit:focus {
  outline: none;
  box-shadow: inset 0 0 0 2.5px #fff;
}
.icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
}
.icon-circle svg { width: 38px; height: 38px; fill: #fff; }
.card-hit strong {
  margin-top: 14px;
  letter-spacing: 0.05em;
  font-size: 24px;
  font-weight: 700;
}
.card-foot {
  min-height: 58px;
  flex-shrink: 0;
  background: rgba(10, 10, 10, 0.82);
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}
.card-foot .meta { flex: 1; min-width: 0; padding-right: 8px; }
.card-foot .meta b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot .meta span { font-size: 11px; color: rgba(255, 255, 255, 0.72); display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.refresh-pill {
  height: 40px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 0 14px 0 12px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.refresh-pill svg { width: 15px; height: 15px; fill: currentColor; }
.refresh-pill:hover, .refresh-pill:focus {
  outline: none;
  background: #fff;
  border-color: #fff;
  color: #111;
}

.bottom {
  display: flex;
  gap: 10px;
  margin: 0 20px;
  height: 48px;
  flex-shrink: 0;
}
.pill {
  flex: 1;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.33);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pill svg { width: 18px; height: 18px; fill: currentColor; }
.pill:hover, .pill:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.4);
  border: 2.5px solid #fff;
}

/* VOD / LIVE shared chrome */
.topbar {
  height: 44px;
  background: #0e0e0e;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
}
.topbar .red { color: var(--red); font-weight: 700; font-size: 17px; }
.ghost {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 20px;
}
.search-mini {
  height: 32px;
  width: 170px;
  margin-left: auto;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.33);
  border-radius: 8px;
  color: #fff;
  padding: 0 8px;
  font-size: 12px;
}

.vod { display: flex; height: 100%; background: #0d0d0d; min-height: 0; }
.vod-side {
  width: 250px;
  flex-shrink: 0;
  background: #000;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.vod-side h3 { margin: 8px 0; font-size: 16px; }
.cat-search {
  height: 38px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  padding: 0 10px;
  font-size: 12px;
}
.cats { flex: 1; overflow: auto; margin-top: 8px; min-height: 0; }
.cat {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 11px 12px;
  border-radius: 8px;
}
.cat.active, .cat:focus { background: #e53935; outline: none; }
.vod-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #121212;
  display: flex;
  flex-direction: column;
}
.vod-head {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
}
.vod-head h2 { flex: 1; text-align: center; font-size: 16px; margin: 0; }
.posters {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 4px 10px 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
}
@media (min-width: 1400px) {
  .posters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.poster {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: #1a1a1a;
  border: 2px solid transparent;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.poster:focus, .poster.active { border-color: #fff; outline: none; }
.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  pointer-events: none;
}
.poster span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 28px 6px 8px;
  background: linear-gradient(transparent, #000);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  max-height: 70px;
  overflow: hidden;
}

.live { display: flex; flex-direction: column; height: 100%; background: #050505; }
.live-body { flex: 1; display: flex; min-height: 0; }
.pane { overflow: auto; }
.pane.cats { flex: 0.72; background: #0a0a0a; }
.pane.channels { flex: 1.05; background: #101010; }
.pane.player { flex: 1.35; background: #080808; padding: 8px; display: flex; flex-direction: column; }
.pane h4 {
  height: 36px;
  margin: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.04em;
}
.row {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #fff;
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.row:focus, .row.active { background: #e53935; outline: none; }
.row img { width: 28px; height: 28px; object-fit: contain; background: #000; }
#liveVideo, #fsVideo {
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}
.live-player-slot { flex: 1.25; background: #000; min-height: 0; position: relative; }
.live-player-slot:fullscreen,
.live-player-slot:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
}
.live-player-slot:fullscreen #liveVideo,
.live-player-slot:-webkit-full-screen #liveVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.live-fs-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.live-fs-btn:hover, .live-fs-btn:focus { background: #e53935; outline: none; }
.epg { flex: 1; overflow: auto; margin-top: 6px; font-size: 12px; color: #ccc; }

/* PLAYER */
#screen-player { background: #000; }
#fsVideo { position: absolute; inset: 0; }
.player-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.player-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 28px;
  background: linear-gradient(rgba(0, 0, 0, 0.75), transparent);
}
.player-top button {
  height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.player-top button:hover, .player-top button:focus {
  background: #e53935;
  outline: none;
}
.player-tab {
  height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.player-tab:hover, .player-tab:focus {
  background: #e53935;
  outline: none;
}
#playerTitle {
  flex: 1;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-ui {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  padding: 28px 20px 16px;
}
.seek {
  width: 100%;
  height: 8px;
  accent-color: #e53935;
}
.player-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.player-row button {
  min-width: 56px;
  height: 48px;
  background: #333;
  border: 0;
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
}
.player-row button:hover, .player-row button:focus { background: #e53935; outline: none; }
#playerTime { margin-left: 8px; color: #ccc; font-variant-numeric: tabular-nums; }

/* DETAIL */
.detail {
  height: 100%;
  background: #050505;
  display: flex;
  flex-direction: column;
  padding: 10px 20px 14px;
}
.detail-body { flex: 1; display: flex; gap: 24px; min-height: 0; }
.poster-col { width: 168px; }
.poster-col img { width: 168px; height: 252px; object-fit: contain; background: #111; }
.detail-meta { flex: 1; overflow: auto; }
.detail-meta h1 { font-size: 22px; margin: 0 0 10px; }
.meta-line { color: #ccc; font-size: 14px; margin: 4px 0; }
.meta-line b { color: #4fc3f7; }
.plot { margin: 14px 0; color: #ddd; line-height: 1.45; font-size: 14px; }
.play-btn {
  height: 48px;
  min-width: 160px;
  background: #1565c0;
  border: 2px solid #1565c0;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  border-radius: 6px;
}
.play-btn:focus { outline: 2px solid #fff; background: #1e88e5; }
.star-btn {
  width: 48px;
  height: 48px;
  margin-left: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.33);
  background: rgba(0, 0, 0, 0.13);
  color: #ffd54f;
  font-size: 22px;
}

.modal-back {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.modal {
  width: min(420px, 92vw);
  background: #141414;
  padding: 20px;
  border-radius: 8px;
}
.modal h3 { margin: 0 0 12px; }
.modal p { color: #ccc; margin: 6px 0; font-size: 14px; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions button {
  flex: 1;
  height: 48px;
  border: 0;
  color: #fff;
  font-weight: 700;
  border-radius: 22px;
}
.btn-dark { background: #333; }
.btn-red { background: var(--red); }

.toast {
  position: absolute;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 30;
  font-size: 14px;
}
.seasons { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.seasons button, .eps button {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  padding: 8px 12px;
  border-radius: 6px;
}
.eps { display: flex; flex-wrap: wrap; gap: 6px; }
.seasons button.active, .eps button.active { background: var(--red); border-color: var(--red); }
