/* ===================================================
   Taekwondo Championship Arena Board Stylesheet
   File: /assets/css/arena-board.css
   Root: .tm-arena-board / [data-arena-board]
   =================================================== */

:root {
  --arena-bg: #080b12;
  --arena-panel: #303440;
  --arena-row-bg: #292d38;
  --arena-divider: rgba(255, 255, 255, 0.14);
  --arena-blue-dark: #1550c6;
  --arena-blue-light: #2675ed;
  --arena-red-dark: #a23542;
  --arena-red-light: #d64b59;
  --arena-timer: #d4ef42;
  --arena-text: #ffffff;
  --arena-muted: #c4c8d1;
  --arena-header-height: clamp(42px, 5vh, 62px);
}

/* Controlled Reset for Arena Board Component */
.tm-arena-board,
.tm-arena-board *,
.tm-arena-board *::before,
.tm-arena-board *::after {
  box-sizing: border-box;
}

.tm-arena-board button,
.tm-arena-board div,
.tm-arena-board span,
.tm-arena-board h1 {
  font-family: Arial, Helvetica, sans-serif;
  user-select: none;
}

body.arena-fullscreen-active {
  overflow: hidden !important;
}

/* Base Arena Board Layout (Web & Preview) */
.tm-arena-board {
  width: 100%;
  height: min(100vh, 1080px);
  display: grid;
  grid-template-rows: var(--arena-header-height) minmax(0, 1fr);
  background: var(--arena-bg);
  color: var(--arena-text);
  overflow: hidden;
  border-radius: 2px;
  border: 1px solid var(--arena-divider);
}

.tm-arena-board:not(:fullscreen) {
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: none;
}

/* Fullscreen & Overlay Viewport Auto-Adjust Mode */
.tm-arena-board:fullscreen,
.tm-arena-board:-webkit-full-screen,
.tm-arena-board:-moz-full-screen,
.tm-arena-board:-ms-fullscreen,
#tm-live-fullscreen-overlay:not(.hidden) {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  overflow: hidden !important;
  background: var(--arena-bg, #080b12) !important;
  display: grid !important;
  grid-template-rows: var(--arena-header-height, 50px) minmax(0, 1fr) !important;
  z-index: 99999 !important;
}

#tm-live-fullscreen-overlay.hidden {
  display: none !important;
}

.tm-arena-board:fullscreen .tm-arena-rings,
.tm-arena-board:-webkit-full-screen .tm-arena-rings,
.tm-arena-board:-moz-full-screen .tm-arena-rings,
.tm-arena-board:-ms-fullscreen .tm-arena-rings,
#tm-live-fullscreen-overlay:not(.hidden) .tm-arena-rings {
  height: calc(100vh - var(--arena-header-height, 50px)) !important;
  max-height: calc(100vh - var(--arena-header-height, 50px)) !important;
  display: grid !important;
  grid-template-rows: repeat(5, minmax(0, 1fr)) !important;
  gap: 3px !important;
  padding: 3px 8px 6px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

/* ===================================================
   1. ARENA BOARD HEADER
   =================================================== */
.tm-arena-board .tm-arena-header {
  height: var(--arena-header-height);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #1c1f28;
  border-bottom: 1px solid var(--arena-divider);
}

.tm-arena-board .tm-arena-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 25%;
}

.tm-arena-board .tm-arena-logo {
  height: clamp(20px, 3.5vh, 32px);
  width: auto;
  object-fit: contain;
}

.tm-arena-board .tm-arena-header-center {
  flex: 1;
  text-align: center;
}

.tm-arena-board .tm-arena-title {
  font-size: clamp(12px, 1.2vw, 18px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.tm-arena-board .tm-arena-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 28%;
  font-family: monospace;
  font-weight: 700;
  font-size: clamp(11px, .9vw, 14px);
  color: var(--arena-muted);
}

.tm-arena-board .tm-live-clock {
  background: #292d38;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid var(--arena-divider);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.tm-arena-board .tm-status-ind {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--arena-timer);
  box-shadow: 0 0 6px var(--arena-timer);
  display: inline-block;
}

.tm-arena-board .tm-status-ind.offline {
  background-color: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.tm-arena-board .tm-fullscreen-btn {
  background: var(--arena-panel);
  color: #fff;
  border: 1px solid var(--arena-divider);
  border-radius: 2px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tm-arena-board .tm-fullscreen-btn:hover {
  background: #3e4457;
}

/* Controls Toolbar for Manual Pagination */
.tm-arena-board .tm-controls-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tm-arena-board .tm-btn-nav {
  background: #292d38;
  color: #fff;
  border: 1px solid var(--arena-divider);
  border-radius: 2px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

/* ===================================================
   2. ARENA RINGS GRID (5 EVEN ROWS)
   =================================================== */
.tm-arena-board .tm-arena-rings {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 3px 8px 6px;
  box-sizing: border-box;
}

/* ===================================================
   3. RING ROW (3-COLUMN CSS GRID)
   =================================================== */
.tm-arena-board .tm-arena-ring {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 46fr) minmax(74px, 8fr) minmax(0, 46fr);
  overflow: hidden;
  border: 1px solid var(--arena-divider);
  background: var(--arena-row-bg);
  border-radius: 2px;
}

/* ===================================================
   4. COLUMN 1: CURRENT BOUT PANEL
   =================================================== */
.tm-arena-board .tm-current-bout {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(22px, 28%) minmax(0, 36%) minmax(0, 36%);
  background: #242731;
}

.tm-arena-board .tm-current-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 6px;
  background: #1c1f28;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-width: 0;
}

.tm-arena-board .tm-timer {
  background: var(--arena-timer);
  color: #000;
  font-weight: 900;
  font-size: clamp(12px, 1.1vw, 18px);
  padding: 1px 6px;
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  shrink: 0;
}

.tm-arena-board .tm-bout-num {
  font-family: monospace;
  font-weight: 900;
  font-size: clamp(11px, 1vw, 16px);
  color: #fff;
  shrink: 0;
}

.tm-arena-board .tm-bout-desc {
  flex: 1;
  min-width: 0;
  font-size: clamp(8px, .55vw, 11px);
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-arena-board .tm-score-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(9px, .65vw, 12px);
  font-weight: 900;
  color: var(--arena-muted);
  font-family: monospace;
  shrink: 0;
}

.tm-arena-board .tm-score-labels span {
  width: 20px;
  text-align: center;
}

.tm-arena-board .tm-score-labels span.tm-score-lbl {
  color: var(--arena-timer);
  width: 36px;
}

/* Athlete Rows (Blue & Red) */
.tm-arena-board .tm-current-athlete {
  display: grid;
  grid-template-columns: minmax(24px, 6%) minmax(0, 1fr) minmax(90px, 30%);
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-width: 0;
}

.tm-arena-board .tm-athlete-status-badge {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(10px, 0.85vw, 14px);
  font-weight: 900;
  text-transform: uppercase;
  text-align: center;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  justify-self: end;
}

.tm-arena-board .tm-ring-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: monospace;
  font-size: clamp(9px, 0.65vw, 12px);
  font-weight: 900;
  color: var(--arena-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--arena-divider);
}

.tm-arena-board .tm-progress-bar-bg {
  width: clamp(45px, 5vw, 85px);
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.tm-arena-board .tm-progress-bar-fill {
  height: 100%;
  background: #34d399;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.tm-arena-board .tm-progress-percent {
  color: #34d399;
  font-weight: 900;
}

/* Transparent Side Hover Navigation Arrows */
.tm-arena-board .tm-arena-side-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999;
  width: 48px;
  height: 90px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.15;
  transition: all 0.25s ease-in-out;
  backdrop-filter: blur(4px);
}

.tm-arena-board .tm-arena-side-arrow:hover {
  opacity: 0.95;
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.tm-arena-board .tm-arena-side-arrow.tm-side-prev {
  left: 0;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  border-left: none;
}

.tm-arena-board .tm-arena-side-arrow.tm-side-next {
  right: 0;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  border-right: none;
}

.tm-arena-board .tm-current-athlete.tm-athlete-blue {
  background: linear-gradient(90deg, #1550c6 0%, #2675ed 100%);
}

.tm-arena-board .tm-current-athlete.tm-athlete-red {
  background: linear-gradient(90deg, #a23542 0%, #d64b59 100%);
}

.tm-arena-board .tm-current-athlete.placeholder {
  background: rgba(255,255,255,0.05);
  border: 1px dashed rgba(255,255,255,0.1);
}

.tm-arena-board .tm-flag {
  width: 22px;
  height: 15px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 1px;
}

.tm-arena-board .tm-athlete-name-container {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  line-height: 1.1;
}

.tm-arena-board .tm-athlete-name {
  font-size: clamp(11px, 0.95vw, 17px);
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-arena-board .tm-athlete-club {
  font-size: clamp(8px, 0.65vw, 11px);
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.tm-arena-board.tm-hide-club .tm-athlete-club,
.tm-arena-board.tm-hide-club .tm-q-athlete-club {
  display: none !important;
}

.tm-arena-board.tm-hide-flag .tm-flag {
  display: none !important;
}

/* Uninspected Athlete Desaturated Background & Watermark */
.tm-arena-board .tm-current-athlete.tm-uninspected {
  position: relative;
}

.tm-arena-board .tm-current-athlete.tm-athlete-blue.tm-uninspected {
  background: linear-gradient(90deg, #334155 0%, #475569 100%) !important;
}

.tm-arena-board .tm-current-athlete.tm-athlete-red.tm-uninspected {
  background: linear-gradient(90deg, #451a1a 0%, #582020 100%) !important;
}

.tm-arena-board .tm-inspection-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.4) !important;
  z-index: 10;
  pointer-events: none;
}

.tm-arena-board .tm-inspection-watermark span {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(9px, 0.8vw, 13px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fbbf24;
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.6);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.tm-arena-board .tm-round-score {
  font-family: monospace;
  font-size: clamp(12px, 1vw, 18px);
  font-weight: 900;
  text-align: center;
  color: #fff;
}

.tm-arena-board .tm-match-score {
  font-family: monospace;
  font-size: clamp(13px, 1.1vw, 20px);
  font-weight: 900;
  text-align: center;
  color: var(--arena-timer);
}

/* ===================================================
   5. COLUMN 2: RING NUMBER PANEL
   =================================================== */
.tm-arena-board .tm-ring-number {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(42px, 5vw, 78px);
  font-weight: 500;
  color: #fff;
  border-left: 1px solid rgba(255,255,255,.12);
  border-right: 1px solid rgba(255,255,255,.12);
  background: #303440;
  line-height: 1;
}

/* ===================================================
   6. COLUMN 3: UPCOMING BOUTS PANEL (3 QUEUED BOUTS)
   =================================================== */
.tm-arena-board .tm-ring-queue {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 2px;
  background: #242731;
}

.tm-arena-board .tm-queued-bout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(58px, 14%) minmax(0, 43%) minmax(0, 43%);
  align-items: center;
  gap: 2px;
  background: #292d38;
}

.tm-arena-board .tm-queue-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2px 4px;
  background: #1c1f28;
  height: 100%;
}

.tm-arena-board .tm-q-bout-num {
  font-family: monospace;
  font-size: clamp(10px, .8vw, 14px);
  font-weight: 900;
  color: #fff;
}

.tm-arena-board .tm-q-cat {
  font-size: clamp(8px, .55vw, 11px);
  font-weight: 700;
  color: var(--arena-muted);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-arena-board .tm-queue-blue {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  height: 100%;
  background: linear-gradient(90deg, #1854c7, #2672e7);
  min-width: 0;
  overflow: hidden;
}

.tm-arena-board .tm-queue-red {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 2px 6px;
  height: 100%;
  background: linear-gradient(90deg, #b23a47, #d24b58);
  min-width: 0;
  overflow: hidden;
}

.tm-arena-board .tm-queue-blue.placeholder, 
.tm-arena-board .tm-queue-red.placeholder {
  background: rgba(255,255,255,0.05);
}

.tm-arena-board .tm-q-athlete-container {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  line-height: 1.05;
}

.tm-arena-board .tm-queue-red .tm-q-athlete-container {
  align-items: flex-end;
  text-align: right;
}

.tm-arena-board .tm-q-athlete-name {
  font-size: clamp(10px, 0.85vw, 15px);
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-arena-board .tm-q-athlete-club {
  font-size: clamp(8px, 0.6vw, 10px);
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
