/* =========================================================================
   Shared building blocks (Client/Ui). Every later page uses these and does
   not add one-off styles. Class names start with "bm-". The component sheet
   (/admin/components) shows each one in every state.
   Rules: text at least 16px for reading text (14-15px only for secondary
   labels), tap targets at least 44px, no sideways scrolling at 390px.
   ========================================================================= */

/* ---------- Page container and header ---------- */
.bm-page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 12px 16px 16px; box-sizing: border-box; display: flex; flex-direction: column; gap: 14px; }
.bm-page--narrow { max-width: 640px; }
@media (min-width: 900px) { .bm-page { padding: 24px; } }

.bm-pageheader { display: flex; flex-direction: column; gap: 6px; }
.bm-pageheader-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bm-pageheader-text { min-width: 0; }
.bm-h1 { margin: 0; font-family: var(--bm-font-head); font-weight: 700; font-size: 30px; line-height: 1.1; color: var(--bm-ink); }
.bm-h1:focus { outline: none; }
.bm-subtitle { font-size: 17px; color: var(--bm-ink-2); margin-top: 2px; }
.bm-pageheader-actions { display: flex; gap: 8px; align-items: center; flex: none; }
@media (min-width: 900px) { .bm-h1 { font-size: 40px; } }

.bm-section-title { margin: 8px 0 0; font-family: var(--bm-font-head); font-weight: 700; font-size: 22px; color: var(--bm-ink-2); }

/* ---------- Status line ---------- */
.bm-status { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--bm-muted); }
@media (min-width: 900px) { .bm-status { font-size: 16px; } }
.bm-status--live { color: var(--bm-red); font-weight: 700; }
.bm-status--alert { color: var(--bm-orange); font-weight: 700; }
.bm-status .mud-icon-root { font-size: 1.2rem; }

/* ---------- Card ---------- */
.bm-card { background: var(--bm-surface); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 1px 1px rgba(0,0,0,.12); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box; min-width: 0; }
.bm-card--flush { padding: 0; gap: 0; overflow: hidden; }
.bm-card--outlined { box-shadow: none; border: 1px solid var(--bm-line); border-radius: 14px; }
.bm-card--highlight { border: 2px solid var(--bm-orange); border-radius: 14px; box-shadow: none; }
.bm-card--tint { background: var(--bm-orange-tint); box-shadow: none; border-radius: 12px; }
.bm-card--dark { background: var(--bm-navy); color: #fff; box-shadow: none; border-radius: 12px; padding: 14px; }
.bm-card--dark a { color: #fff; }
.bm-card-title { margin: 0; font-size: 18px; font-weight: 700; }
.bm-card-eyebrow { font-size: 14px; font-weight: 700; color: var(--bm-orange); text-transform: uppercase; letter-spacing: .6px; }

/* ---------- Table (rows laid out on a grid so phone and desktop share markup) ---------- */
/* Rows start their columns at the left edge, so when the columns are wider than the table it scrolls sideways.
   A <button> row would otherwise centre them and hide the first column. */
.bm-table { background: var(--bm-surface); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 1px 1px rgba(0,0,0,.12); overflow-x: auto; }
.bm-grid-row { display: grid; grid-template-columns: var(--bm-cols); justify-content: start; align-items: center; column-gap: 4px; padding: 0 14px; min-width: 0; box-sizing: border-box; }
@media (min-width: 900px) {
    .bm-grid-row { grid-template-columns: var(--bm-cols-wide, var(--bm-cols)); column-gap: 8px; padding: 0 16px; }
    .bm-table-inner { min-width: 760px; }
}
.bm-grid-head { min-height: 44px; font-size: 14px; color: var(--bm-muted); border-bottom: 1px solid var(--bm-line); font-weight: 700; }
@media (min-width: 900px) { .bm-grid-head { font-size: 15px; } }
.bm-grid-head .bm-sort { background: none; border: none; font: inherit; color: inherit; padding: 0; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.bm-grid-head [aria-sort="ascending"] .bm-sort, .bm-grid-head [aria-sort="descending"] .bm-sort { color: var(--bm-ink); }
.bm-row { width: 100%; min-height: 56px; border: none; border-bottom: 1px solid #EEF0F3; background: var(--bm-surface); color: var(--bm-ink); font-family: inherit; font-size: 17px; text-align: left; text-decoration: none; }
.bm-row:last-child { border-bottom: none; }
a.bm-row, button.bm-row { cursor: pointer; }
a.bm-row:hover, button.bm-row:hover { background: #F8F9FB; color: var(--bm-ink); }
.bm-row--selected { background: var(--bm-orange-tint); box-shadow: inset 4px 0 0 var(--bm-orange); }
a.bm-row--selected:hover, button.bm-row--selected:hover { background: var(--bm-orange-tint); }
.bm-row--pending { background: #E8EEF7; }
.bm-row--disabled { color: #6B7280; cursor: default; }
/* A small text-style action inside a row (Leaderboard "Forget"), and the strip that opens under a row ("Remember", "See picks"). */
.bm-row-action { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; border: none; border-radius: 6px; background: transparent; color: var(--bm-navy); font: inherit; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.bm-row-action:hover { background: rgba(0, 0, 0, 0.05); color: var(--bm-navy); }
/* The name, badges and "Forget" share one column (narrow on a phone and on mid-width screens), so that one cell may
   wrap to a second line rather than cut the name short. */
.bm-cell--name:has(.bm-row-action) { flex-wrap: wrap; row-gap: 4px; padding: 6px 0; }
.bm-row-confirm { background: #E8EEF7; border-bottom: 1px solid #EEF0F3; padding: 2px 8px 4px; }
.bm-row-confirm-body { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 17px; }
@media (min-width: 900px) { .bm-row-confirm { padding: 2px 10px 4px; } }
.bm-cell { min-width: 0; }
.bm-cell--end { text-align: right; }
.bm-cell--strong { font-weight: 700; }
.bm-cell--rank { font-size: 18px; font-weight: 700; color: var(--bm-muted); }
.bm-cell--points { font-size: 22px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.bm-cell--name { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.bm-cell--name > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-cell--muted { color: var(--bm-muted); font-size: 17px; font-variant-numeric: tabular-nums; }
@media (max-width: 899.98px) { .bm-cell.bm-hide-phone, .bm-hide-phone { display: none; } }

/* ---------- Badge ("out", "LIVE", "paid"...) ---------- */
.bm-badge { display: inline-flex; align-items: center; font-size: 13px; line-height: 1.2; border: 1px solid var(--bm-line-strong); border-radius: 6px; padding: 1px 6px; color: #5B6370; white-space: nowrap; font-weight: 400; }
.bm-badge--live { background: var(--bm-red); border-color: var(--bm-red); color: #fff; font-weight: 700; }
.bm-badge--good { background: #DCFCE7; border-color: #BBF7D0; color: #166534; }
.bm-badge--alert { background: #FEE2E2; border-color: #FECACA; color: #991B1B; }

/* ---------- Buttons (MudButton, sized for thumbs) ---------- */
.bm-btn.mud-button-root { min-height: 48px; line-height: 1.25; border-radius: 10px; padding: 8px 18px; text-transform: none; font-size: 1.0625rem; font-weight: 700; letter-spacing: 0; box-shadow: none; }
.bm-btn--primary.mud-button-root { background: var(--bm-orange); color: #fff; }
.bm-btn--primary.mud-button-root:hover { background: #9A3412; box-shadow: none; }
.bm-btn--primary.mud-button-root.mud-disabled { background: #E1E4EA; color: #6B7280; }
.bm-btn--secondary.mud-button-root { background: #fff; color: var(--bm-navy); border: 1px solid var(--bm-line-strong); }
.bm-btn--secondary.mud-button-root:hover { background: #F8F9FB; }
.bm-btn--secondary.mud-button-root.mud-disabled { color: #6B7280; background: #F4F5F7; }
.bm-btn--large.mud-button-root { min-height: 56px; font-size: 1.1875rem; }
.bm-btn--icononly.mud-button-root { min-width: 48px; padding: 0; }
.bm-btn--primary .mud-button-label, .bm-btn--secondary .mud-button-label { gap: 8px; }

/* ---------- Notice ---------- */
.bm-notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; font-size: 16px; color: var(--bm-ink-2); border: 1px solid transparent; }
.bm-notice .mud-icon-root { flex: none; margin-top: 2px; }
.bm-notice-title { font-weight: 700; display: block; }
.bm-notice--info { background: #E8EEF7; border-color: #C9D6EA; }
.bm-notice--info .mud-icon-root { color: #1D4ED8; }
.bm-notice--tip { background: var(--bm-orange-tint); }
.bm-notice--tip .mud-icon-root { color: var(--bm-orange); }
.bm-notice--success { background: #DCFCE7; border-color: #BBF7D0; color: #14532D; }
.bm-notice--success .mud-icon-root { color: var(--bm-green); }
.bm-notice--warning { background: #FEF3C7; border-color: #FDE68A; color: #78350F; }
.bm-notice--warning .mud-icon-root { color: #B45309; }
.bm-notice--error { background: #FEE2E2; border-color: #FECACA; color: #7F1D1D; }
.bm-notice--error .mud-icon-root { color: var(--bm-red); }

/* ---------- Empty state ---------- */
.bm-empty { text-align: center; padding: 32px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--bm-ink-2); }
.bm-empty .mud-icon-root { font-size: 3rem; color: var(--bm-muted); }
.bm-empty-title { font-family: var(--bm-font-head); font-size: 26px; font-weight: 700; color: var(--bm-ink); margin: 0; }
.bm-empty-text { font-size: 17px; max-width: 460px; margin: 0; }

/* ---------- Team pick button ---------- */
.bm-pick { min-height: 92px; width: 100%; border-radius: 8px; border: 1px solid var(--bm-line-strong); background: #fff; color: var(--bm-ink); font-family: inherit; font-size: 17px; padding: 8px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; position: relative; box-sizing: border-box; }
.bm-pick:hover:not(:disabled) { background: #F8F9FB; }
.bm-pick-name { overflow-wrap: anywhere; }
.bm-pick-rank { font-size: 14px; font-weight: 700; margin-right: 3px; }
.bm-pick-sub { font-size: 14px; color: var(--bm-muted); }
.bm-pick--selected { border: 3px solid var(--bm-navy); background: var(--bm-navy-tint); color: var(--bm-navy); font-weight: 700; }
.bm-pick--selected:hover:not(:disabled) { background: var(--bm-navy-tint); }
.bm-pick--disabled, .bm-pick:disabled { background: #F4F5F7; color: #6B7280; border-style: dashed; cursor: not-allowed; font-style: italic; }
.bm-pick--error { border: 3px solid var(--bm-red); background: #FEF2F2; }
.bm-pick--correct { border: 3px solid var(--bm-green); background: #DCFCE7; color: #14532D; font-weight: 700; }
.bm-pick--wrong { border: 3px solid var(--bm-red); background: #FEE2E2; color: #7F1D1D; }
.bm-pick-mark { position: absolute; top: 6px; right: 6px; font-size: 1.25rem; }

/* Team logo size on pick buttons comes from TeamLogo (40px) */

/* ---------- Bottom nav and pool switcher helpers ---------- */
.bm-segmented { display: inline-flex; background: var(--bm-line); border-radius: 10px; padding: 4px; gap: 2px; }
.bm-segmented button { min-height: 44px; padding: 0 16px; border: none; border-radius: 8px; background: transparent; font-size: 16px; color: var(--bm-ink-2); font-family: inherit; cursor: pointer; }
.bm-segmented button[aria-pressed="true"] { background: #fff; font-weight: 700; color: var(--bm-navy); }

/* ---------- Help text ---------- */
.bm-note { font-size: 15px; color: var(--bm-muted); }
.bm-note--center { text-align: center; }

/* ---------- Component sheet ---------- */
.bm-sheet-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .bm-sheet-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bm-sheet-stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .bm-sheet-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bm-sheet-label { font-size: 14px; color: var(--bm-muted); margin-bottom: 4px; }
.bm-swatch { height: 64px; border-radius: 8px; display: flex; align-items: flex-end; padding: 6px 8px; font-size: 14px; font-weight: 700; box-sizing: border-box; }

/* ---------- Print: hide screen-only controls ---------- */
@media print { .bm-btn, .bm-segmented, .no-print { display: none !important; } }

/* Text for screen readers only */
.bm-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
