/* Mow Cop Runners — club red and black on a clean light page. */
:root {
    --mcr-red: #c8102e;
    --mcr-red-dark: #9e0c24;
    --mcr-ink: #16181d;
    --mcr-muted: #6b7280;
    --mcr-surface: #ffffff;
    --mcr-page: #f4f5f7;
    --mcr-border: #e5e7eb;
    --bs-primary: #c8102e;
    --bs-primary-rgb: 200, 16, 46;
    --bs-link-color: #b00e29;
    --bs-link-color-rgb: 176, 14, 41;
    --bs-link-hover-color: #7d0a1d;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--mcr-page);
    color: var(--mcr-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#SiteForm { display: flex; flex-direction: column; flex: 1; }
main { flex: 1; }

/* ---- Navigation ---- */
.site-nav {
    background: var(--mcr-ink);
    border-bottom: 4px solid var(--mcr-red);
}
.site-nav .navbar-brand { font-weight: 800; letter-spacing: -0.01em; }
.brand-mark { border-radius: 8px; background: var(--mcr-red); padding: 3px; object-fit: contain; }
.site-nav .nav-link { font-weight: 500; }
.site-nav .nav-link.active { color: #fff; box-shadow: inset 0 -3px 0 var(--mcr-red); }
.dropdown-item.active, .dropdown-item:active { background: var(--mcr-red); }

/* ---- Page furniture ---- */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-weight: 800; letter-spacing: -0.02em; margin-bottom: .25rem; }
.page-header .lead { color: var(--mcr-muted); font-size: 1.05rem; }

.card { border: 1px solid var(--mcr-border); border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-header { background: transparent; font-weight: 700; border-bottom-color: var(--mcr-border); }

.filter-bar {
    background: var(--mcr-surface);
    border: 1px solid var(--mcr-border);
    border-radius: 14px;
    padding: .9rem 1rem;
    margin-bottom: 1.25rem;
}
.filter-bar .form-label { font-size: .8rem; font-weight: 600; color: var(--mcr-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem; }

.btn-primary { --bs-btn-bg: var(--mcr-red); --bs-btn-border-color: var(--mcr-red); --bs-btn-hover-bg: var(--mcr-red-dark); --bs-btn-hover-border-color: var(--mcr-red-dark); --bs-btn-active-bg: var(--mcr-red-dark); }
.btn-outline-primary { --bs-btn-color: var(--mcr-red); --bs-btn-border-color: var(--mcr-red); --bs-btn-hover-bg: var(--mcr-red); --bs-btn-hover-border-color: var(--mcr-red); --bs-btn-active-bg: var(--mcr-red-dark); }
.form-control:focus, .form-select:focus { border-color: var(--mcr-red); box-shadow: 0 0 0 .2rem rgba(200,16,46,.15); }
.nav-pills .nav-link.active { background: var(--mcr-red); }
.nav-pills .nav-link { color: var(--mcr-ink); }
.nav-tabs .nav-link.active { font-weight: 600; }
.nav-tabs .nav-link { color: var(--mcr-ink); }

/* ---- Tables ---- */
.table-card { background: var(--mcr-surface); border: 1px solid var(--mcr-border); border-radius: 14px; overflow: hidden; }
/* Wide tables scroll sideways on phones instead of being cut off. */
.table-card.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-card .table { margin-bottom: 0; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mcr-muted); font-weight: 600; background: #fafafa; white-space: nowrap; }
.table td, .table th { padding: .65rem .85rem; vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time { font-variant-numeric: tabular-nums; font-weight: 600; }
.time-other { font-variant-numeric: tabular-nums; color: var(--mcr-muted); }
/* PB badge and age-grade bands */
.badge-pb { background: #fff3cd; color: #7a5a00; border: 1px solid #f1d27a; font-weight: 700; letter-spacing: .02em; }
.ag { font-variant-numeric: tabular-nums; font-weight: 600; padding: .1rem .4rem; border-radius: 6px; white-space: nowrap; }
.ag-world { background: #4c1d95; color: #fff; }
.ag-national { background: #1d4ed8; color: #fff; }
.ag-regional { background: #dcfce7; color: #166534; }
.ag-local { background: #f1f5f9; color: #334155; }
.ag-other { color: var(--mcr-muted); }
.badge-milestone { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; font-weight: 600; }
/* Head to head */
.h2h-score { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--mcr-muted); font-variant-numeric: tabular-nums; }
.h2h-score.lead-score { color: var(--mcr-red); }
.h2h-win { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--mcr-ink); }
.pos { font-weight: 700; width: 3.5rem; }
.pos-1 { color: #b8860b; }
.pos-2 { color: #8a8f98; }
.pos-3 { color: #a0522d; }
tr.detail-row > td { background: #fbfbfc; padding: 0; border-bottom-width: 0; }
tr.detail-row .table { background: transparent; }
.toggle-btn .bi { transition: transform .2s; }
.toggle-btn[aria-expanded="true"] .bi { transform: rotate(90deg); }
/* Championship rows: whole row is tappable, with a finger-sized arrow (44px, Apple's minimum). */
tr.champ-row { cursor: pointer; }
.toggle-cell { width: 44px; padding-top: 0 !important; padding-bottom: 0 !important; }
.toggle-btn { min-width: 44px; min-height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.detail-table td, .detail-table th { padding-left: .85rem; }
.show-xs, .show-xs-block { display: none; }

.badge-type { background: #eef0f3; color: var(--mcr-ink); font-weight: 600; }
.badge-champ { background: rgba(200,16,46,.1); color: var(--mcr-red-dark); font-weight: 600; }
.text-muted-2 { color: var(--mcr-muted); }

/* ---- Home ---- */
.hero {
    background: linear-gradient(135deg, var(--mcr-ink) 0%, #2a1015 60%, var(--mcr-red-dark) 100%);
    color: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
}
.hero h1 { font-weight: 800; letter-spacing: -0.03em; }
.hero p { color: rgba(255,255,255,.82); max-width: 46rem; }
.hero-mark { position: absolute; right: -20px; bottom: -10px; width: 260px; opacity: .14; filter: invert(1); pointer-events: none; }
.quick-link { text-decoration: none; color: inherit; display: block; height: 100%; transition: transform .15s, box-shadow .15s; }
.quick-link:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.08); color: inherit; }
.quick-link .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(200,16,46,.1); color: var(--mcr-red); font-size: 1.3rem; }
.stat-tile { background: var(--mcr-surface); border: 1px solid var(--mcr-border); border-radius: 14px; padding: 1rem 1.1rem; }
.stat-tile .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-tile .label { color: var(--mcr-muted); font-size: .85rem; }
.partner-logos img { max-height: 56px; width: auto; filter: grayscale(.2); }

/* ---- Footer ---- */
.site-footer { background: var(--mcr-ink); color: rgba(255,255,255,.7); padding: 1.25rem 0; font-size: .9rem; }
.site-footer a { color: #fff; text-decoration: none; }

/* ---- Login ---- */
.auth-card { max-width: 420px; margin: 2rem auto; }

/* ---- Chart ---- */
.chart-wrap { position: relative; height: 360px; }

/* ---- Print (replaces the old TFORMer PDF reports) ---- */
.print-only { display: none; }
@media print {
    @page { margin: 14mm; }
    body { background: #fff; font-size: 11pt; }
    .no-print, .navbar, .site-footer, .filter-bar, .btn, .alert { display: none !important; }
    .print-only { display: block !important; }
    main.container { max-width: none; padding: 0 !important; }
    .table-card, .card { border: none; box-shadow: none; }
    .table thead th { background: #fff !important; color: #000; }
    .table td, .table th { padding: .25rem .4rem; }
    a { color: #000; text-decoration: none; }
    .collapse:not(.show) { display: none !important; }
    .report-section { break-inside: avoid; }
    .page-break { break-before: page; }
}

@media (max-width: 575.98px) {
    .hero { padding: 1.75rem 1.25rem; }
    .table td, .table th { padding: .5rem .55rem; }
    .hide-xs { display: none; }
    .show-xs { display: inline; }
    .show-xs-block { display: block; }
}

/* Features & help */
.help-tile { transition: border-color .15s, box-shadow .15s; }
.help-tile:hover { border-color: var(--mcr-red, #c8102e); box-shadow: 0 4px 14px rgba(0,0,0,.06); }

/* Installed app: a Back button (there's no browser one), hidden in a normal browser. */
.app-back { display: none; color: rgba(255,255,255,.75); }
.app-back:hover, .app-back:focus { color: #fff; }
html.app-standalone .app-back { display: inline-flex; align-items: center; }
html.app-standalone [data-install], html.app-standalone .app-install-help { display: none !important; }
