:root {
  --bg-primary: #07090e;
  --bg-secondary: #0f131c;
  --bg-card: #151a26;
  --bg-card-hover: #1c2233;
  --bg-tile: #000000;
  --border-color: #242c3f;
  --border-active: #f59e0b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.35);
  --green: #10b981;
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --red: #ef4444;
  --topbar-height: 58px;
  --ticker-height: 38px;
  --font-display: 'Chakra Petch', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  user-select: none;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ========================================================
   TOP COMMAND CONSOLE
   ======================================================== */
#top-bar {
  height: var(--topbar-height);
  background: linear-gradient(180deg, #121622 0%, #0a0d14 100%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}

.bar-left, .bar-center, .bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Branding */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-dot {
  width: 10px;
  height: 10px;
  background-color: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--green);
  animation: pulse-dot 1.8s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1.5px;
  color: #fff;
  line-height: 1.1;
}
.brand-sub {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
  font-weight: 600;
}

/* Digital Clock */
.clock-badge {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  cursor: pointer;
  transition: border-color 0.2s;
}
.clock-badge:hover {
  border-color: var(--gold);
}
.clock-time {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
}
.clock-tz {
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Shield Badge in Header */
.shield-badge {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

/* Layout Switcher */
.layout-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.layout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.layout-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.layout-btn.active {
  background: #1e293b;
  color: var(--gold);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Layout Icons */
.icon-layout {
  width: 18px;
  height: 14px;
  display: flex;
  gap: 1.5px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #334155;
  border-radius: 2px;
  padding: 1.5px;
}
.icon-vip .main-tile {
  flex: 2.2;
  background: var(--gold);
  border-radius: 1px;
}
.icon-vip .side-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.icon-vip .side-col i {
  flex: 1;
  background: #64748b;
  display: block;
}
.icon-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
}
.icon-quad i, .icon-grid6 i, .icon-wall9 i {
  background: #64748b;
  display: block;
}
.icon-vip5 .main-tile {
  flex: 2;
  background: var(--gold);
}
.icon-vip5 .side-grid {
  flex: 1.2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
}
.icon-vip5 .side-grid i {
  background: #64748b;
  display: block;
}
.icon-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
}
.icon-dual i {
  background: #64748b;
  display: block;
}
.icon-grid6 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1px;
}
.icon-wall9 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
}
.icon-solo .solo-tile {
  width: 100%;
  height: 100%;
  background: var(--gold);
  border-radius: 1px;
}
.layout-btn.active .icon-layout {
  border-color: var(--gold);
}

/* Master Audio Matrix Hub */
.audio-matrix-hub {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 10px;
  gap: 8px;
}
.btn-icon {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
}
.audio-info {
  display: flex;
  flex-direction: column;
}
.audio-title {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-weight: 700;
}
.audio-target {
  font-size: 11px;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
}
.audio-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.audio-visualizer span {
  width: 2.5px;
  background: var(--gold);
  border-radius: 1px;
  animation: equalize 1s infinite alternate ease-in-out;
}
.audio-visualizer span:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.audio-visualizer span:nth-child(2) { height: 90%; animation-delay: 0.3s; }
.audio-visualizer span:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.audio-visualizer span:nth-child(4) { height: 80%; animation-delay: 0.4s; }
.audio-visualizer.muted span {
  animation: none;
  height: 20%;
  background: #64748b;
}

@keyframes equalize {
  0% { height: 20%; }
  100% { height: 100%; }
}

/* Action Buttons */
.action-btn {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.action-btn:hover {
  background: #334155;
  border-color: #475569;
}
.action-btn.primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  font-weight: 700;
  border: none;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}
.action-btn.primary:hover {
  filter: brightness(1.1);
}
.action-btn.highlight {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border: 1px solid #38bdf8;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}
.action-btn.highlight:hover {
  background: #0284c7;
  filter: brightness(1.15);
}

/* ========================================================
   VIDEO WALL ARENA
   ======================================================== */
#video-wall-container {
  position: absolute;
  top: var(--topbar-height);
  bottom: var(--ticker-height);
  left: 0;
  right: 0;
  background: #000;
  overflow: hidden;
  transition: top 0.3s, bottom 0.3s;
}

#video-matrix {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 2px;
  background: #11141c;
}

/* Layouts */
#video-matrix.layout-casino-vip {
  grid-template-columns: 3.2fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
}
#video-matrix.layout-casino-vip .video-tile[data-slot="0"] {
  grid-column: 1 / 2;
  grid-row: 1 / 4;
}
#video-matrix.layout-casino-vip .video-tile[data-slot="1"] {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}
#video-matrix.layout-casino-vip .video-tile[data-slot="2"] {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
}
#video-matrix.layout-casino-vip .video-tile[data-slot="3"] {
  grid-column: 2 / 3;
  grid-row: 3 / 4;
}
#video-matrix.layout-casino-vip .video-tile:nth-child(n+5) {
  display: none;
}

#video-matrix.layout-quad {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
#video-matrix.layout-quad .video-tile:nth-child(n+5) {
  display: none;
}

#video-matrix.layout-vip-5 {
  grid-template-columns: 2.8fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
#video-matrix.layout-vip-5 .video-tile[data-slot="0"] {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
}
#video-matrix.layout-vip-5 .video-tile[data-slot="1"] {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}
#video-matrix.layout-vip-5 .video-tile[data-slot="2"] {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
}
#video-matrix.layout-vip-5 .video-tile[data-slot="3"] {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
}
#video-matrix.layout-vip-5 .video-tile[data-slot="4"] {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}
#video-matrix.layout-vip-5 .video-tile:nth-child(n+6) {
  display: none;
}

#video-matrix.layout-dual {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}
#video-matrix.layout-dual .video-tile:nth-child(n+3) {
  display: none;
}

#video-matrix.layout-grid-6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
}
#video-matrix.layout-grid-6 .video-tile:nth-child(n+7) {
  display: none;
}

#video-matrix.layout-wall-9 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

#video-matrix.layout-solo {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
#video-matrix.layout-solo .video-tile:nth-child(n+2) {
  display: none;
}

/* ========================================================
   VIDEO TILE & BEZEL
   ======================================================== */
.video-tile {
  position: relative;
  background: #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #1a202e;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.video-tile.audio-active {
  border-color: var(--gold);
  box-shadow: inset 0 0 14px var(--gold-glow);
  z-index: 5;
}

/* Tile HUD Header */
.tile-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 38px;
  background: linear-gradient(180deg, rgba(8, 10, 16, 0.95) 0%, rgba(8, 10, 16, 0.6) 80%, rgba(8, 10, 16, 0) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  z-index: 10;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.25s ease;
  pointer-events: none;
}
.video-tile:hover .tile-hud,
.video-tile:focus-within .tile-hud,
.tile-hud.force-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tile-persistent-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  color: #cbd5e1;
  z-index: 8;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.2s;
}
.video-tile:hover .tile-persistent-badge {
  opacity: 0;
}
.tile-persistent-badge .badge-audio {
  color: var(--gold);
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-tag {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid #334155;
  color: #fff;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.hud-title {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.hud-category {
  font-size: 9px;
  color: var(--gold);
  background: rgba(245, 158, 11, 0.15);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}
.hud-shield {
  font-size: 9px;
  color: var(--green);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.hud-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.hud-btn:hover {
  background: #334155;
  border-color: var(--gold);
  color: var(--gold);
}
.hud-btn.active-audio {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  font-weight: 700;
}

/* Player Viewport */
.tile-player-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
}
.tile-player-container iframe,
.tile-player-container video {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Empty Tile State */
.tile-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle at center, #151b2a 0%, #080a10 100%);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s;
}
.tile-empty:hover {
  background: radial-gradient(circle at center, #1f273d 0%, #0c0f18 100%);
  color: #fff;
}
.tile-empty-icon {
  font-size: 28px;
  opacity: 0.7;
}
.tile-empty-text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.tile-empty-action {
  font-size: 11px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 700;
}

/* ========================================================
   BOTTOM TICKER / MARQUEE BAR
   ======================================================== */
#sports-ticker {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--ticker-height);
  background: #0b0e16;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s;
}

.ticker-badge {
  background: linear-gradient(90deg, #d97706 0%, #b45309 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ticker-dot {
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: pulse-dot 1.2s infinite;
}

.ticker-viewport {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
}
.ticker-track {
  white-space: nowrap;
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 1px;
  animation: marquee-scroll 50s linear infinite;
}
.ticker-track:hover {
  animation-play-state: paused;
}
@keyframes marquee-scroll {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

.ticker-controls {
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-ticker {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
}
.btn-ticker:hover {
  color: #fff;
}

/* ========================================================
   CLEAN WALL MODE (Hide Bezel, TopBar, Ticker)
   ======================================================== */
body.wall-mode #top-bar {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
body.wall-mode #sports-ticker {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}
body.wall-mode #video-wall-container {
  top: 0;
  bottom: 0;
}
body.wall-mode #video-matrix {
  gap: 0;
  background: #000;
}
body.wall-mode .video-tile {
  border: none;
}

#wall-mode-pill {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(-50px);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 6px 16px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s;
  opacity: 0;
}
body.wall-mode:hover #wall-mode-pill,
#wall-mode-pill.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========================================================
   LIVE SCORES & ODDS BOARD MODAL
   ======================================================== */
.live-pill {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
  font-family: var(--font-display);
}

.odds-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #0d121c;
  border-bottom: 1px solid var(--border-color);
}
.sport-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.sport-pill {
  background: #1e293b;
  border: 1px solid #334155;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.sport-pill:hover {
  background: #334155;
  color: #fff;
}
.sport-pill.active {
  background: var(--blue);
  color: #fff;
  border-color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.odds-board-content {
  padding: 18px;
  overflow-y: auto;
  max-height: 65vh;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

/* Game Card in Odds Board */
.game-odds-card {
  background: #141b2a;
  border: 1px solid #243047;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}
.game-odds-card:hover {
  border-color: #3b82f6;
  background: #192236;
}
.game-odds-card.live-game {
  border-left: 3px solid var(--green);
}
.game-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-display);
}
.game-status-badge {
  font-weight: 700;
}
.game-status-badge.live {
  color: var(--green);
}
.game-status-badge.final {
  color: #94a3b8;
}

.game-teams-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}
.game-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.team-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.team-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.team-record {
  font-size: 10px;
  color: var(--text-muted);
}
.team-score {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.game-situation-bar {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10px;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.redzone-alert {
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  animation: pulse-dot 1s infinite;
}

.game-odds-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f1422;
  border: 1px solid #1e293b;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-display);
}
.odds-tag {
  color: #94a3b8;
  font-size: 9px;
  font-weight: 700;
}
.odds-val {
  color: var(--cyan);
  font-weight: 700;
}

/* ========================================================
   CHANNEL BANK DRAWER
   ======================================================== */
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: -420px;
  width: 400px;
  background: #0f1420;
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.open {
  right: 0;
}

.drawer-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #141a29;
}
.drawer-title h3 {
  font-size: 16px;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}
.drawer-title p {
  font-size: 11px;
  color: var(--text-muted);
}
.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.drawer-close:hover {
  color: #fff;
}

.drawer-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: #0d111a;
}
.drawer-search input {
  width: 100%;
  background: #192133;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 12px;
  outline: none;
}
.drawer-search input:focus {
  border-color: var(--gold);
}

.category-pills {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.cat-pill {
  background: #1e293b;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.cat-pill.active {
  background: var(--gold);
  color: #000;
  font-weight: 700;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-card {
  background: #171d2b;
  border: 1px solid #232d42;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
}
.channel-card:hover {
  border-color: #3b4866;
  background: #1d2538;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.card-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-display);
  font-weight: 700;
}
.badge-hls { background: #065f46; color: #6ee7b7; }
.badge-youtube { background: #991b1b; color: #fca5a5; }
.badge-twitch { background: #581c87; color: #d8b4fe; }
.badge-iframe { background: #1e3a8a; color: #93c5fd; }
.badge-video { background: #713f12; color: #fde047; }

.card-category {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}
.card-url {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.assign-group {
  display: flex;
  gap: 4px;
}
.btn-assign {
  background: #1e293b;
  border: 1px solid #334155;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-assign:hover {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}
.card-tools {
  display: flex;
  gap: 4px;
}
.btn-tool {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}
.btn-tool:hover {
  color: #fff;
}

.drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: #141a29;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-full {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}
.btn-full.primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
}
.btn-full.secondary {
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
}
.btn-full.secondary:hover {
  background: #334155;
}

/* ========================================================
   MODALS
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: #111624;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}
.modal-card.wide {
  max-width: 860px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: #161c2d;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.modal-close:hover {
  color: #fff;
}

form {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
}
.form-group input,
.form-group textarea,
.form-group select {
  background: #1a2236;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 9px 12px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
}
.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}
.form-row {
  display: flex;
  gap: 12px;
}
.flex-1 { flex: 1; }

.security-notice {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.5;
}
.security-notice strong {
  color: var(--green);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}
.btn.primary {
  background: var(--gold);
  color: #000;
}
.btn.primary:hover {
  filter: brightness(1.1);
}
.btn.secondary {
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
}
.btn.secondary:hover {
  background: #334155;
}
.btn.small {
  padding: 5px 10px;
  font-size: 11px;
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  background: #0d121c;
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.settings-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Presets Tab Grid */
.presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.preset-card {
  background: #182030;
  border: 1px solid #2d3748;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preset-card h5 {
  font-size: 13px;
  color: #fff;
}
.preset-card p {
  font-size: 11px;
  color: var(--gold);
}
.preset-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* Shield Guide */
.shield-feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.shield-card {
  background: #141b29;
  border: 1px solid #232d40;
  border-radius: 6px;
  padding: 12px 16px;
}
.shield-card.active-shield {
  border-left: 3px solid var(--green);
}
.shield-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.shield-card p {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
}

/* Network Guide Boxes */
.ip-boxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 18px 0;
}
.ip-box {
  background: #171f30;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ip-url {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
}
.tv-guide-card {
  background: #131926;
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  border-radius: 4px;
}
.tv-guide-card h5 {
  font-size: 13px;
  color: #fff;
  margin-bottom: 8px;
}
.tv-guide-card ul {
  padding-left: 20px;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
}

/* Slot Picker Modal */
.slot-picker-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}
.slot-picker-search input {
  width: 100%;
  background: #192133;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 12px;
}
.slot-picker-list {
  padding: 12px 16px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slot-item {
  background: #182030;
  border: 1px solid #28354d;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
}
.slot-item:hover {
  background: #232e45;
  border-color: var(--gold);
}
.slot-item-title {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.slot-item-cat {
  font-size: 10px;
  color: var(--gold);
}
.slot-picker-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
}
