/* ==========================================================================
   SABO TV • ULTRA-LIGHTWEIGHT SMART TV ENGINE STYLESHEET (100% PURE CSS3)
   Optimized for Smart TVs (Tizen, webOS, Android TV, Sony, TCL, Hisense)
   Zero WASM • Zero Heavy Runtime • GPU Hardware Accelerated
   ========================================================================== */

:root {
  --bg-main: #06080D;
  --bg-card: rgba(15, 21, 32, 0.82);
  --bg-card-hover: rgba(22, 32, 48, 0.95);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-glass-bright: rgba(255, 255, 255, 0.22);
  --border-focus: #00F2FE;
  
  --accent-cyan: #00F2FE;
  --accent-green: #10B981;
  --accent-glow: rgba(0, 242, 254, 0.35);
  --accent-green-glow: rgba(16, 185, 129, 0.35);
  --accent-gold: #FBBF24;
  --accent-gold-glow: rgba(251, 191, 36, 0.40);
  --accent-red: #F43F5E;
  --accent-blue: #38BDF8;
  --accent-purple: #C084FC;

  --text-main: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.72);
  --text-muted: rgba(255, 255, 255, 0.45);

  --font-stack: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

/* ==========================================================================
   OLED BURN-IN PREVENTION & HARDWARE ACCELERATION
   Subtle 1px micro-shift every 5 minutes prevents burn-in on OLED TV panels
   ========================================================================== */
.oled-shift {
  animation: oledMicroShift 1200s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes oledMicroShift {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(1px, 0, 0); }
  50%  { transform: translate3d(1px, 1px, 0); }
  75%  { transform: translate3d(0, 1px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

.tv-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 0%, rgba(0, 230, 153, 0.08) 0%, transparent 60%),
              radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 50%),
              var(--bg-main);
}

/* ==========================================================================
   VIEW SWITCHING ENGINE
   ========================================================================== */
.tv-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  pointer-events: none;
}

.tv-view.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   TV HEADER
   ========================================================================== */
.tv-header {
  height: 80px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(7, 10, 15, 0.75);
  backdrop-filter: blur(16px);
  z-index: 10;
}

.tv-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tv-logo-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.tv-badge-icon {
  font-size: 22px;
}

.tv-logo-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
}

.accent-text {
  color: var(--accent-green);
  text-shadow: 0 0 12px var(--accent-glow);
}

.tv-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.tv-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.club-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.40);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-cyan);
  backdrop-filter: blur(8px);
}

.club-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-cyan);
}

.tv-clock {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
  letter-spacing: 1.5px;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   VIEW 1: STANDBY MAIN GRID
   ========================================================================== */
.standby-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 32px;
  padding: 32px 40px;
  overflow: hidden;
}

.tv-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.card-icon {
  font-size: 24px;
}

.card-header h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.badge-pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.10);
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text-secondary);
}

/* Pairing Left Card */
.pairing-card {
  align-items: center;
  text-align: center;
}

.qr-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.qr-canvas-box {
  width: 220px;
  height: 220px;
  background: #FFFFFF;
  padding: 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-canvas-box canvas, .qr-canvas-box svg {
  width: 100% !important;
  height: 100% !important;
}

.qr-scan-badge {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-green);
  background: rgba(0, 230, 153, 0.15);
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 230, 153, 0.3);
}

.pin-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 16px;
}

.pin-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.pin-code {
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 12px;
  color: var(--accent-cyan);
  text-shadow: 0 0 24px rgba(0, 242, 254, 0.65);
  font-variant-numeric: tabular-nums;
}

.pairing-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.pulse-indicator.live {
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulseGreen 2s infinite;
}

.pulse-indicator.red {
  background-color: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
  animation: pulseRed 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 14px var(--accent-green); }
  100% { transform: scale(0.95); opacity: 0.8; }
}

@keyframes pulseRed {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 14px var(--accent-red); }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.pairing-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.pairing-hint strong {
  color: var(--accent-green);
}

/* Table Selector Right Card */
.table-pills-container {
  margin-bottom: 16px;
}

.pills-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.table-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-pill {
  flex: 1 1 calc(25% - 8px);
  min-width: 80px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease-in-out;
}

.table-pill:hover, .table-pill:focus, .table-pill.focused {
  background: rgba(0, 230, 153, 0.15);
  border-color: var(--accent-green);
  box-shadow: 0 0 14px var(--accent-glow);
  transform: translateY(-2px);
}

.table-pill.active {
  background: linear-gradient(135deg, #00F2FE 0%, #06B6D4 100%);
  color: #030508;
  border-color: #00F2FE;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.45);
}

/* Cam Preview Frame */
.cam-preview-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000000;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  overflow: hidden;
  margin-bottom: 18px;
  min-height: 180px;
}

.cam-preview-header {
  height: 36px;
  padding: 0 14px;
  background: rgba(20, 26, 35, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.cam-title {
  font-weight: 700;
  color: var(--text-main);
}

.cam-status {
  font-weight: 800;
  color: var(--accent-green);
  font-size: 11px;
}

.cam-preview-content {
  flex: 1;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 420px);
  max-width: calc((100vh - 420px) * 16 / 9);
  margin: 0 auto;
  background: #040608;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cam-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.cam-placeholder-icon {
  font-size: 32px;
}

.hidden-iframe {
  display: none;
  width: 100%;
  height: 100%;
  border: none;
}

.cam-preview-content.streaming .cam-placeholder {
  display: none;
}

.cam-preview-content.streaming .hidden-iframe {
  display: block;
}

/* Action Buttons */
.standby-actions {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 12px;
}

.tv-btn {
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease-in-out;
}

.btn-primary {
  background: linear-gradient(135deg, #00F2FE 0%, #06B6D4 100%);
  color: #030508;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.35);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary.focused {
  background: linear-gradient(135deg, #38BDF8 0%, #00F2FE 100%);
  box-shadow: 0 0 24px rgba(0, 242, 254, 0.65);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-glass);
  color: var(--text-main);
}

.btn-secondary:hover, .btn-secondary:focus, .btn-secondary.focused {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-green);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-glass);
  color: var(--text-secondary);
}

.btn-ghost:hover, .btn-ghost:focus, .btn-ghost.focused {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-secondary);
  color: var(--text-main);
  transform: translateY(-2px);
}

/* ==========================================================================
   TV FOOTER
   ========================================================================== */
.tv-footer {
  height: 52px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-glass);
  background: rgba(7, 10, 15, 0.85);
  font-size: 12px;
  color: var(--text-muted);
}

.footer-remote-hints {
  display: flex;
  gap: 20px;
}

.hint-item kbd {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 700;
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}


/* ==========================================================================
   BRAND LOGO & BROADCAST SVG ICON SYSTEM (SSoT 2026)
   ========================================================================== */
.brand-logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 12px rgba(16, 185, 129, 0.25));
}

.tv-logo-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tv-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #FBBF24;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}

.svg-icon svg {
  width: 100%;
  height: 100%;
}

.cam-placeholder-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 24px rgba(16, 185, 129, 0.35));
}

.cam-placeholder-sub {
  display: block;
  margin: 6px auto 0;
  font-size: 12px;
  color: var(--text-muted, #64748B);
  max-width: 380px;
  line-height: 1.45;
  text-align: center;
}

.preview-match-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(7, 13, 19, 0.92);
  border: 1px solid rgba(16, 185, 129, 0.55);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75), 0 0 18px rgba(16, 185, 129, 0.22);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.preview-match-hud.hidden {
  display: none !important;
}

.pmh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.65);
  color: #FCA5A5;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.pmh-players {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
}

.pmh-player {
  font-size: 14px;
  font-weight: 800;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.pmh-rank {
  font-size: 11px;
  font-weight: 700;
  color: #10B981;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.16);
  margin-left: 4px;
}

.pmh-score-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  border-radius: 8px;
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.45);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 900;
  color: #00F2FE;
}

.pmh-tourney {
  font-size: 11px;
  font-weight: 600;
  color: #94A3B8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.table-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pill-cam-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

.table-pill.active .pill-cam-dot {
  background: #030508;
  box-shadow: none;
}
