/* /static/css/arena.css — Arena page styles */

/* ── Page root ── */
#arena-root {
  display: none;
  min-height: 100vh;
  background: var(--theme-bg-base, #0a1628);
}

#arena-root:empty { display: none; }

/* When arena is active, hide everything else and show arena */
body.arena-active #arena-root { display: block !important; }

body.arena-active .navbar,
body.arena-active #cover-page,
body.arena-active .workbench-layout,
body.arena-active .sidebar,
body.arena-active #main-app-wrapper {
  display: none !important;
}

/* Show landing-nav on arena - fixed at top (matches dashboard) */
body.arena-active .landing-nav {
  display: block !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
}

/* Ensure sport selector is visible on arena (override cover-active hide rule) */
body.arena-active .landing-nav .sport-selector {
  display: flex !important;
}

/* Keep bottom nav visible on arena */
body.arena-active .pb-bottom-nav {
  display: flex !important;
}

body.arena-active {
  padding-bottom: calc(var(--pb-bottom-nav-height, 64px) + max(env(safe-area-inset-bottom), 12px));
}

.arena-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px calc(var(--pb-bottom-nav-height, 64px) + 24px);
  padding-top: calc(70px + env(safe-area-inset-top, 0px));
}

/* ── Tab pills ── */
.arena-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 12px;
}

.arena-tabs-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.arena-tab-btn {
  appearance: none;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 8px 20px;
  color: #8b949e;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}

.arena-tab-btn.active {
  background: var(--theme-accent, #00D3BD);
  color: #000;
  border-color: transparent;
}

.arena-tab-btn:not(.active):hover {
  background: rgba(255,255,255,.1);
  color: #E6EDF3;
}

/* ── Hidden tabs (Duel Board + Leaderboard removed from UI) ── */
.arena-tab-mobile-only,
.arena-tab-btn[data-tab="leaderboard"] { display: none; }

/* ── Hide duel board sidebar section ── */
#arena-duel-board-section { display: none; }

/* ── Tab panels ── */
.arena-panel { display: none; }
.arena-panel.active { display: block; }

/* ── Two-column layout ── */
.arena-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
}

.arena-feed-col {
  flex: 1.5;
  min-width: 0;
}

.arena-sidebar {
  flex: 1;
  min-width: 0;
  position: sticky;
  top: calc(70px + env(safe-area-inset-top, 0px) + 16px);
}

/* ── Sidebar cards (glass style) ── */
.arena-sidebar-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.arena-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: #E6EDF3;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* ── Post status badges (My Posts / Challenged tabs) ── */
.arena-post-status {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.arena-post-active {
  background: rgba(0, 211, 189, .12);
  color: var(--theme-accent, #00D3BD);
}

.arena-post-expired {
  background: rgba(139, 148, 158, .12);
  color: #8b949e;
}

.arena-post-pending {
  background: rgba(255, 193, 7, .12);
  color: #ffc107;
}

/* ── How it works steps ── */
.arena-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.arena-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.arena-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--theme-accent, #00D3BD);
  color: #000;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.arena-step-text {
  flex: 1;
  min-width: 0;
}

.arena-step-title {
  font-size: 14px;
  font-weight: 700;
  color: #E6EDF3;
  margin-bottom: 2px;
}

.arena-step-desc {
  font-size: 12px;
  color: #8b949e;
  line-height: 1.4;
}

/* ── Loading / empty / not-logged-in states ── */
.arena-loading,
.arena-empty {
  text-align: center;
  padding: 48px 16px;
  color: #8b949e;
}
.arena-loading i { font-size: 24px; color: var(--theme-accent, #00D3BD); }
.arena-empty p { margin-top: 8px; font-size: 14px; }

.arena-not-logged-in {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-60, #b4d7c4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.arena-not-logged-in h2 {
  margin: 0;
  font-size: 22px;
  color: var(--ink-100, #ffffff);
}
.arena-not-logged-in p {
  margin: 0;
  color: var(--ink-50, #9ab8a8);
}
.arena-not-logged-in .btn {
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.arena-not-logged-in .btn-primary {
  background: var(--theme-gradient-primary, linear-gradient(135deg, #00F5D4 0%, #00D3BD 50%, #00AD84 100%));
  color: #000;
}
.arena-not-logged-in .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 211, 189, 0.3);
}

/* ── Feed card ── */
.arena-feed-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.arena-feed-card:hover {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.15);
}

.arena-feed-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.arena-feed-shield {
  width: 36px;
  height: auto;
  flex-shrink: 0;
}
.arena-feed-user-info { flex: 1; min-width: 0; }
.arena-feed-username {
  font-weight: 600;
  font-size: 14px;
  color: #E6EDF3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arena-feed-tier {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}
.arena-feed-time {
  font-size: 12px;
  color: var(--theme-accent, #00D3BD);
  flex-shrink: 0;
  font-weight: 600;
}
.arena-feed-time.closed {
  color: #f85149;
}

/* ── Collapsed summary row ── */
.arena-feed-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 0;
  cursor: pointer;
}
.arena-feed-leg-count {
  font-size: 13px;
  font-weight: 600;
  color: #E6EDF3;
}
.arena-feed-chevron {
  margin-left: auto;
  font-size: 12px;
  color: #6e7681;
  transition: transform .2s ease;
}
.arena-feed-card.expanded .arena-feed-chevron {
  transform: rotate(180deg);
}

/* ── Legs list ── */
.arena-feed-legs {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.arena-feed-legs.collapsed {
  display: none;
}
.arena-feed-card.expanded .arena-feed-legs.collapsed {
  display: flex;
}
.arena-feed-leg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.arena-feed-leg:last-child { border-bottom: none; }

.arena-feed-leg-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.arena-feed-leg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
  flex-shrink: 0;
}
.arena-feed-leg-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.08);
}
.arena-feed-leg-team-badge {
  position: absolute;
  bottom: -2px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: none;
  object-fit: contain;
}

.arena-feed-leg-info {
  flex: 1;
  min-width: 0;
}
.arena-feed-leg-player {
  font-weight: 600;
  font-size: 14px;
  color: #E6EDF3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arena-feed-leg-pick {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}
.arena-feed-leg-odds {
  color: var(--theme-accent, #00D3BD);
  font-weight: 600;
}
.arena-feed-leg-matchup {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}

/* ── Summary row badges ── */
.arena-feed-odds-badge {
  font-size: 14px;
  font-weight: 700;
  color: var(--theme-accent, #00D3BD);
}

/* Hook text in collapsed summary */
.arena-feed-hook-text {
  margin-left: auto;
  font-size: 12px;
  color: #8b949e;
}
.arena-feed-hook-count {
  color: var(--theme-accent, #00D3BD);
  font-weight: 600;
}

/* Incentive text above challenge button */
.arena-feed-challenge-hook {
  display: none;
  text-align: center;
  font-size: 12px;
  color: #6e7681;
  margin-top: 10px;
  margin-bottom: 6px;
}
.arena-feed-card.expanded .arena-feed-challenge-hook {
  display: block;
}
.arena-feed-challenge-hook-user {
  color: #E6EDF3;
  font-weight: 600;
}

/* ── Challenge button ── */
.arena-feed-challenge-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: var(--theme-accent, #00D3BD);
  color: #000;
  border: none;
  border-radius: 10px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.arena-feed-card.expanded .arena-feed-challenge-btn {
  display: flex;
}
.arena-feed-challenge-btn:hover:not(:disabled) {
  opacity: .85;
}
.arena-feed-challenge-btn.accepted {
  background: rgba(255,255,255,.08);
  color: #8b949e;
  cursor: default;
}
.arena-feed-challenge-btn.accepted i {
  color: var(--theme-accent, #00D3BD);
}

/* ── Publish button ── */
.arena-publish-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--theme-accent, #00D3BD);
  color: #000;
  border: none;
  border-radius: 10px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.arena-publish-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.arena-publish-btn:hover:not(:disabled) {
  opacity: .9;
}

/* ── Duel Board cards ── */
.arena-board-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.arena-board-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
}
.arena-board-wins { color: var(--theme-accent, #00D3BD); }
.arena-board-losses { color: #f85149; }
.arena-board-winrate { color: #8b949e; }

/* ── Rankings cards (reuses leaderboard endpoint) ── */
.arena-rankings-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.arena-rank-pos {
  font-weight: 700;
  font-size: 16px;
  color: #8b949e;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.arena-rank-pos.top-3 { color: var(--theme-accent, #00D3BD); }
.arena-rank-shield {
  width: 36px;
  height: auto;
  flex-shrink: 0;
}
.arena-rank-info { flex: 1; min-width: 0; }
.arena-rank-name {
  font-weight: 600;
  font-size: 14px;
  color: #E6EDF3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arena-rank-tier {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}
.arena-rank-highlight {
  border-color: var(--theme-accent, #00D3BD);
  background: rgba(0, 211, 189, .06);
}

/* ── Light theme ── */
[data-theme="light"] #arena-root { background: #f6f8fa; }
[data-theme="light"] .arena-sidebar-card { background: #fff; border-color: rgba(0,0,0,.08); }
[data-theme="light"] .arena-sidebar-title { color: #1f2328; border-bottom-color: rgba(0,0,0,.06); }
[data-theme="light"] .arena-feed-card { background: #fff; border-color: rgba(0,0,0,.08); }
[data-theme="light"] .arena-feed-username,
[data-theme="light"] .arena-rank-name,
[data-theme="light"] .arena-feed-leg-player,
[data-theme="light"] .arena-feed-leg-count { color: #1f2328; }
[data-theme="light"] .arena-board-card { background: #fff; border-color: rgba(0,0,0,.08); }
[data-theme="light"] .arena-feed-leg { border-bottom-color: rgba(0,0,0,.06); }
[data-theme="light"] .arena-feed-leg-avatar-fallback { background: rgba(0,0,0,.06); color: rgba(0,0,0,.4); }
[data-theme="light"] .arena-rankings-card { background: #fff; border-color: rgba(0,0,0,.08); }
[data-theme="light"] .arena-feed-challenge-hook-user { color: #1f2328; }
[data-theme="light"] .arena-step-title { color: #1f2328; }
[data-theme="light"] .arena-tab-btn { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.08); color: #57606a; }
[data-theme="light"] .arena-tab-btn.active { background: var(--theme-accent, #00D3BD); color: #000; }

/* ── Publish button in parlay card footer ── */
.parlay-publish-btn {
  background: transparent;
  color: var(--theme-accent, #00D3BD);
  border: 1px solid var(--theme-accent, #00D3BD);
  border-radius: 8px;
  padding: 9px 14px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.parlay-publish-btn:hover {
  background: var(--theme-accent, #00D3BD);
  color: #060e1e;
}
.parlay-publish-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 1000px) {
  .parlay-publish-btn {
    padding: 10px 22px;
    font-size: 18px;
    border-radius: 10px;
  }
}

/* ── Mobile ── */
@media (max-width: 1000px) {
  .arena-page {
    max-width: none;
    padding: 12px;
    padding-top: calc(70px + env(safe-area-inset-top, 0px) + 30px);
    padding-bottom: calc(var(--pb-bottom-nav-height, 110px) + 20px);
  }

  /* Wrap so publish row drops below tabs */
  .arena-tabs { flex-wrap: wrap; justify-content: center; }
  .arena-tabs-right { order: 99; width: 100%; margin-left: 0; margin-top: 14px; justify-content: center; }

  .arena-publish-btn { padding: 16px 36px; font-size: 24px; border-radius: 16px; }

  /* Hide how-it-works from sidebar on mobile (use ? popup instead) */
  #arena-how-it-works { display: none; }

  /* Tabs */
  .arena-tabs { gap: 12px; padding: 16px 0 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .arena-tab-btn { padding: 14px 34px; font-size: 26px; border-radius: 32px; flex-shrink: 0; }

  /* Post status badges */
  .arena-post-status { font-size: 16px; padding: 5px 14px; border-radius: 16px; }

  /* Two-column → single column */
  .arena-main-content {
    flex-direction: column;
  }

  .arena-sidebar {
    position: static;
    width: 100%;
  }

  .arena-feed-col {
    width: 100%;
  }

  /* Sidebar cards mobile */
  .arena-sidebar-card { padding: 20px; border-radius: 16px; margin-bottom: 16px; }
  .arena-sidebar-title { font-size: 22px; margin-bottom: 16px; padding-bottom: 12px; }

  /* How it works mobile */
  .arena-step-num { width: 36px; height: 36px; font-size: 17px; }
  .arena-step-title { font-size: 19px; }
  .arena-step-desc { font-size: 15px; }
  .arena-steps { gap: 20px; }

  /* Loading / empty */
  .arena-loading i { font-size: 32px; }
  .arena-empty p { font-size: 20px; }

  /* Not logged in */
  .arena-not-logged-in { gap: 32px; }
  .arena-not-logged-in h2 { font-size: 38px; }
  .arena-not-logged-in p { font-size: 26px; }
  .arena-not-logged-in .btn-primary {
    font-size: 24px;
    font-weight: 700;
    padding: 22px 52px;
    border-radius: 18px;
  }

  /* Feed cards — Daily Duel */
  .arena-feed-card { padding: 18px 20px; margin-bottom: 16px; border-radius: 16px; }
  .arena-feed-card-header { gap: 14px; margin-bottom: 12px; }
  .arena-feed-shield { width: 52px; }
  .arena-feed-username { font-size: 20px; }
  .arena-feed-tier { font-size: 16px; }
  .arena-feed-time { font-size: 16px; }

  /* Summary row */
  .arena-feed-summary { gap: 14px; padding: 12px 0; }
  .arena-feed-leg-count { font-size: 19px; }
  .arena-feed-odds-badge { font-size: 20px; }
  .arena-feed-hook-text { font-size: 16px; }
  .arena-feed-challenge-hook { font-size: 17px; margin-top: 14px; margin-bottom: 8px; }
  .arena-feed-chevron { font-size: 16px; }

  /* Legs */
  .arena-feed-leg { gap: 14px; padding: 12px 4px; }
  .arena-feed-leg-avatar { width: 52px; height: 52px; }
  .arena-feed-leg-avatar-fallback { font-size: 19px; }
  .arena-feed-leg-team-badge { width: 24px; height: 24px; }
  .arena-feed-leg-player { font-size: 20px; }
  .arena-feed-leg-pick { font-size: 17px; }
  .arena-feed-leg-matchup { font-size: 17px; }

  /* Challenge / Publish buttons */
  .arena-feed-challenge-btn { padding: 16px; font-size: 20px; border-radius: 14px; margin-top: 14px; }

  /* Rankings (standalone, if used outside sidebar) */
  .arena-rankings-card { padding: 16px 18px; margin-bottom: 12px; border-radius: 16px; gap: 16px; }
  .arena-rank-pos { font-size: 24px; width: 36px; }
  .arena-rank-shield { width: 52px; }
  .arena-rank-name { font-size: 20px; }
  .arena-rank-tier { font-size: 16px; }

  /* Duel Board (standalone, if used outside sidebar) */
  .arena-board-card { padding: 16px 18px; margin-bottom: 12px; border-radius: 16px; gap: 16px; }
  .arena-board-stats { gap: 12px; font-size: 19px; }

  /* Publish modal */
  .arena-publish-modal-inner { max-width: 460px !important; padding: 32px !important; gap: 14px !important; border-radius: 20px !important; }
  .arena-publish-modal-title { font-size: 24px !important; margin-bottom: 6px !important; }
  .arena-publish-option { font-size: 22px !important; padding: 20px !important; border-radius: 16px !important; }
}

/* ── How It Works help button (mobile only) ── */
.arena-help-btn {
  display: none;
}

@media (max-width: 1000px) {
  .arena-help-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: #8b949e;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
  }

  .arena-help-btn:hover,
  .arena-help-btn:active {
    background: rgba(255,255,255,.14);
    color: #E6EDF3;
  }
}

/* ── How It Works popup overlay ── */
.arena-hiw-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arena-hiw-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
}

.arena-hiw-popup {
  position: relative;
  background: var(--theme-bg-base, #0f1214);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 32px;
  max-width: 500px;
  width: 92%;
}

.arena-hiw-popup .arena-sidebar-title {
  font-size: 26px;
  margin-bottom: 20px;
  padding-bottom: 14px;
}

.arena-hiw-popup .arena-steps { gap: 22px; }
.arena-hiw-popup .arena-step-num { width: 38px; height: 38px; font-size: 18px; }
.arena-hiw-popup .arena-step-title { font-size: 24px; }
.arena-hiw-popup .arena-step-desc { font-size: 22px; line-height: 1.5; }

.arena-hiw-close {
  position: absolute;
  top: 20px;
  right: 16px;
  appearance: none;
  background: none;
  border: none;
  color: #8b949e;
  font-size: 32px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.arena-hiw-close:hover { color: #E6EDF3; }

[data-theme="light"] .arena-hiw-popup { background: #fff; border-color: rgba(0,0,0,.1); }
[data-theme="light"] .arena-help-btn { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.1); color: #57606a; }
[data-theme="light"] .arena-hiw-close { color: #57606a; }
