/**
 * VBM Design System — org.css
 *
 * Page-level layout classes for public-facing org pages:
 * homepage (index), event detail, tournament, league, training.
 *
 * DEPENDENCIES (must be loaded before this file):
 *   1. tokens.css    — CSS custom properties (colors, spacing, z-index, etc.)
 *   2. components.css — Shared UI building blocks used within these layouts
 *
 * Sections:
 *   01. Page Base          (.vbm-page)
 *   02. Org Header         (.vbm-header)
 *   03. Calendar Strip     (.vbm-calendar-strip)
 *   04. Compact Hero       (.vbm-hero)
 *   05. Content Area       (.vbm-content)
 *   06. Event List         (.vbm-event-list)
 *   07. Footer             (.vbm-footer)
 *   08. Standings Table    (.vbm-table-wrap / .vbm-table)
 */


/* ==== 01. PAGE BASE ==== */

.vbm-page {
  background: var(--vbm-bg-deep);
  color: var(--vbm-text-primary);
  font-family: var(--vbm-font);
  font-size: var(--vbm-text-base); /* 15px */
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}


/* ==== 02. ORG HEADER ==== */

.vbm-header {
  position: sticky;
  top: 0;
  z-index: var(--vbm-z-header);
  background: var(--vbm-header-bg);
  border-bottom: 1px solid var(--vbm-border);
  height: var(--vbm-header-height); /* 56px */
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.vbm-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: var(--vbm-content-max); /* 960px */
  margin: 0 auto;
}

.vbm-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.vbm-header__logo {
  width: 32px;
  height: 32px;
  border-radius: var(--vbm-radius-md); /* 8px */
  object-fit: cover;
  flex-shrink: 0;
}

/* Fallback logo shown when no image is available */
.vbm-header__logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--vbm-radius-md); /* 8px */
  background: var(--vbm-accent);
  font-size: 14px;
  font-weight: 700;
  color: var(--vbm-accent-text);
  flex-shrink: 0;
}

.vbm-header__name {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--vbm-header-color);
}

/* Back button — placed before the brand in the DOM */
.vbm-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  margin-left: -12px;
  color: color-mix(in srgb, var(--vbm-header-color) 70%, transparent);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

/* Back mode: text block beside the arrow */
.vbm-header__back-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.vbm-header__back-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--vbm-header-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vbm-header__subtitle {
  font-size: 12px;
  color: var(--vbm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Brand mode: text block beside the logo */
.vbm-header__brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vbm-header__club-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--vbm-header-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fallback logo (no image) */
.vbm-header__logo--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--vbm-radius-md);
  background: var(--vbm-accent);
  font-size: 14px;
  font-weight: 700;
  color: var(--vbm-accent-text);
  flex-shrink: 0;
}

/* Header right-side actions */
.vbm-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-self: end;
}

/* Login/My Events button adapts to header brand color */
.vbm-header__actions .vbm-btn--outline {
  border-color: color-mix(in srgb, var(--vbm-header-color) 50%, transparent);
  color: var(--vbm-header-color);
}


/* ==== 03. CALENDAR STRIP ==== */

.vbm-calendar-strip {
  background: #0f172a;
  border-bottom: 1px solid var(--vbm-border);
}

/* Toggle row — clicking it expands/collapses the grid */
.vbm-calendar-strip__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  user-select: none;
}

.vbm-calendar-strip__month {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--vbm-text-primary);
}

.vbm-calendar-strip__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Prev/next month navigation buttons */
.vbm-calendar-strip__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--vbm-text-muted);
}

/* Expand/collapse chevron — rotates 180deg when strip is open */
.vbm-calendar-strip__chevron {
  display: inline-block;
  transition: transform var(--vbm-transition-fast);
}

.vbm-calendar-strip__chevron[data-expanded="true"],
.vbm-calendar-strip[data-expanded="true"] .vbm-calendar-strip__chevron {
  transform: rotate(180deg);
}

/* Day grid container */
.vbm-calendar-strip__grid {
  padding: 0 16px 10px;
}

/* Weekday label row */
.vbm-calendar-strip__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 11px;
  color: #475569;
  text-align: center;
  margin-bottom: 4px;
}

/* Day cells row */
.vbm-calendar-strip__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.vbm-calendar-strip__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  font-size: 13px;
  color: var(--vbm-text-muted);
  cursor: pointer;
  position: relative;
  background: none;
  border: none;
  border-radius: var(--vbm-radius-sm);
}

/* Day with events */
.vbm-calendar-strip__day[data-has-events="true"] {
  color: var(--vbm-text-primary);
}

/* Selected day — primary circle behind the number */
.vbm-calendar-strip__day[data-selected="true"] {
  color: var(--vbm-primary-text);
}

.vbm-calendar-strip__day[data-selected="true"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 2px)); /* shift up slightly to clear dots */
  width: 32px;
  height: 32px;
  border-radius: var(--vbm-radius-full);
  background: var(--vbm-primary);
  z-index: -1;
}

/* Event-indicator dots */
.vbm-calendar-strip__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
}

.vbm-calendar-strip__dot {
  width: 4px;
  height: 4px;
  border-radius: var(--vbm-radius-full);
  background: var(--vbm-primary);
  flex-shrink: 0;
}


/* ==== 04. COMPACT HERO ==== */

.vbm-hero {
  padding: 16px;
  background: var(--vbm-bg-surface);
  border-bottom: 1px solid var(--vbm-border);
  text-align: center;
}

.vbm-hero__badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.vbm-hero__title {
  font-size: var(--vbm-text-xl); /* 20px */
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--vbm-text-primary);
}

.vbm-hero__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}


/* ==== 05. CONTENT AREA ==== */

.vbm-content {
  padding: var(--vbm-space-md); /* 12px */
  max-width: var(--vbm-content-max); /* 960px */
  margin: 0 auto;
}

/* Extra side padding variant */
.vbm-content--padded {
  padding: var(--vbm-space-lg); /* 16px */
}

/* Reserve bottom space for sticky CTA bar */
.vbm-content--with-cta {
  padding-bottom: 80px;
}

/* Reserve bottom space for bottom nav */
.vbm-content--with-nav {
  padding-bottom: calc(var(--vbm-bottom-nav-height) + var(--vbm-space-md));
}

/* Reserve bottom space for both sticky CTA and bottom nav */
.vbm-content--with-both {
  padding-bottom: calc(var(--vbm-bottom-nav-height) + 80px);
}


/* ==== 06. EVENT LIST ==== */

.vbm-event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* ==== 07. FOOTER ==== */

.vbm-footer {
  padding: var(--vbm-space-xl) var(--vbm-space-lg); /* 24px 16px */
  text-align: center;
  color: var(--vbm-text-muted);
  font-size: var(--vbm-text-sm); /* 13px */
  border-top: 1px solid var(--vbm-border);
}


/* ==== 08. STANDINGS TABLE ==== */

.vbm-table-wrap {
  overflow-x: auto;
}

.vbm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--vbm-text-sm); /* 13px */
  min-width: 320px;
}

.vbm-table th {
  text-align: left;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--vbm-text-muted);
  border-bottom: 1px solid var(--vbm-border-strong);
}

.vbm-table th.text-center,
.vbm-table td.text-center {
  text-align: center;
}

.vbm-table td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--vbm-border);
}

/* Rank cell — muted by default */
.vbm-table__rank {
  color: var(--vbm-text-muted);
}

/* First-place row emphasis */
.vbm-table__rank--first {
  color: var(--vbm-warning);
  font-weight: 600;
}

/* Team name */
.vbm-table__team {
  color: var(--vbm-text-primary);
  font-weight: 600;
}

/* Win count */
.vbm-table__win {
  color: var(--vbm-success);
  font-weight: 600;
}

/* Generic stat (losses, points, etc.) */
.vbm-table__stat {
  color: var(--vbm-text-secondary);
}
