/* =========================================================================
   tournament.css — competition / season landing page.
   Extracted from views/tournament.js. Hooks into the unified token palette
   (tokens.css). The round-progress bar reads its width from the
   --round-progress custom property set inline by the view.
   ========================================================================= */

.tournament-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}

.tournament-badge {
  width: 90px;
  height: 90px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.tournament-badge img {
  width: 105%;
}

.tournament-title {
  margin: 0;
  font-size: 1.8rem;
  color: var(--ink-strong);
}

.tournament-subtitle {
  margin: 4px 0 0 0;
  color: var(--ink-muted);
  font-size: 1rem;
}

.tournament-info {
  flex: 1 1 320px;
  min-width: 240px;
}

.tournament-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  color: #374151;
  font-size: 0.95rem;
}

/* Tournament-page narrower pill override (the global `.pill` lives in
   components.css; tournament's version is plainer / less emphasised). */
body.page-tournament .pill {
  padding: 6px 10px;
  background: #f3f4f6;
  border-radius: var(--radius-pill);
  font-weight: 600;
  border: none;
  text-transform: none;
  letter-spacing: 0;
  color: #1f2937;
}

/* ---------------------------------------------------------------------------
   Season dropdown (current season label + menu)
   --------------------------------------------------------------------------- */
.season-dropdown {
  position: relative;
  display: inline-flex;
}

.season-dropdown summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-warm);
  background: rgba(255, 112, 67, 0.08);
  font-weight: 600;
  color: #4b5563;
}

.season-dropdown summary::-webkit-details-marker {
  display: none;
}

.season-caret {
  font-size: 12px;
  transform: translateY(-1px);
}

.season-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 8px 0;
  z-index: 10;
}

.season-menu-item {
  padding: 8px 14px;
  font-size: 0.95rem;
  color: var(--ink-strong);
}

.season-menu-item.is-active {
  background: var(--color-soft-translucent);
  font-weight: 700;
}

/* ---------------------------------------------------------------------------
   Round progress bar (top-of-page)
   The view sets `style="--round-progress: 42%"` on the parent so this stays
   static CSS.
   --------------------------------------------------------------------------- */
.round-progress {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  min-width: 300px;
  width: 100%;
  margin-top: 20px;
}

.round-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-strong);
}

.round-progress-count {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.round-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-overlay);
  overflow: hidden;
}

.round-progress-bar span {
  display: block;
  height: 100%;
  width: var(--round-progress, 0%);
  background: linear-gradient(90deg, #ec407a 0%, var(--color-primary-strong) 100%);
  transition: width 0.3s ease;
}

.round-progress-meta {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   Round bar (prev / current / next round selector strip)
   --------------------------------------------------------------------------- */
.round-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  position: relative;
  z-index: 5;
  overflow: visible;
  background: #000;
}

.round-bar.round-bar-dates {
  display: block;
  grid-template-columns: none;
  padding: 6px 8px;
}

.round-bar a,
.round-bar span {
  color: var(--color-soft);
  text-decoration: none;
  font-weight: 600;
  padding: 2px 10px;
}

.round-bar a:hover {
  text-shadow: 1px 0 0 currentColor;
}

.round-bar .round-prev {
  justify-self: start;
}

.round-bar .round-current {
  justify-self: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-overlay);
  color: var(--color-soft);
  font-size: 17px;
}

.round-current-wrap {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.round-bar .round-next {
  justify-self: end;
}

.round-bar a.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Date-based round bar (date strip instead of "round 5 of 17") */
.round-date-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: space-between;
  width: 100%;
}

.round-date {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: 0.01em;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  transition: background 0.2s ease;
}

.round-date-weekday {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.round-date-day {
  font-size: 11px;
  font-weight: 600;
}

.round-date:hover     { background: rgba(255, 255, 255, 0.18); }
.round-date.is-current { background: rgba(255, 255, 255, 0.28); }

@media (max-width: 900px) {
  .round-bar.round-bar-dates {
    overflow-x: auto;
  }
  .round-date-list {
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-width: max-content;
  }
  .round-date {
    white-space: nowrap;
  }
}

/* ---------------------------------------------------------------------------
   Round menu (expandable dropdown showing all rounds)
   --------------------------------------------------------------------------- */
.round-menu {
  position: relative;
  z-index: 30;
}

.round-menu summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.08);
  user-select: none;
  font-size: 0.9rem;
  gap: 6px;
  transition: background 0.2s ease;
}

.round-menu summary::-webkit-details-marker {
  display: none;
}

.round-menu[open] summary {
  background: rgba(15, 23, 42, 0.14);
}

.round-menu summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-soft);
  border-bottom: 2px solid var(--color-soft);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-left: 5px;
  margin-top: -2px;
}

.round-menu[open] summary::after {
  transform: rotate(-135deg);
}

.round-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 560px;
  max-width: 680px;
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: var(--surface);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  z-index: 200;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.round-menu-title {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.round-menu-list a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-strong);
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.15;
  background: rgba(15, 23, 42, 0.03);
  word-break: break-word;
}

.round-menu-list a:hover {
  background: rgba(15, 23, 42, 0.08);
}

.round-menu-list a.is-current {
  background: rgba(15, 23, 42, 0.14);
  font-weight: 700;
}

/* ---------------------------------------------------------------------------
   Round groups (e.g. "Group A", "Group B")
   --------------------------------------------------------------------------- */
.round-group {
  margin-top: 16px;
}

.round-group h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #374151;
}

.round-group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.round-matches-content .gw-competition {
  display: none !important;
}

/* Round matches list layout (content + sidebar ad) */
.round-matches-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.round-matches-ad {
  width: 300px;
  flex: 0 0 300px;
  position: sticky;
  top: 20px;
}

.round-matches-ad .ad-rectangle {
  width: 300px;
  height: 600px;
  background: #f0f0f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.round-matches-content {
  flex: 1 1 auto;
  min-width: 0;
}

/* Hide the recent-matches default sidebar ad when we are already showing
   the round-matches ad in the same view. */
body.page-tournament .matches-sidebar {
  display: none !important;
}

@media (max-width: 1100px) {
  .round-matches-layout {
    flex-direction: column;
  }
  .round-matches-ad {
    position: relative;
    width: 100%;
    flex: 0 0 auto;
  }
  .round-matches-ad .ad-rectangle {
    width: 100%;
    height: 250px;
  }
}

/* Tournament-side sky ads (160x600) */
body.page-tournament .page-sidebar-left .ad-sky,
body.page-tournament .page-sidebar-right .ad-sky {
  background: transparent;
  border: 0;
  height: 600px;
  width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 20px;
}
