/* ============================================================
 *  style.css  –  Custom dark-golf theme on top of Bootstrap 5
 * ============================================================ */

:root,
[data-bs-theme="dark"] {
  --bs-body-bg:       #0a1a0f;
  --bs-body-color:    #e8f5ec;
  --bs-border-color:  rgba(125,255,156,.1);

  --accent:       #4ade80;
  --accent-dim:   rgba(74,222,128,.12);
  --red:          #f87171;
  --red-dim:      rgba(248,113,113,.12);
  --yellow:       #fbbf24;
  --yellow-dim:   rgba(251,191,36,.12);
  --cyan:         #67e8f9;
  --cyan-dim:     rgba(103,232,249,.12);
  --purple:       #c084fc;
  --purple-dim:   rgba(192,132,252,.12);
  --orange:       #fb923c;
  --orange-dim:   rgba(251,146,60,.12);

  --panel:        #0f2416;
  --muted:        #7da88a;
  --radius:       14px;
}

/* ===== Utilities ===== */
.text-accent  { color: var(--accent) !important; }
.bg-accent    { background: var(--accent) !important; color: #0a1a0f !important; }
.bg-panel     { background: var(--panel) !important; }
.fw-black     { font-weight: 900 !important; }
.ls-1         { letter-spacing: .5px; }
.ls-2         { letter-spacing: 2px; }
.border-accent-subtle { border-color: rgba(74,222,128,.15) !important; }
.btn-accent {
  background: var(--accent); color: #0a1a0f; border: 0;
}
.btn-accent:hover { background: #3ecf72; color: #0a1a0f; }

/* ===== Navbar ===== */
#topNav {
  background: var(--panel);
  backdrop-filter: blur(12px);
  z-index: 1040;
}
.main-content {
  padding-top: 64px;
  padding-bottom: 24px;
}
.settings-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  position: relative;
}

/* Update available dot on settings button */
.update-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  z-index: 2;
  pointer-events: none;
}

/* ===== Badges ===== */
.badge-wait {
  background: var(--red-dim); color: var(--red);
  font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
}
.badge-ready {
  background: var(--accent-dim); color: var(--accent);
  font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
}

/* ===== Mode Selection Cards ===== */
.mode-card {
  background: var(--panel);
  border: 1px solid rgba(74,222,128,.12);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(74,222,128,.15);
}
.mode-icon {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

/* ===== Stats Grid – CSS Grid layout ===== */
/* auto-fit: empty tracks collapse so fewer tiles = bigger tiles.
   Fixed max: tiles cap at a size, justify-content centers the remainder. */
#statsGrid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(130px, 45%), 320px));
  justify-content: center;
  gap: 10px;
  flex-wrap: unset !important;
}
/* Allow Bootstrap d-none to override the grid display (higher specificity) */
#statsGrid.d-none {
  display: none !important;
}
/* Override Bootstrap col-* classes inside the grid */
#statsGrid > .stat-tile {
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* ===== Stat Tiles ===== */
.tile {
  background: var(--panel);
  border: 1px solid rgba(125,255,156,.08);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 36px) clamp(12px, 2vw, 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  min-height: 120px;
  text-align: center;
  transition: opacity .2s;
  position: relative;
}
/* Tile info tooltip trigger */
.tile-info {
  position: absolute;
  top: 6px; right: 8px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
}
.tile-label {
  color: var(--muted);
  font-weight: 800;
  font-size: clamp(12px, 1.4vw, 18px);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.tile-num {
  font-weight: 900;
  font-size: clamp(42px, 10vw, 84px);
  line-height: 1;
  color: var(--bs-body-color);
}

/* tile color accents */
.tile-made  .tile-num  { color: var(--accent); }
.tile-miss  .tile-num  { color: var(--red); }
.tile-streak .tile-num { color: var(--yellow); }
.tile-best  .tile-num  { color: var(--cyan); }
.tile-first .tile-num  { color: var(--orange); }
.tile-clutch .tile-num { color: var(--purple); }
.tile-fatigue .tile-num { color: var(--cyan); }
.tile-comeback .tile-num { color: var(--orange); }

/* ===== Offcanvas / Settings ===== */
.section-title {
  color: var(--muted);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

/* Wi-Fi dot */
.wifi-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
  background: var(--red);
  display: inline-block;
}
.wifi-dot.online {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* Tile toggles */
.tile-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; cursor: pointer;
  font-weight: 700; font-size: 13px;
}
.tile-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ===== Update progress ===== */
#updateProgress .progress { background: rgba(255,255,255,.06); }
#updateProgress.error .progress-bar { background: var(--red) !important; animation: none !important; }
#updateProgress.error #updateLabel { color: var(--red) !important; }

/* Indeterminate progress bar animation */
.progress-bar-indeterminate {
  width: 40% !important;
  animation: indeterminate 1.2s ease-in-out infinite alternate !important;
}
@keyframes indeterminate {
  0%   { margin-left: 0%; }
  100% { margin-left: 60%; }
}

/* ===== Game Over Modal stats table ===== */
.go-stat-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  border-bottom: 1px solid rgba(125,255,156,.06);
  font-weight: 700; font-size: 14px;
}
.go-stat-row:last-child { border: 0; }
.go-stat-label { color: var(--muted); }
.go-stat-val   { color: var(--bs-body-color); }
.go-stat-val.positive { color: var(--accent); }
.go-stat-val.negative { color: var(--red); }

/* ===== Mode Header (progress / timer / score) ===== */
.mode-bar {
  background: var(--panel);
  border: 1px solid rgba(125,255,156,.08);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.mode-bar-label {
  font-weight: 800; font-size: 13px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); white-space: nowrap;
}
.mode-bar-value {
  font-weight: 900; font-size: clamp(18px, 3vw, 28px);
}

/* ===== Social links ===== */
.social-link {
  color: var(--muted);
  transition: color .15s;
}
.social-link:hover { color: var(--accent); }

/* ===== Logo link ===== */
#logoLink { cursor: pointer; }

/* ===== Responsive tile sizing ===== */

/* Small phones */
@media (max-width: 575.98px) {
  #statsGrid { grid-template-columns: repeat(auto-fit, minmax(min(110px, 45%), 200px)); gap: 8px; }
  .tile { min-height: 100px; padding: 14px 10px; }
  .tile-num { font-size: clamp(32px, 14vw, 56px); }
  .tile-label { font-size: clamp(10px, 2.5vw, 13px); }
  .main-content { padding-top: 56px; }
}

/* Tablets */
@media (min-width: 576px) and (max-width: 991.98px) {
  #statsGrid { grid-template-columns: repeat(auto-fit, minmax(150px, 280px)); gap: 10px; }
  .tile { min-height: 140px; }
  .tile-num { font-size: clamp(40px, 8vw, 72px); }
  .tile-label { font-size: clamp(11px, 2vw, 15px); }
}

/* Laptops / desktops */
@media (min-width: 992px) and (max-width: 1599.98px) {
  #statsGrid { grid-template-columns: repeat(auto-fit, minmax(180px, 380px)); gap: 12px; }
  .tile { min-height: 170px; }
  .tile-num { font-size: clamp(52px, 5vw, 88px); }
  .tile-label { font-size: 15px; }
}

/* Large screens / TV / projectors */
@media (min-width: 1600px) {
  #statsGrid { grid-template-columns: repeat(auto-fit, minmax(260px, 500px)); gap: 16px; }
  .tile { min-height: 240px; }
  .tile-num { font-size: clamp(72px, 5vw, 140px); }
  .tile-label { font-size: 18px; letter-spacing: 1.2px; }
}

/* Ultra-wide / very large displays */
@media (min-width: 2200px) {
  #statsGrid { grid-template-columns: repeat(auto-fit, minmax(340px, 650px)); gap: 20px; }
  .tile { min-height: 320px; border-radius: 20px; }
  .tile-num { font-size: clamp(96px, 5vw, 180px); }
  .tile-label { font-size: 22px; letter-spacing: 1.5px; }
  .tile-info { width: 24px; height: 24px; font-size: 14px; top: 10px; right: 12px; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  #statsGrid { grid-template-columns: repeat(auto-fit, minmax(120px, 240px)); gap: 6px; }
  .tile { min-height: 70px; padding: 8px; }
  .tile-num { font-size: clamp(24px, 5vh, 44px); }
  .tile-label { font-size: 10px; }
  .main-content { padding-top: 50px; padding-bottom: 8px; }
  #topNav { padding-top: 4px !important; padding-bottom: 4px !important; }
}

/* ===== Player Bar ===== */
#playerBar { display:flex; gap:6px; justify-content:center; flex-wrap:wrap; }
.player-tab {
  padding:4px 14px; border-radius:20px; font-weight:800; font-size:12px;
  text-transform:uppercase; letter-spacing:.5px; border:2px solid transparent;
  background:rgba(255,255,255,.05); transition:all .2s; white-space:nowrap;
}
.player-tab.out { opacity:.3; text-decoration:line-through; }

/* ===== Center player panels when uneven ===== */
#multiGrid { justify-content: center; }

/* ===== Player Panels (multiplayer split-screen) ===== */
.player-panel { position:relative; }
.player-panel .panel-inner {
  border:2px solid transparent; border-radius:var(--radius); padding:12px;
  background:var(--panel); transition:border-color .3s, opacity .3s; position:relative;
}
.panel-header {
  font-weight:900; font-size:14px; text-transform:uppercase; letter-spacing:1px;
  padding-bottom:6px; margin-bottom:8px; border-bottom:1px solid rgba(255,255,255,.08);
  display:flex; align-items:center; gap:8px;
}
.panel-name { white-space:nowrap; }
.panel-extra { font-size:13px; font-weight:700; margin-left:auto; white-space:nowrap; }

/* Survivor hearts — push to right; panel-extra is hidden for this mode */
.panel-lives { margin-left:auto; font-size:16px; letter-spacing:3px; line-height:1; }
.heart-full { color:var(--red); }
.heart-empty { color:rgba(255,255,255,.12); }

/* Relay break count */
.panel-breaks {
  margin-left:auto; font-size:11px; font-weight:700;
  color:var(--muted); text-transform:uppercase; letter-spacing:.5px;
}
.player-panel.dimmed .panel-inner { opacity:.4; }
.player-panel.eliminated .panel-inner { opacity:.15; }
.panel-overlay {
  position:absolute; top:0; left:0; right:0; bottom:0;
  display:flex; align-items:center; justify-content:center;
  font-size:2.5rem; font-weight:900; color:var(--accent);
  z-index:5; pointer-events:none; text-shadow:0 2px 12px rgba(0,0,0,.5);
  border-radius:var(--radius);
}

/* ===== Mini Tiles (inside multiplayer panels) ===== */
.mp-grid { justify-content: center; }
.mp-tile {
  background:rgba(255,255,255,.03); border:1px solid rgba(125,255,156,.06);
  border-radius:10px; padding:8px 4px; text-align:center;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  min-height:56px; justify-content:center;
}
.mp-tile-label {
  color:var(--muted); font-weight:700; font-size:clamp(10px, 1.2vw, 13px);
  text-transform:uppercase; letter-spacing:.5px;
}
.mp-tile-num { font-weight:900; font-size:clamp(1.3rem, 3vw, 2rem); line-height:1; }
.mp-tile-made .mp-tile-num { color:var(--accent); }
.mp-tile-miss .mp-tile-num { color:var(--red); }
.mp-tile-streak .mp-tile-num { color:var(--yellow); }
.mp-tile-best .mp-tile-num { color:var(--cyan); }
.mp-tile-lives .mp-tile-num { color:var(--red); }

/* ===== Game Over - Multiplayer standings ===== */
.mp-standing-card {
  background:rgba(255,255,255,.03); border-radius:10px;
  padding:12px; margin-bottom:10px;
}

/* ===== Responsive: small screen multiplayer ===== */
@media (max-width:767.98px) {
  #multiGrid .player-panel:not(.active) { display:none !important; }
  .mp-tile { min-height:52px; padding:8px 4px; }
  .mp-tile-num { font-size:1.2rem; }
  .mp-tile-label { font-size:10px; }
  .panel-lives { font-size:14px; letter-spacing:2px; }
}
