/* app/assets/stylesheets/base/base.css */
/* =========================================
   BASE & RESET
   ========================================= */

html {
  /* 14px base — see docs/style-guide.html#typography. 1rem = 14px. */
  font-size: 14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  color: var(--ink);
  background-color: var(--bg);
  font-size: 1rem;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
* { box-sizing: border-box; }

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

h1 { font-size: 2rem; }

p {
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.flash-alert {
  color: var(--red);
}
.flash-notice {
  color: var(--green);
}

.alert {
  padding: 1rem;
  border-radius: 5px;
  border: 1px solid transparent;
}

.alert-danger {
  background-color: var(--bg-2);
  border-color: var(--red);
  color: var(--red);
}

.alert-warning {
  background-color: var(--bg-2);
  border-color: var(--gold, #f5c518);
  color: var(--ink-2);
  margin-bottom: 1rem;
}

.alert-info {
  background-color: var(--bg-2);
  border-color: var(--silver, #bbb);
  color: var(--ink-2);
  margin-bottom: 1rem;
}

.alert--actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.alert__buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 0 0.4em;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 4px;
  margin-left: 0.35em;
  vertical-align: middle;
}
.badge--stale    { background-color: var(--gold,   #f5c518); color: var(--ink-2); }
.badge--archived { background-color: var(--silver, #bbb);    color: white; }
.badge--info     { background-color: var(--blue,   #3498db); color: white; }
.badge--neutral  { background-color: var(--bg-2);            color: var(--ink-2); }

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}


.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.main-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  overflow-y: auto;
  padding: 1rem;
  /* Reserve vertical scrollbar space so the table width doesn't jump
     when scrolling appears/disappears. Supported in modern browsers
     (Chrome 94+, Firefox 97+, Safari 16+). */
  scrollbar-gutter: stable;
}

/* Without this, flex column children (like .card sections on the
   General / Configure pages) shrink to fit the visible viewport
   instead of pushing the parent into a scroll. They should size to
   content and let the main-container scroll. */
.main-container > * { flex-shrink: 0; }

/* ---------- Section header ----------
   Mid-page subdivider: uppercase letter-spaced label with hairline rule.
   See docs/style-guide.html#section. */
.section-header,
.section-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.section-head .section-label {
  border-bottom: 0;
  padding-bottom: 0;
  margin: 0;
}
.section-desc { font-size: 0.92rem; color: var(--ink-3); }
.section-actions { margin-left: auto; display: flex; gap: 0.5rem; }

/* ---------- Page header ----------
   Crumb (uppercase context) + title (h1) + sub (one-line context).
   Optional right-aligned action group. See docs/style-guide.html#page-header. */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-crumb {
  font-size: 0.77rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: 4px;
}

.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--ink);
}

.page-sub {
  color: var(--ink-2);
  font-size: 1.07rem;
}

.page-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

/* ---------- Field group (read-only display on show pages) ---------- */
.field-group {
  margin-bottom: 1rem;
}

.field-group__label,
.field-group-label {
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin: 0 0 4px 0;
}

.field-group__value,
.field-text {
  font-size: 1rem;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

/* ---------- Org-scoped page wrapper ----------
   Pages rooted at the organization (and not yet a season) — leagues
   index, league show, future Control Center — sit inside a centered
   max-width column rather than spilling full-width. Gives the page
   weight without needing a sidebar. */
.org-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
  width: 100%;
}
.org-page .page-header { margin-bottom: 2rem; }

/* ---------- Card ----------
   Canonical surface for boxed content (tables, dashboards, panels).
   See docs/style-guide.html#card. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card__header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, #fff 0%, var(--surface-2) 100%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.card__header .card__title { font-size: 1.07rem; font-weight: 800; }
.card__header .card__meta  { color: var(--ink-3); font-size: 0.86rem; }
.card__header .card__actions { margin-left: auto; display: flex; gap: 0.5rem; }
.card__body   { padding: 1.5rem; }
.card__footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.card--accent { position: relative; }
.card--accent::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent, var(--gold));
}

/* ---------- Status pill ----------
   Inline status indicator (e.g. "Active" beside a season name).
   Distinct from .card-status-header which is a colored banner across the
   top of season cards. See docs/style-guide.html#tags. */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  color: var(--ink-3);
}
.status-pill--draft        { background: var(--bg-2);        color: var(--ink-3); }
.status-pill--registration { background: var(--info-soft);   color: var(--info); }
.status-pill--active       { background: var(--success-soft); color: var(--success); }
.status-pill--completed    { background: var(--gold-pale);   color: var(--gold-dark); }
.status-pill--cancelled    { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tooltip ----------
   Any element with a [data-tooltip] attribute shows a hover tooltip
   with zero delay. Replaces the duplicate rules previously in
   games.css and standings.css.
   See docs/style-guide.html#tooltip. */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-sm);
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 200;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.tooltip--right[data-tooltip]:hover::after {
  bottom: 50%;
  left: calc(100% + 8px);
  transform: translateY(50%);
}

/* ---------- Empty state ----------
   Replaces bare <p>No X yet</p> strings. Pick a variant:
   - default: centered, generous padding, for blank panels
   - --inline: tighter, for in-line contexts (filtered-out tables, etc.)
   - --card: bordered tile, for "wedged into a section" cases
   See docs/style-guide.html#empty. */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--ink-3);
}
.empty-state__title {
  font-size: 1.07rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.empty-state__desc {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.empty-state--inline {
  padding: 1rem;
}
.empty-state--card {
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 1.5rem;
}