/* DriftTV — VIDAA TV app. Fixed 1920x1080 design. Dark charcoal + warm coral. */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #101014;
  --panel: #1a1a21;
  --panel2: #24242e;
  --text: #f2f0ee;
  --muted: #96939e;
  --accent: #ff6a5c;      /* warm coral */
  --accent-soft: #ff8a7a;
  --gold: #ffd166;
  --danger: #ff5c6c;
  --focus-ring: 0 0 0 4px var(--accent), 0 10px 34px rgba(255, 106, 92, .35);
}
html, body { width: 100%; height: 100%; overflow: hidden; }
/* Fixed 1920x1080 stage, scaled to the real viewport (VIDAA panels can be 720p). */
#stage {
  position: absolute; width: 1920px; height: 1080px;
  transform-origin: 0 0; overflow: hidden; background: var(--bg);
}
body {
  background: #000;
  color: var(--text);
  font-family: -apple-system, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 26px;
  cursor: none;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: none; text-align: left; }
::-webkit-scrollbar { width: 0; height: 0; }
.focusable { outline: none; }
.focusable:focus { box-shadow: var(--focus-ring); }
.muted { color: var(--muted); }

.screen { position: absolute; inset: 0; }
[hidden] { display: none !important; }

/* ---------- LOGIN ---------- */
#screen-login {
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 640px at 18% 8%, rgba(255,106,92,.16), transparent 60%),
    radial-gradient(900px 600px at 88% 92%, rgba(255,209,102,.08), transparent 60%),
    var(--bg);
}
.login-wrap { display: flex; gap: 120px; align-items: center; }
.brand { text-align: center; width: 480px; }
.brand-logo {
  width: 130px; height: 130px; margin: 0 auto 30px; border-radius: 34px;
  background: linear-gradient(135deg, var(--accent), #ff9d5c);
  display: flex; align-items: center; justify-content: center;
  font-size: 60px; color: #fff;
  box-shadow: 0 20px 60px rgba(255,106,92,.35);
}
.brand h1 { font-size: 76px; font-weight: 800; letter-spacing: -2px; }
.brand h1 span { color: var(--accent); }
.tagline { color: var(--muted); margin-top: 12px; font-size: 28px; }
.login-card {
  width: 640px; background: var(--panel); border-radius: 24px; padding: 44px;
  border: 1px solid #2b2b35;
}
.login-tabs { display: flex; gap: 14px; margin-bottom: 30px; }
.tab {
  flex: 1; padding: 16px 0; text-align: center; border-radius: 14px;
  background: var(--panel2); color: var(--muted); font-weight: 600;
}
.tab.active { background: var(--accent); color: #fff; }
.login-form label { display: block; color: var(--muted); font-size: 21px; margin: 18px 0 8px; }
.login-form input, .search-box {
  width: 100%; background: var(--panel2); border: 2px solid transparent;
  border-radius: 14px; padding: 16px 20px; font-size: 26px;
}
.btn-primary {
  width: 100%; margin-top: 34px; padding: 20px 0; text-align: center;
  background: linear-gradient(135deg, var(--accent), #ff9d5c);
  color: #fff; font-weight: 700; font-size: 28px; border-radius: 16px;
}
.btn-inline { width: auto; margin-top: 0; padding: 14px 44px; }
.btn-secondary { padding: 14px 30px; background: var(--panel2); border-radius: 14px; font-weight: 600; }
.btn-danger { padding: 14px 30px; background: #3a1620; color: var(--danger); border-radius: 14px; font-weight: 600; }
.login-error { margin-top: 22px; color: var(--danger); text-align: center; font-size: 22px; }

/* ---------- MAIN LAYOUT ---------- */
#screen-main { display: flex; }
#sidebar {
  width: 110px; padding: 26px 0; display: flex; flex-direction: column; align-items: center;
  gap: 8px; background: rgba(13,13,17,.92); border-right: 1px solid #23232c;
  transition: width .18s ease; z-index: 5; flex: none;
}
#sidebar:focus-within { width: 300px; align-items: stretch; }
.side-logo {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 26px;
  background: linear-gradient(135deg, var(--accent), #ff9d5c);
  display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff;
  flex: none;
}
.side-item {
  display: flex; align-items: center; gap: 18px; padding: 15px 0; justify-content: center;
  border-radius: 14px; color: var(--muted); margin: 0 12px; font-size: 25px; font-weight: 600;
}
#sidebar:focus-within .side-item { justify-content: flex-start; padding: 15px 22px; }
.side-item .ico { font-size: 28px; width: 40px; text-align: center; flex: none; }
.side-item .lbl { display: none; white-space: nowrap; }
#sidebar:focus-within .lbl { display: inline; }
.side-item.active { color: var(--text); background: var(--panel2); }
.side-item:focus { color: #fff; background: var(--accent); box-shadow: none; }
.side-bottom { margin-top: auto; }

#content { flex: 1; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: flex; gap: 30px; padding: 40px 50px; }
.view-stack { flex-direction: column; }
.view h2 { font-size: 30px; margin-bottom: 20px; font-weight: 700; }

.col { display: flex; flex-direction: column; min-height: 0; }
.col-cats { width: 380px; flex: none; }
.col-chan { flex: 1; min-width: 0; }
.col-grid { flex: 1; min-width: 0; }
.list { flex: 1; overflow-y: auto; padding: 4px; }

.row-item {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 14px 18px; border-radius: 12px; margin-bottom: 6px;
  color: var(--text); font-size: 25px;
}
.row-item .num { color: var(--muted); font-size: 20px; min-width: 44px; }
.row-item img { width: 50px; height: 50px; object-fit: contain; border-radius: 8px; background: #0006; flex: none; }
.row-item .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .fav-mark { margin-left: auto; color: var(--accent); font-size: 22px; }
.row-item.selected { background: var(--panel2); }
.row-item:focus { background: var(--panel2); box-shadow: var(--focus-ring); }

/* ---------- HOME ---------- */
.home-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; flex: none; }
.home-head h1 { font-size: 52px; font-weight: 800; letter-spacing: -1px; }
#home-sub { font-size: 24px; margin-top: 6px; }
#home-clock { font-size: 40px; font-weight: 300; color: var(--muted); }
.rails { flex: 1; overflow-y: auto; min-height: 0; padding: 4px; }
.rail { margin-bottom: 36px; }
.rail h3 { font-size: 26px; font-weight: 700; margin-bottom: 14px; }
.rail h3 .more { color: var(--muted); font-weight: 400; font-size: 21px; }
.rail-row { display: flex; gap: 18px; overflow-x: auto; padding: 6px 4px 10px; }

/* cards */
.card { border-radius: 14px; background: var(--panel); overflow: hidden; padding-bottom: 10px; flex: none; width: 220px; }
.card.landscape { width: 320px; }
.card .poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; background: var(--panel2); }
.card.landscape .poster { aspect-ratio: 16 / 9; object-fit: contain; padding: 14px; }
.card .cap { padding: 10px 12px 0; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { padding: 2px 12px 0; font-size: 17px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cw-bar { height: 6px; background: #ffffff22; margin: 8px 12px 0; border-radius: 3px; overflow: hidden; }
.card .cw-bar div { height: 100%; background: var(--accent); }
.card:focus { transform: scale(1.05); transition: transform .12s; }

/* grid views */
.grid {
  flex: 1; overflow-y: auto; display: grid; gap: 22px; padding: 4px;
  grid-template-columns: repeat(5, 1fr); align-content: start;
}
.grid .card { width: auto; }

/* ---------- EPG GRID ---------- */
.col-epg { flex: 1; min-width: 0; }
.epg-toprow { display: flex; align-items: baseline; gap: 30px; flex: none; }
#epg-timescale { flex: 1; display: flex; color: var(--muted); font-size: 19px; padding-left: 330px; }
#epg-timescale span { flex: 1; border-left: 1px solid #2c2c37; padding-left: 8px; }
.epg-grid { flex: 1; overflow-y: auto; position: relative; padding: 4px; }
.epg-row { display: flex; align-items: stretch; gap: 0; margin-bottom: 8px; height: 92px; }
.epg-ch {
  width: 320px; flex: none; display: flex; align-items: center; gap: 14px;
  background: var(--panel); border-radius: 12px 0 0 12px; padding: 0 16px;
  border-right: 2px solid #2c2c37;
}
.epg-ch img { width: 54px; height: 54px; object-fit: contain; border-radius: 8px; background: #0006; flex: none; }
.epg-ch .nm { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-ch .fav-mark { margin-left: auto; color: var(--accent); }
.epg-row:focus-within .epg-ch, .epg-row.focused .epg-ch { background: var(--panel2); }
.epg-progs { flex: 1; position: relative; background: var(--panel); border-radius: 0 12px 12px 0; overflow: hidden; }
.epg-block {
  position: absolute; top: 8px; bottom: 8px; background: var(--panel2);
  border-radius: 8px; padding: 8px 14px; overflow: hidden; border-left: 3px solid #3a3a46;
}
.epg-block .t { font-size: 17px; color: var(--muted); white-space: nowrap; }
.epg-block .p { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.epg-block.now { background: #33241f; border-left-color: var(--accent); }
.epg-loading { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 20px; color: var(--muted); font-size: 19px; }
.epg-nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.epg-row-btn { display: flex; width: 100%; padding: 0; border-radius: 12px; }
.epg-row-btn:focus { box-shadow: var(--focus-ring); }

/* ---------- DETAIL ---------- */
.detail-head { display: flex; gap: 34px; margin-bottom: 26px; flex: none; }
#sd-poster, #md-poster { width: 210px; border-radius: 14px; align-self: flex-start; }
.detail-meta { flex: 1; min-width: 0; }
.detail-meta h2 { font-size: 42px; margin-bottom: 12px; }
.chips { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.chip { background: var(--panel2); border-radius: 10px; padding: 6px 16px; font-size: 19px; color: var(--muted); }
.chip.hot { color: var(--gold); }
#sd-plot, #md-plot {
  color: var(--muted); font-size: 23px; max-width: 1150px; margin-bottom: 20px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.detail-body { flex: 1; display: flex; gap: 30px; min-height: 0; }

/* movie overlay */
.overlay {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(8,8,11,.82);
}
.overlay-card {
  width: 1240px; background: var(--panel); border: 1px solid #2b2b35; border-radius: 24px;
  padding: 44px; display: flex; gap: 36px;
}
.overlay-actions { display: flex; gap: 16px; margin-top: 10px; }

/* search */
.search-box { max-width: 900px; margin-bottom: 26px; flex: none; }

/* settings */
.settings-info { background: var(--panel); border-radius: 18px; padding: 30px; max-width: 1000px; margin-bottom: 30px; }
.settings-info p { margin: 8px 0; font-size: 24px; }
.settings-info .k { color: var(--muted); display: inline-block; width: 320px; }
.settings-actions { display: flex; gap: 18px; }
.settings-note { margin-top: 40px; color: var(--muted); font-size: 20px; }

/* ---------- PLAYER ---------- */
#screen-player { background: #000; }
#video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-bar {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 46px 60px 40px;
  display: flex; align-items: center; gap: 26px;
  background: linear-gradient(transparent, rgba(0,0,0,.93));
}
#pb-logo { width: 90px; height: 90px; object-fit: contain; border-radius: 12px; background: #0008; flex: none; }
.pb-meta { flex: 1; min-width: 0; }
.pb-meta h3 { font-size: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-meta p { color: #cfd3e0; font-size: 23px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-progress { height: 8px; background: #ffffff2a; border-radius: 4px; margin-top: 16px; overflow: hidden; }
#pb-fill { height: 100%; width: 0; background: var(--accent); }
.pb-hint { color: #9aa0b4; font-size: 20px; flex: none; }
.player-error {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--danger); font-size: 30px; background: rgba(0,0,0,.75); text-align: center; padding: 0 200px;
}
.spinner {
  position: absolute; top: 50%; left: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px;
  border: 6px solid #ffffff22; border-top-color: var(--accent); border-radius: 50%;
  animation: spin .9s linear infinite; z-index: 3;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid #33333f; color: var(--text);
  padding: 16px 30px; border-radius: 14px; font-size: 24px; z-index: 99;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.empty { color: var(--muted); padding: 30px 10px; font-size: 24px; }
