/*
 * Member app styles.
 *
 * Hand-written and dependency-free on purpose: no build step means this
 * deploys to any PHP host by copying files, and there is no toolchain for a
 * one-person team to keep alive. It is also small enough to read in full.
 */

:root {
    color-scheme: light dark;

    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e4e7eb;
    --text: #14171f;
    --muted: #667085;
    --accent: #4f46e5;
    --accent-text: #ffffff;
    --ok: #16a34a;
    --warn: #d97706;
    --bad: #dc2626;
    --radius: 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0f14;
        --surface: #171a21;
        --border: #262b36;
        --text: #eef1f6;
        --muted: #98a2b3;
        --accent: #6366f1;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* Room for the home indicator on notched phones. */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 18px 40px;
}

header.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.brand {
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}

.card h2 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.pill.ok   { background: color-mix(in srgb, var(--ok) 15%, transparent);   color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.bad  { background: color-mix(in srgb, var(--bad) 15%, transparent);  color: var(--bad); }

.gym-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 2px;
}

.stat-row {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.stat {
    flex: 1;
    background: var(--bg);
    border-radius: 12px;
    padding: 12px;
}

.stat .value { font-size: 20px; font-weight: 700; }
.stat .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/*
 * The open button.
 *
 * Deliberately enormous. It is pressed one-handed, often in winter, sometimes
 * with gloves on, by someone who wants to be inside already.
 */
.open-btn {
    /*
     * A wide slab, not a circle.
     *
     * The circle looked good on its own and then stopped fitting the moment
     * anything else was on the screen - on a 412x914 phone it ran off the
     * bottom, under the tab bar. A fixed-height full-width button is the same
     * enormous tap target, survives any viewport, and leaves room for the
     * cards above it.
     */
    width: 100%;
    height: 104px;
    border: none;
    border-radius: 20px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0 0 16px;
    box-shadow: 0 6px 20px -8px var(--accent);
    transition: transform 0.12s ease, opacity 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.open-btn:active { transform: scale(0.985); }
.open-btn:disabled { box-shadow: none; }
.open-btn:disabled { opacity: 0.55; cursor: default; }
.open-btn.ok  { background: var(--ok); }
.open-btn.bad { background: var(--bad); }

.open-btn .sub { font-size: 13px; font-weight: 500; opacity: 0.85; }

.result {
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.45;
    display: none;
}

.result.show { display: block; }
.result.ok  { background: color-mix(in srgb, var(--ok) 12%, transparent);  color: var(--ok); }
.result.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }

form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin: 14px 0 6px;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="tel"] {
    width: 100%;
    padding: 13px 14px;
    font-size: 16px; /* 16px stops iOS zooming the page on focus */
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
}

form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.errors {
    background: color-mix(in srgb, var(--bad) 12%, transparent);
    color: var(--bad);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 4px;
}

.errors ul { margin: 0; padding-left: 18px; }

.checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 18px;
    font-size: 14px;
}

.checkbox input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }

.link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.event {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

nav.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

nav.tabs a {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
}

nav.tabs a.on {
    color: var(--accent-text);
    background: var(--accent);
    border-color: var(--accent);
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2s; }
    .open-btn { transition: none; }
}

/* ---------------------------------------------------------------------------
 * Navigation
 *
 * Bottom tabs for the three things a member does often, and a menu for
 * everything else. Thumb-reachable on a phone; the body gets bottom padding so
 * the bar never covers the last row of content.
 * ------------------------------------------------------------------------ */

body.has-tabs .wrap { padding-bottom: 96px; }

nav.bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
}

nav.bottom a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

nav.bottom a.on { color: var(--accent); }
nav.bottom .ico { font-size: 19px; line-height: 1; }

/* --- Lists and rows ----------------------------------------------------- */

.row-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 2px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}

.row-link:last-child { border-bottom: none; }
.row-link .chev { color: var(--muted); font-size: 18px; }
.row-link .row-title { font-weight: 600; font-size: 15px; }
.row-link .row-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.kv {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

.page-title { font-size: 24px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.02em; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 0 10px; }

/* --- Plan cards --------------------------------------------------------- */

.plan { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; background: var(--surface); }
.plan .name { font-size: 17px; font-weight: 700; }
.plan .price { font-size: 22px; font-weight: 700; margin: 6px 0 2px; }
.plan .terms { font-size: 13px; color: var(--muted); }
.plan .btn { margin-top: 14px; }

/* --- Busy bars ---------------------------------------------------------- */

.bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 10px; }
.bars .bar { flex: 1; background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 3px 3px 0 0; min-height: 3px; }
.bars .bar.now { background: var(--accent); }
.bar-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* --- Notices ------------------------------------------------------------ */

.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.notice.ok  { background: color-mix(in srgb, var(--ok) 12%, transparent);  color: var(--ok); }
.notice.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }

.trend { display: flex; align-items: flex-end; gap: 5px; height: 70px; margin-top: 12px; }
.trend .pt { flex: 1; background: var(--accent); border-radius: 3px; min-height: 4px; opacity: 0.8; }

@media print {
    nav.bottom, .btn, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .card { border: 1px solid #ccc; }
}
