/* Match Tracker — Custom CSS
 * Tailwind handles most styling. This file adds:
 *   1. CSS custom properties for the Bernardus orange theme
 *   2. Small utility classes not in Tailwind CDN config
 *   3. Component-level overrides
 */

/* ─── Theme variables ─────────────────────────────────────────────────── */
/* ─── Brand font (matches bernardus.ndigital.nl) ─────────────────────── */
@font-face {
    font-family: 'Charlly Sans';
    src: url('/assets/fonts/CharllySans.woff2') format('woff2'),
         url('/assets/fonts/Charlly-Sans.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ── PREMIUM token set (Teamstats "warm club premium", locked 2026-07-15) ──
       Source of truth: Claude Design "Teamstats" boards. §2 of the UI brief. */
    --color-primary:      #df7733;   /* flat accent — links + small accents only */
    --color-primary-dark: #d86413;
    --color-primary-light:#fdebd9;   /* pale orange tint (status pill bg) */
    --color-primary-tint: #fff8f1;   /* faintest orange wash */
    --grad-primary:       linear-gradient(180deg, #E8853F, #D86413); /* primary btn + FAB */
    --espresso:           #241F1A;   /* hero surfaces */
    --grad-espresso:      linear-gradient(160deg, #241F1A, #2F2820);
    --color-dark:         #26211C;   /* warm near-black ink */
    --color-bg:           #F6F1E8;   /* warm crème page canvas */
    --color-bg-alt:       #FFFDF9;   /* card-ish off-white for panel breaks */
    --color-card:         #FFFDF9;
    --color-border:       rgba(38,33,28,.09);   /* hairline */
    --color-border-strong:rgba(38,33,28,.16);   /* stronger hairline */
    --color-text:         #26211C;   /* ink */
    --color-text-muted:   #8A7D6F;   /* muted */
    --color-success:      #0DA472;
    --color-warning:      #F59E0B;
    --color-danger:       #E0442F;

    /* ── Typography ────────────────────────────────────────────────────── */
    --font-display: 'Charlly Sans', 'Roboto', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-body:    'Roboto', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

    --radius-card:   18px;
    --radius-control:14px;   /* buttons + inputs + date-blocks */
    --shadow-card:   0 1px 2px rgba(38,33,28,.04), 0 6px 18px rgba(38,33,28,.07);
    --shadow-md:     0 1px 2px rgba(38,33,28,.06), 0 8px 24px rgba(38,33,28,.10);
    --shadow-glow:   0 1px 2px rgba(38,33,28,.15), 0 8px 20px rgba(216,100,19,.28); /* primary btn */
    --ring-focus:    0 0 0 4px rgba(223,119,51,.16);
}

/* ─── Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--color-bg);
}

/* Headings use the bernardus display font (Charlly Sans) */
h1, h2, h3, .font-display {
    font-family: var(--font-display);
    letter-spacing: 0.005em;
}

/* ─── Login / invite hero — full espresso with faint orange arc motif ──── */
.login-bg {
    background:
        radial-gradient(1100px 700px at 8% -10%, rgba(232,133,63,.18) 0%, transparent 55%),
        radial-gradient(900px 900px at 108% 115%, rgba(216,100,19,.16) 0%, transparent 55%),
        var(--grad-espresso);
    position: relative;
    overflow: hidden;
}
/* Faint concentric orange arcs sweeping the lower-right */
.login-bg::before {
    content: "";
    position: absolute;
    right: -30%;
    bottom: -35%;
    width: 90vw;
    height: 90vw;
    max-width: 640px;
    max-height: 640px;
    border-radius: 50%;
    border: 1.5px solid rgba(232,133,63,.14);
    box-shadow:
        0 0 0 60px rgba(232,133,63,.05),
        0 0 0 140px rgba(232,133,63,.035);
    pointer-events: none;
}
/* Wordmark lockup on the espresso hero */
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}
.brand-mark {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    filter: drop-shadow(0 6px 14px rgba(216,100,19,.35));
}
.brand-wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.75rem;
    letter-spacing: 0.01em;
    color: #FFFDF9;
}

.login-logo {
    width: 88px;
    height: auto;
    display: block;
}

/* ─── Primary color utilities ─────────────────────────────────────────── */
.bg-primary       { background-color: var(--color-primary); }
.bg-primary-dark  { background-color: var(--color-primary-dark); }
.bg-primary-light { background-color: var(--color-primary-light); }
.text-primary     { color: var(--color-primary); }
.border-primary   { border-color: var(--color-primary); }

.btn-primary {
    background: var(--grad-primary);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-control);
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9375rem;
    box-shadow: var(--shadow-glow);
    transition: box-shadow 0.15s ease, filter 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
    min-height: 44px;
}

.btn-primary:hover {
    filter: brightness(1.04);
    box-shadow: 0 1px 2px rgba(38,33,28,.15), 0 10px 24px rgba(216,100,19,.34);
}

.btn-primary:active { transform: translateY(1px); }

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--color-card);
    color: var(--color-text);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
    min-height: 44px;
}

.btn-secondary:hover {
    border-color: var(--color-border-strong);
    background-color: #fff;
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
    min-height: 44px;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* ─── Card component ──────────────────────────────────────────────────── */
.card {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Form elements ───────────────────────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: 1rem;
    color: var(--color-text);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    min-height: 44px;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--ring-focus);
}

.form-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: 1rem;
    color: var(--color-text);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 0.875rem center;
    appearance: none;
    cursor: pointer;
    min-height: 44px;
}

.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--ring-focus);
}

.form-group {
    margin-bottom: 1rem;
}

/* ─── Navigation bar ──────────────────────────────────────────────────── */
.nav-bar {
    background-color: var(--color-primary);
    color: white;
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-md);
}

.nav-title {
    font-size: 1.125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-home-btn {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

.nav-home-btn:hover {
    opacity: 0.92;
}

.nav-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ─── Bottom navigation ───────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--color-border);
    display: flex;
    height: 60px;
    z-index: 40;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.625rem;
    font-weight: 500;
    transition: color 0.15s ease;
    text-decoration: none;
    min-height: 44px;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--color-primary-dark);
}

.bottom-nav-item .nav-icon {
    font-size: 1.25rem;
    line-height: 1;
}

/* ─── Main content area ───────────────────────────────────────────────── */
.main-content {
    padding: 1rem;
    padding-bottom: 80px; /* space for bottom nav */
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* ─── Dashboard espresso stat band (hero) ─────────────────────────────── */
.stat-band {
    background: var(--grad-espresso);
    border-radius: var(--radius-card);
    padding: 1.15rem 1rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.stat-band::after {
    content: "";
    position: absolute;
    right: -20%;
    top: -60%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,133,63,.16) 0%, transparent 65%);
    pointer-events: none;
}
/* Stat cards become transparent tiles on the espresso band */
.stat-band .stat-card {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0.25rem 0.5rem;
}
.stat-band .stat-card-value { color: #FFFDF9; }
.stat-band .stat-card-label { color: #A8917A; }
.stat-band .stat-card-cta   { color: #E8853F; }
.stat-band .stat-card-clickable:hover {
    background-color: rgba(255,255,255,.05);
    box-shadow: none;
}

/* ─── Stat cards (dashboard) ──────────────────────────────────────────── */
.stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1rem;
    text-align: center;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* Compact value variant for multi-word content (e.g. "2W 1G 0V") */
.stat-card-value--small {
    font-size: 1rem;
    line-height: 1.3;
}

.stat-card-label {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    margin-top: 0.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.13em;
}

/* Clickable stat card */
.stat-card-clickable {
    cursor: pointer;
    border: none;
    width: 100%;
    transition: box-shadow 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.stat-card-clickable:hover {
    box-shadow: 0 4px 12px rgba(244, 121, 32, 0.18);
    background-color: #fffaf7;
}

.stat-card-clickable:active {
    transform: scale(0.97);
    box-shadow: 0 1px 4px rgba(244, 121, 32, 0.15);
}

.stat-card-clickable:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Small call-to-action label shown at card bottom */
.stat-card-cta {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin-top: 0.375rem;
    opacity: 0.75;
    transition: opacity 0.15s ease;
}

.stat-card-clickable:hover .stat-card-cta {
    opacity: 1;
}

/* ─── Match list items ────────────────────────────────────────────────── */
.match-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-radius: 0.375rem;
    margin: 0 -0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    min-height: 56px;
}

.match-item:last-child {
    border-bottom: none;
}

.match-item:hover {
    background-color: var(--color-bg);
}

/* ── Match list: inline delete button ────────────────────────────────────── */
.match-list-delete-btn {
    /* Always visible but subdued; prominent enough to tap, not distracting */
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    /* Increase hit target for mobile */
    min-width: 44px;
    min-height: 44px;
    margin-left: 0.25rem;
}

.match-list-delete-btn:hover,
.match-list-delete-btn:focus-visible {
    background-color: #fee2e2;
    color: #b91c1c;
    outline: none;
}

/* ── Match detail: labeled delete button ───────────────────────────────── */
.match-detail-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    border: 1px solid #fca5a5;
    background: #fff1f1;
    color: #b91c1c;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.match-detail-delete-btn:hover,
.match-detail-delete-btn:focus-visible {
    background: #fee2e2;
    border-color: #f87171;
    outline: none;
}

.match-date-badge {
    background: var(--espresso);
    color: #FFFDF9;
    border-radius: var(--radius-control);
    padding: 0.4rem 0.55rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 46px;
    line-height: 1.2;
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
}

.match-score {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-left: auto;
    white-space: nowrap;
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
}

.result-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.result-w { background: #d1fae5; color: #065f46; }
.result-d { background: #fef3c7; color: #92400e; }
.result-l { background: #fee2e2; color: #991b1b; }
.result-s { background: #e5e7eb; color: #374151; }

/* ─── Data table ──────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.data-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.data-table th.text-center {
    text-align: center;
}

.data-table th.text-right {
    text-align: right;
}

.data-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: var(--color-bg);
}

.data-table-player-overview .col-player {
    width: auto;
}

.data-table-player-overview .col-attendance {
    width: 88px;
}

.data-table-player-overview .col-minutes {
    width: 96px;
}

.data-table-player-overview .col-goals {
    width: 48px;
}

/* ─── Playing time bar ────────────────────────────────────────────────── */
.time-bar-wrap {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
    min-width: 60px;
}

.time-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

/* Fairness color coding */
.time-bar-green  { background: linear-gradient(90deg, #0DA472, #12B980); }
.time-bar-orange { background: var(--color-warning); }
.time-bar-red    { background: var(--color-danger); }

/* Legacy fallback */
.time-bar-fill:not(.time-bar-green):not(.time-bar-orange):not(.time-bar-red) {
    background: var(--color-primary);
}

/* Fairness label pill */
.fairness-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9999px;
    white-space: nowrap;
}
.fairness-pill-green  { background: #d1fae5; color: #065f46; }
.fairness-pill-orange { background: #fef3c7; color: #92400e; }
.fairness-pill-red    { background: #fee2e2; color: #991b1b; }

/* ─── Goal timeline ───────────────────────────────────────────────────── */
.goal-event {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.goal-event:last-child {
    border-bottom: none;
}

.goal-minute {
    width: 36px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 600;
    flex-shrink: 0;
}

.goal-score-badge {
    background: var(--color-dark);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.goal-icon-own { color: var(--color-primary); }
.goal-icon-opp { color: #9ca3af; }

/* Delete goal button */
.goal-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #d1d5db;
    font-size: 0.875rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.goal-delete-btn:hover {
    background: #fee2e2;
    color: var(--color-danger);
}

/* ─── Player card (lineup) ────────────────────────────────────────────── */
.player-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    min-height: 56px;
}

.player-row:last-child {
    border-bottom: none;
}


.player-row-aanwezig {
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    background: white;
}

.player-row-aanwezig:last-child {
    margin-bottom: 0;
}

.player-aanwezig-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.player-minutes-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.875rem;
}

.player-minutes-field {
    min-width: 0;
}

.player-minutes-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.player-minutes-input {
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    text-align: center;
    background: white;
}

.player-minutes-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--ring-focus);
}

/* Derived (read-only) banktijd field */
.player-minutes-derived {
    background: var(--color-bg-secondary, #f9fafb);
    color: var(--color-text-muted, #6b7280);
    cursor: default;
    border-style: dashed;
}

.player-minutes-derived:focus {
    box-shadow: none;
    border-color: var(--color-border);
}

/* Small badge next to derived label */
.derived-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--color-bg-secondary, #f3f4f6);
    color: var(--color-text-muted, #9ca3af);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 0.25rem;
    padding: 0.1rem 0.3rem;
    vertical-align: middle;
    margin-left: 0.2rem;
}

.player-minutes-bar {
    grid-column: 1 / -1;
}

/* Tap-to-toggle player row — active/present state */
.player-row-tappable {
    cursor: pointer;
    border-radius: 0.5rem;
    margin: 0 -0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    transition: background 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}
.player-row-tappable:hover,
.player-row-tappable:active {
    background: var(--color-bg);
}
.player-row-tappable.present {
    background: #f0fdf4;
}
.player-row-tappable.absent {
    opacity: 0.5;
}

/* ─── Absent-toggle button on present player rows ───────────────────── */
.absent-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #d1d5db;
    font-size: 0.875rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.absent-btn:hover,
.absent-btn:active {
    background: #fee2e2;
    color: var(--color-danger);
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* ─── Lineup group header ─────────────────────────────────────────────── */
.lineup-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 0.25rem;
}

/* ─── Badge utilities ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Trainings: status + attendance pills (colors set inline per state) */
.training-status-pill,
.attendance-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.attendance-pill { padding: 0.35rem 0.85rem; font-size: 0.78rem; }

.badge-green  { background: #d1fae5; color: #065f46; }
.badge-orange { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge-gray   { background: #f3f4f6; color: #374151; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }

/* ─── Loading spinner ─────────────────────────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-primary-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Toast notification ──────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-dark);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.9375rem;
    font-weight: 500;
    z-index: 200;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    animation: toast-in 0.2s ease;
    max-width: calc(100vw - 2rem);
    text-align: center;
}

.toast.toast-error {
    background: var(--color-danger);
}

.toast.toast-success {
    background: var(--color-success);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Service-worker update snackbar ──────────────────────────────────── */
.sw-update-bar {
    position: fixed;
    left: 50%;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: calc(100vw - 2rem);
    background: var(--color-dark);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-control);
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    z-index: 210;
    animation: toast-in 0.2s ease;
}
.sw-update-refresh {
    flex-shrink: 0;
    background: var(--color-primary);
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
}
.sw-update-dismiss {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem;
}

/* ─── Empty state ─────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.375rem;
    color: var(--color-text);
}

/* ─── Section header ──────────────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

/* ─── Number input spinner hide ──────────────────────────────────────── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* ─── Checkbox custom ─────────────────────────────────────────────────── */
.checkbox-primary {
    accent-color: var(--color-primary);
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ─── Wizard step indicator ───────────────────────────────────────────── */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    position: relative;
}

.wizard-step::before {
    content: '';
    position: absolute;
    top: 14px;
    left: calc(-50% + 14px);
    right: calc(50% + 14px);
    height: 2px;
    background: var(--color-border);
    z-index: 0;
}

.wizard-step:first-child::before {
    display: none;
}

.wizard-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid var(--color-border);
    background: white;
    color: var(--color-text-muted);
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
}

.wizard-step.active .wizard-step-num {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 0 0 4px var(--color-primary-light);
}

.wizard-step.done .wizard-step-num {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

.wizard-step.done::before,
.wizard-step.active::before {
    background: var(--color-success);
}

.wizard-step-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.2;
    max-width: 60px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wizard-step.active .wizard-step-label {
    color: var(--color-primary);
}

.wizard-step.done .wizard-step-label {
    color: var(--color-success);
}

/* ─── Wizard step content transitions ────────────────────────────────── */
.wizard-panel {
    animation: wizard-in 0.2s ease;
}

@keyframes wizard-in {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.wizard-panel-back {
    animation: wizard-in-back 0.2s ease;
}

@keyframes wizard-in-back {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ─── Goal entry modal (slide-up sheet) ───────────────────────────────── */
.goal-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 60;
    animation: backdrop-in 0.2s ease;
}

@keyframes backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.goal-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 1.25rem 1.25rem 0 0;
    z-index: 61;
    padding: 1.25rem 1rem 2rem;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
    animation: sheet-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* Drag handle */
.sheet-handle {
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: #d1d5db;
    margin: 0 auto 1rem;
}

/* Player picker inside sheet */
.player-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.player-picker-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0.625rem 0.5rem;
    border: 2px solid var(--color-border);
    border-radius: 0.625rem;
    background: white;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    transition: all 0.15s ease;
    min-height: 64px;
    -webkit-tap-highlight-color: transparent;
}

.player-picker-btn:hover,
.player-picker-btn:active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.player-picker-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.player-picker-btn .player-picker-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.player-picker-btn.selected .player-picker-avatar {
    background: var(--color-primary);
    color: white;
}

/* Large minute input */
.minute-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.minute-input-large {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    width: 100px;
    padding: 0.625rem;
    border: 2px solid var(--color-border);
    border-radius: 0.75rem;
    background: white;
    color: var(--color-text);
    min-height: 64px;
}
.minute-input-large:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(244,121,32,0.2);
}

/* Goal type toggle buttons */
.goal-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 1rem 0.5rem;
    border: 2px solid var(--color-border);
    border-radius: 0.75rem;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: all 0.15s ease;
    min-height: 80px;
    -webkit-tap-highlight-color: transparent;
}

.goal-type-btn .goal-type-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.goal-type-btn:hover,
.goal-type-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.goal-type-btn.opp.active {
    border-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
}

/* ─── Mobile-first breakpoints ────────────────────────────────────────── */
@media (min-width: 640px) {
    .main-content {
        padding: 1.5rem;
        padding-bottom: 90px;
    }

    .card {
        padding: 1.5rem;
    }

    .goal-sheet {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 100%;
        max-width: 480px;
        border-radius: 1.25rem;
        bottom: 50%;
        transform: translate(-50%, 50%);
        animation: none;
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }

    .main-content {
        padding-bottom: 2rem;
    }

    /* Desktop sidebar nav could go here in a future phase */
}

/* ─── Transition utilities ────────────────────────────────────────────── */
[x-cloak] { display: none !important; }

.fade-enter { opacity: 0; transform: translateY(4px); }
.fade-enter-active { transition: opacity 0.2s ease, transform 0.2s ease; }

/* ─── Drag-and-drop lineup ────────────────────────────────────────────── */

/* Draggable player row */
.player-row-draggable {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.player-row-draggable:active {
    cursor: grabbing;
}

/* Drag handle indicator (left side) */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
    color: #d1d5db;
    font-size: 1rem;
    cursor: grab;
    flex-shrink: 0;
}

/* While being dragged */
.player-row--dragging {
    opacity: 0.4;
    pointer-events: none;
}

/* Drop zone wrapper */
.lineup-drop-zone {
    min-height: 56px;
    border-radius: 0.5rem;
    transition: background 0.15s ease, border-color 0.15s ease;
    border: 2px dashed transparent;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

/* Zone active when a drag is in progress */
.lineup-drop-zone.drag-active {
    border-color: var(--color-border);
    background: #f9fafb;
}

/* Zone highlighted when dragged item is over it */
.lineup-drop-zone.drag-over {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* Empty drop zone placeholder */
.lineup-drop-zone-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    font-size: 0.8125rem;
    color: #9ca3af;
    font-style: italic;
}

/* Ghost element (follows finger on touch) */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.12);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    border: 2px solid var(--color-primary);
    transform: translate(-50%, -50%) scale(1.04);
    opacity: 0.95;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: none;
}


@media (max-width: 639px) {
    .data-table-player-overview .col-attendance {
        width: 76px;
    }

    .data-table-player-overview .col-minutes {
        width: 84px;
    }

    .data-table-player-overview .col-goals {
        width: 42px;
    }

    .player-minutes-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ─── Analytics Overview — new components (P4/01B) ───────────────────── */

/* Average-goals cards (2-col grid above results) */
.overview-avg-card {
    background: white;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 0.875rem 1rem;
    text-align: center;
}

.overview-avg-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.overview-avg-value--muted {
    color: #dc2626;
}

.overview-avg-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Stacked result bar */
.overview-result-bar {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    background: #f3f4f6;
}

.overview-result-segment {
    height: 100%;
    transition: width 0.4s ease;
    min-width: 2px;
}

/* Per-match result chips */
.result-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

.result-chip--win  { background: #d1fae5; color: #065f46; }
.result-chip--draw { background: #fef3c7; color: #92400e; }
.result-chip--loss { background: #fee2e2; color: #991b1b; }

/* Home/away split row */
.overview-split-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.overview-split-cell {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.25rem;
}

.overview-split-divider {
    width: 1px;
    background: var(--color-border);
    flex-shrink: 0;
}

.overview-split-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.overview-split-record {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
}

.overview-split-goals {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.125rem;
}

/* Top scorer hero row */
.overview-top-scorer {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    background: var(--color-primary-light);
    border-radius: 0.75rem;
}

.overview-top-scorer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Scorer relative bar */
.overview-scorer-bar-wrap {
    width: 60px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.overview-scorer-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Metric pills (avg play/bench/attendance) */
.overview-metric-pill {
    background: #f9fafb;
    border: 1px solid var(--color-border);
    border-radius: 0.625rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.overview-metric-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.overview-metric-label {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Per-player row in playing time section */
.overview-player-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.overview-player-row:last-child {
    border-bottom: none;
}

.overview-player-name {
    width: 6rem;
    min-width: 5rem;
    max-width: 6rem;
}

.overview-player-sub {
    padding-left: 0;
    margin-top: 0.125rem;
}

/* Goal timing bucket chart */
.overview-bucket-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.375rem;
    align-items: end;
}

/* When the faded '?' bucket is present it extends the grid */
.overview-bucket-grid:has(.overview-bucket--faded) {
    grid-template-columns: repeat(5, 1fr) auto;
}

.overview-bucket {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.overview-bucket--faded {
    opacity: 0.6;
}

.overview-bucket-bar-wrap {
    width: 100%;
    height: 56px;
    display: flex;
    align-items: flex-end;
    background: #f3f4f6;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
}

.overview-bucket-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease;
    min-height: 3px;
}

.overview-bucket-bar--scored   { background: var(--color-primary); }
.overview-bucket-bar--conceded { background: #f87171; }

.overview-bucket-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.overview-bucket-label {
    font-size: 0.6rem;
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
}
