/* Sign-in / register / join styling, ported from GDS public/css/gds-login.css.
   - Clean typeface (Inter, with a system fallback stack)
   - Light / dark / system theme via [data-theme]
   - Small / medium / large text scaling via [data-font] (text sizes are in
     em, so changing the root font-size scales all text, not the layout) */

/* Self-hosted Inter (variable weight, latin subset) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter/Inter.woff2') format('woff2');
}

:root {
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

    /* Light theme (default) */
    --bg: #ffffff;
    --card-bg: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --field-bg: #f9fafb;
    --brand: #1668b0;
    --brand-dark: #114f87;
    --brand-ring: rgba(22, 104, 176, 0.18);
    --error: #dc2626;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --shadow: rgba(17, 24, 39, 0.06);
    --ctrl-bg: #f3f4f6;
    --ctrl-active: #ffffff;
    --on-brand: #ffffff;
    --accent: #0f172a;
}

:root[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --ink: #e2e8f0;
    --muted: #94a3b8;
    --line: #334155;
    --field-bg: #0f172a;
    --brand: #3b82f6;
    --brand-dark: #2563eb;
    --brand-ring: rgba(59, 130, 246, 0.28);
    --error: #f87171;
    --error-bg: rgba(127, 29, 29, 0.25);
    --error-border: #7f1d1d;
    --shadow: rgba(0, 0, 0, 0.45);
    --ctrl-bg: #334155;
    --ctrl-active: #0f172a;
}

/* Text scaling — only the root font-size changes; text uses em */
:root { font-size: 14px; }              /* small (default) */
:root[data-font="medium"] { font-size: 16px; }
:root[data-font="large"]  { font-size: 18px; }

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
    transition: background .2s, color .2s;
}

.login-shell {
    width: 100%;
    max-width: 30em;
    /* auto margins centre the shell on any screen without clipping the top
       when the content is taller than the viewport (unlike flex centring). */
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* System brand, fixed top-left (mirrors the settings bar, top-right) */
.brand-top {
    position: fixed;
    top: 16px;
    left: 18px;
    z-index: 10;
}
.brand-top img { height: 3.8em; width: auto; display: block; }

/* Company logos — in the footer, beneath the website links */
.company-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5em;
    margin-top: 1.4em;
}
.company-row img { height: 3.2em; width: auto; max-width: 42%; }

.card {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 30px var(--shadow);
    padding: 2.4em 2.2em;
    transition: background .2s, border-color .2s;
}

.card h1 {
    margin: 0 0 0.25em;
    font-size: 1.55em;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.card .subtitle {
    margin: 0 0 1.6em;
    color: var(--muted);
    font-size: 0.95em;
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
    font-size: 0.92em;
    border-radius: 8px;
    padding: 0.7em 0.85em;
    margin-bottom: 1.2em;
}

.field { margin-bottom: 1.2em; position: relative; }
.field label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.45em;
}
.field input {
    width: 100%;
    min-height: 2.9em;
    padding: 0.7em 0.95em;
    font-size: 1em;
    font-family: inherit;
    color: var(--ink);
    background: var(--field-bg);
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input::placeholder { color: var(--muted); opacity: 0.8; }
.field input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}

.toggle {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.3em 0.4em;
    font-family: inherit;
}
.toggle:hover { color: var(--brand-text, var(--brand)); }

.btn-login {
    width: 100%;
    min-height: 3em;
    margin-top: 0.4em;
    border: 0;
    border-radius: 9px;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 1em;
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s, transform .02s;
}
.btn-login:hover { background: var(--brand-dark); }
.btn-login:active { transform: translateY(1px); }

.footer {
    margin-top: 1.75em;
    text-align: center;
    color: var(--muted);
    font-size: 0.8em;
    line-height: 1.7;
}
.footer strong { color: var(--ink); }
.footer .dev { color: var(--error); font-style: italic; }
.footer .links {
    margin-top: 0.6em;
    display: flex;
    justify-content: center;
    gap: 3em;
}
.footer .links a { color: var(--brand-text, var(--brand)); text-decoration: none; font-weight: 600; }
.footer .links a:hover { text-decoration: underline; }
.footer .version { margin-top: 1em; font-size: 0.78em; font-weight: 600; letter-spacing: .03em; color: var(--muted); }

/* Settings control (fixed, top-right) */
.settings-bar {
    position: fixed;
    top: 16px;
    right: 18px;
    display: flex;
    gap: 10px;
    z-index: 10;
}
.seg {
    display: inline-flex;
    background: var(--ctrl-bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}
.seg button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 6px;
    padding: 5px 9px;
    font-family: inherit;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
    background: var(--ctrl-active);
    color: var(--brand-text, var(--brand));
    box-shadow: 0 1px 2px var(--shadow);
}
.seg .fs-s { font-size: 12px; font-weight: 700; }
.seg .fs-m { font-size: 15px; font-weight: 700; }
.seg .fs-l { font-size: 18px; font-weight: 700; }
.seg svg { width: 16px; height: 16px; display: block; }

/* Appearance: inline on larger screens; one button on phones (see below). */
.settings-panel { display: flex; gap: 10px; }
.settings-toggle { display: none; }

@media (max-width: 520px) {
    .company-row { gap: 1.5em; }
    .card { padding: 1.9em 1.5em; }
    .settings-bar { top: 10px; right: 10px; flex-direction: column; align-items: flex-end; gap: 8px; }
    .settings-toggle {
        display: inline-flex; align-items: center; gap: 4px;
        border: 1px solid var(--line); background: var(--ctrl-bg); color: var(--muted);
        border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
        box-shadow: 0 1px 2px var(--shadow);
    }
    .settings-toggle svg { width: 15px; height: 15px; }
    .settings-bar.open .settings-toggle { color: var(--brand-text, var(--brand)); border-color: var(--brand); }
    .settings-panel {
        display: none; flex-direction: column; align-items: flex-end; gap: 8px;
        background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
        box-shadow: 0 8px 24px var(--shadow);
    }
    .settings-bar.open .settings-panel { display: flex; }
    .brand-top { top: 10px; left: 10px; }
    .brand-top img { height: 2.8em; }
}

/* ===== Sports-club additions ===== */

/* Club brand, top-left: logo (or initials on the club colour) + name */
.brand-top { display: flex; align-items: center; gap: 0.7em; color: var(--ink); font-weight: 700; }
.brand-top .club-mark {
    width: 3.2em; height: 3.2em; border-radius: 0.8em; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand); color: var(--on-brand); font-weight: 800;
    box-shadow: 0 0 0 3px var(--accent);
}
.brand-top .club-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.card { border-top: 4px solid var(--brand); }
.card-wide { max-width: 40em; }
.login-shell.wide { max-width: 40em; }

.field select, .field textarea {
    width: 100%; min-height: 2.9em; padding: 0.7em 0.95em; font-size: 1em; font-family: inherit;
    color: var(--ink); background: var(--field-bg); border: 1px solid var(--line); border-radius: 9px; outline: none;
}
.field select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.field-error { color: var(--error); font-size: 0.82em; margin-top: 0.35em; }
.field-hint { color: var(--muted); font-size: 0.82em; margin-top: 0.35em; }

.alert-ok { background: rgba(22, 163, 74, .12); color: #15803d; border-radius: 8px; padding: 0.7em 0.85em; margin-bottom: 1.2em; font-size: 0.92em; }
:root[data-theme="dark"] .alert-ok { color: #4ade80; }

/* Google sign-in */
.btn-google {
    width: 100%; min-height: 3em; display: flex; align-items: center; justify-content: center; gap: 0.7em;
    border: 1px solid var(--line); border-radius: 9px; background: var(--card-bg); color: var(--ink);
    font-size: 0.95em; font-weight: 600; font-family: inherit; text-decoration: none; cursor: pointer;
}
.btn-google:hover { background: var(--field-bg); }
.btn-google svg { width: 1.2em; height: 1.2em; }
.divider { display: flex; align-items: center; gap: 0.8em; color: var(--muted); font-size: 0.8em; margin: 1.3em 0; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.switch-link { text-align: center; margin-top: 1.3em; font-size: 0.92em; color: var(--muted); }
.switch-link a, .link { color: var(--brand-text, var(--brand)); font-weight: 600; text-decoration: none; }
.switch-link a:hover, .link:hover { text-decoration: underline; }
.btn-secondary {
    width: 100%; min-height: 3em; margin-top: 0.6em; border: 1px solid var(--line); border-radius: 9px;
    background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn-secondary:hover { background: var(--field-bg); }

/* Sport chips on register / join */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: 0.5em; }
.chips label {
    display: flex; align-items: center; gap: 0.55em; padding: 0.6em 0.7em; margin: 0;
    border: 1px solid var(--line); border-radius: 9px; background: var(--field-bg);
    color: var(--ink); font-size: 0.9em; font-weight: 500; cursor: pointer; user-select: none;
}
.chips label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.chips input { accent-color: var(--brand); width: 1.05em; height: 1.05em; margin: 0; }

.status-icon { width: 3.4em; height: 3.4em; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 1em; background: var(--brand-ring); color: var(--brand-text, var(--brand)); }
.status-icon svg { width: 1.7em; height: 1.7em; }
.club-pick { display: flex; flex-direction: column; gap: 0.5em; }
.club-pick a {
    display: flex; align-items: center; gap: 0.8em; padding: 0.75em 0.9em; border: 1px solid var(--line);
    border-radius: 10px; color: var(--ink); text-decoration: none; background: var(--field-bg);
}
.club-pick a:hover { border-color: var(--brand); }
.club-pick .club-mark { width: 2.4em; height: 2.4em; font-size: 0.85em; border-radius: 0.6em; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; flex: none; }
.club-pick .club-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.club-pick small { display: block; color: var(--muted); }
[x-cloak] { display: none !important; }

/* The club's full logo, centred at the head of the sign-in card. */
.card-logo { display: block; max-width: 62%; max-height: 7.5em; margin: 0 auto 1.4em; object-fit: contain; }
