/* ---------------------------------------------------------
   color variables (global design system)
--------------------------------------------------------- */
:root {
    --bg-0: #0a0d12;
    --bg-1: #11161f;
    --bg-2: #1c2430;

    --text: #e6edf3;

    --accent: #58a6ff;
    --accent-hover: #79b8ff;

    --success: #3fb950;
    --success-hover: #56d364;

    --danger: #f85149;

    --border: #30363d;

    --font-sm: 0.875rem;

    /* spacing scale (use for padding/gap in CSS rules; the .gap-* markup
       utility classes in common.css are for spacer <div>s between blocks
       and are a separate, intentionally-different system) */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
}

/* ---------------------------------------------------------
   global page background + typography
--------------------------------------------------------- */
body {
    background: radial-gradient(
        circle at center,
        var(--bg-0) 0%,
        var(--bg-1) 35%,
        var(--bg-2) 70%,
        #242e3a 100%
    );
    color: var(--text);
    margin: 0;
    padding: 0;
    text-align: center;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ---------------------------------------------------------
   form field restoration (for make_league and forms)
--------------------------------------------------------- */
input,
select,
textarea {
    background: #ffffff;
    color: #000000;
    border: 1px solid #ccc;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* these two rules used to force near-black (#222) text on #leagueForm's
   labels/legend and on any h2 inside .container - a leftover from when
   this form had a white background. .container is dark-themed
   (#161b22) site-wide now, so #222-on-dark text was reading as nearly
   invisible (make_league.php's labels, advanced_user_preferences.php's
   "Auto-Pick Mode"/"Favorite Teams" headers). Restored to the normal
   light text color instead of "restoring" it back to dark.
   NOTE: legend intentionally NOT included here anymore - it was overriding
   make_league.css's muted legend color (ID beats class), making the section
   labels read too loud. make_league.css now owns the (dimmer) legend color. */
#leagueForm label {
    color: var(--text);
}

#leagueForm h2,
.container h2 {
    color: var(--text);
}

/* ---------------------------------------------------------
   unified button system (primary / secondary / danger / tertiary)
--------------------------------------------------------- */

/* base button (global sizing + layout) */
.btn,
button,
input[type="button"],
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0.55rem 1.15rem;
    font-size: 0.95rem;
    font-weight: 600;

    background: rgba(0,0,0,0.65);
    color: #ffffff;

    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 0.45rem;

    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.1s ease;
}

.btn:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover {
    background: rgba(0,0,0,0.78);
    border-color: var(--accent-hover);
}

.btn:active,
button:active,
input[type="button"]:active,
input[type="submit"]:active {
    transform: scale(0.98);
}

.btn:visited {
    color: #ffffff;
}

/* button row */
.button-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.6rem;
    margin-top: 2rem;
}

/* secondary button (gray) */
.btn-secondary {
    background: rgba(255,255,255,0.10);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.20);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
}

/* danger button (red) */
.btn-danger {
    background: #b91c1c;
    color: #ffffff;
    border: 1px solid #7f1d1d;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #ef4444;
}

.btn-danger:visited {
    color: #ffffff;
}

/* accent button (highlighted call-to-action, e.g. league_created.php's
   "configure advanced settings" prompt right after a league is made) */
.btn-accent {
    background: var(--accent);
    color: #ffffff;
    border: 1px solid var(--accent-hover);
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-accent:visited {
    color: #ffffff;
}

/* primary button (alias of btn-accent - several pages already assume a
   .btn-primary exists in the foundation; this makes that true instead of
   each page inventing its own) */
.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border: 1px solid var(--accent-hover);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-primary:visited {
    color: #ffffff;
}

/* details-link (small bordered pill used for "view details" affordances -
   consolidated from two conflicting versions: pending.css had a bare
   text-link style, results_explorer.css had this pill style. Pill wins
   since it reads clearly as clickable and matches the button system) */
.details-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0.05rem solid var(--accent);
    color: var(--accent);
    border-radius: 0.3rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
}

.details-link:hover {
    background: var(--accent);
    color: #ffffff;
}

/* tertiary button (moved from common.css, normalized to .btn sizing) */
.btn-tertiary {
    background-color: #2a2a2a;
    color: #ffffff;
    border: 1px solid #444444;
    border-radius: 0.45rem;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.btn-tertiary:hover {
    background-color: #3a3a3a;
}

/* ---------------------------------------------------------
   button groups
--------------------------------------------------------- */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0rem;
}

.primary-btn,
.primary-btn:link,
.primary-btn:visited {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  background: #00020b;
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  text-align: center;
}

/* ---------------------------------------------------------
   info message (global)
--------------------------------------------------------- */
.info-message {
    text-align: center;
    margin: 1rem auto 1.5rem;
    padding: 0.75rem 1rem;
    max-width: 32rem;

    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;

    color: #f0f0f0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ---------------------------------------------------------
   site header (canonical wrapper for the brand title block -
   every page uses <header class="site-header"><div class="login-hero-center">
   <div class="login-hero-header"><h1 class="brand-title">...)
--------------------------------------------------------- */
.site-header {
    display: block;
    width: 100%;
}

/* ---------------------------------------------------------
   container (global card layout)
--------------------------------------------------------- */
.container {
    margin: 0 auto;
    width: 90%;
    max-width: 700px;
    background: #161b22;
    padding: 20px 25px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* ---------------------------------------------------------
   table wrapper (scroll container)
--------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

/* ---------------------------------------------------------
   base table (dark theme)
--------------------------------------------------------- */
.table {
    width: auto;
    border-collapse: collapse;
    background: #0f141a;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,0.25);
    color: var(--text);
    font-size: 0.9rem;
}

/* ---------------------------------------------------------
   table header
--------------------------------------------------------- */
.table th {
    background: linear-gradient(to bottom, #1a1f27, #11161f);
    color: #f5f7fb;
    font-weight: 600;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   table cells
--------------------------------------------------------- */
.table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
    text-align: left;
}

/* ---------------------------------------------------------
   row striping + hover
--------------------------------------------------------- */
.table tr:nth-child(even) td {
    background: rgba(255,255,255,0.03);
}

.table tr:hover td {
    background: rgba(88,166,255,0.08);
}

/* ---------------------------------------------------------
   compact mode
--------------------------------------------------------- */
.table-compact th,
.table-compact td {
    padding: 0.35rem 0.55rem;
}

/* ---------------------------------------------------------
   group header rows
--------------------------------------------------------- */
.table .group-header td {
    background: #1c2430;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: #dce3ea;
}

/* ---------------------------------------------------------
   group separator rows
--------------------------------------------------------- */
.table .group-separator td {
    padding: 0;
    background: transparent;
    border: none;
}

/* ---------------------------------------------------------
   result colors
--------------------------------------------------------- */
.table td.win,
.table td.w {
    color: var(--success);
    font-weight: 600;
}

.table td.loss,
.table td.l {
    color: var(--danger);
    font-weight: 600;
}

.table td.push {
    color: #999;
    font-weight: 600;
}

/* ---------------------------------------------------------
   preference group container
--------------------------------------------------------- */
.pref-group {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

/* header */
.pref-group-header {
    display: flex;
    justify-content: center;
    text-align: center;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* body */
.pref-group-body {
    margin-top: 0.5rem;
}

.pref-group[data-expanded="false"] .pref-group-body {
    display: none;
}

/* bulk controls */
.pref-bulk {
    justify-content: center;
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

/* grid */
.pref-grid {
    display: grid;
    gap: 0.5rem 1.5rem;
}

.pref-group[data-columns="1"] .pref-grid {
    grid-template-columns: 1fr;
}

.pref-group[data-columns="2"] .pref-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pref-group[data-columns="3"] .pref-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* checkbox rows */
.pref-grid label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.btn:disabled,
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled {
    border: 2px solid #cc6666 !important;   /* soft red border */
    color: #cc6666 !important;              /* soft red text */
    background: rgba(0,0,0,0.35) !important; /* slightly dimmed */
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}
