/* Ramsay's Site — shared styles (light, modern) */

:root {
    --bg: #ebe7df;
    --card: #f8f6f1;
    --text: #1c1917;
    --muted: #6b6459;
    --accent: #44403c;
    --accent-dark: #292524;
    --accent-2: #44403c;
    --border: #ddd6ca;
    --green: #166534;
    --green-bg: #e3efe4;
    --red: #b91c1c;
    --red-bg: #f7e8e6;
    --gray-bg: #f0ede6;
    --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .05);
    --hero-bg: #f8f6f1;
    --hero-text: #1c1917;
    --hero-muted: #6b6459;
    --hero-edge: #6b7f3a;
    --hero-pos: #166534;
    --hero-neg: #b91c1c;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Top bar --- */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    font-weight: 800;
    font-size: 1.15em;
    letter-spacing: -.02em;
    color: var(--text);
}
.topbar a.nav-link {
    color: var(--muted);
    font-size: .9em;
    font-weight: 500;
}
.topbar a.nav-link:hover { color: var(--text); text-decoration: none; }

/* --- Page layout --- */
.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 26px 24px 60px;
}

/* --- Hero --- */
.hero {
    background: var(--hero-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--hero-edge);
    border-radius: 14px;
    color: var(--hero-text);
    padding: 22px 26px 20px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.hero h1 { font-size: 1.65em; letter-spacing: -.02em; margin: 0 0 4px; }
.hero .subtitle { color: var(--hero-muted); margin: 0; font-size: .95em; }

/* --- Summary cards --- */
.cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 26px;
    text-align: center;
    min-width: 140px;
    flex: 1;
    max-width: 220px;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--border);
}
.card.good::before { background: var(--green); }
.card.bad::before  { background: var(--red); }
.card .num { font-size: 1.8em; font-weight: 800; letter-spacing: -.03em; }
.card .label {
    font-size: .72em; color: var(--muted);
    text-transform: uppercase; letter-spacing: .07em; margin-top: 3px;
}
.pos { color: var(--green); }
.neg { color: var(--red); }

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    background: var(--gray-bg);
    border-radius: 12px;
    padding: 4px;
    width: fit-content;
}
.tab {
    padding: 8px 22px;
    border-radius: 9px;
    font-size: .9em;
    font-weight: 600;
    color: var(--muted);
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active {
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* --- Filter --- */
.filter { margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.filter label { font-size: .9em; color: var(--muted); }
select {
    padding: 8px 12px;
    font-size: .92em;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
}
select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- Table --- */
.table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; font-size: .9em; }
th, td { padding: 11px 14px; text-align: left; vertical-align: middle; }
th {
    background: var(--gray-bg);
    color: var(--muted);
    font-size: .72em;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td { border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-bg); }
td.r, th.r { text-align: right; white-space: nowrap; }

.match { font-weight: 600; }
.date-cell { color: var(--muted); font-size: .92em; white-space: nowrap; }
.chip {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 9px;
    border-radius: 999px;
    background: var(--gray-bg);
    color: var(--accent-dark);
    font-size: .74em;
    font-weight: 600;
}
.score-pill {
    display: inline-block;
    min-width: 52px;
    text-align: center;
    padding: 3px 10px;
    border-radius: 8px;
    background: var(--gray-bg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.bet-cell { max-width: 280px; }
.bet-cell .src-paper, .bet-cell .src-real { display: block; margin-top: 2px; }
.stake-cell { white-space: nowrap; }
.stake-cell .odds { color: var(--muted); font-size: .85em; }
tr.pending td { opacity: .62; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: .8em;
    font-weight: 700;
}
.badge.W { background: var(--green-bg); color: var(--green); }
.badge.L { background: var(--red-bg); color: var(--red); }
.badge.PENDING { background: var(--gray-bg); color: var(--muted); }
.badge.OPEN { background: #fff4e0; color: #b06a00; }
.potential { color: #b06a00; font-size: .9em; font-weight: 600; }

.src-paper { color: #8e44ad; font-size: .8em; font-weight: 600; }
.src-system { color: var(--accent-dark); font-size: .8em; font-weight: 700; }
.src-manual { color: #c2730a; font-size: .8em; font-weight: 700; }

/* --- Auth pages (login, change/reset password) --- */
body.auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg);
}
.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(16, 24, 40, .08);
    padding: 36px 34px 30px;
    width: 100%;
    max-width: 380px;
}
.auth-card h1 {
    font-size: 1.3em;
    margin: 0 0 22px;
    text-align: center;
    letter-spacing: -.02em;
}
.auth-card label {
    display: block;
    font-size: .82em;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
}
.auth-card input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: .95em;
    background: var(--gray-bg);
}
.auth-card input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(79, 109, 245, .15);
}
.auth-card button {
    width: 100%;
    padding: 11px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: .95em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
.auth-card button:hover { filter: brightness(1.07); }
.flash, .error {
    background: var(--red-bg); color: var(--red);
    border: 1px solid #f5c6c0;
    padding: 9px 12px; border-radius: 10px;
    font-size: .88em; margin-bottom: 14px;
}
.info, .success {
    background: #e8f0fe; color: #2c4ec9;
    border: 1px solid #c4d3f7;
    padding: 9px 12px; border-radius: 10px;
    font-size: .88em; margin-bottom: 14px;
}
.success { background: var(--green-bg); color: var(--green); border-color: #bfe3cc; }
.forgot-link {
    display: block; text-align: center;
    margin-top: 16px; font-size: .82em; color: var(--muted);
}

/* --- Stake calculator (shared partial) --- */
.calc-grid { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.calc-grid label { font-size: .82em; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.calc-grid input, .calc-grid select {
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 1em; background: var(--gray-bg); min-width: 150px;
}
.calc-result { border-top: 1px solid var(--border); padding-top: 16px; }
.calc-result .big { font-size: 1.4em; font-weight: 800; letter-spacing: -.02em; }
.calc-result .row { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 4px; }
.calc-result .lbl { font-size: .74em; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.calc-note { font-size: .88em; margin-top: 10px; }
.calc-skip { color: var(--red); font-weight: 700; }
.calc-cap { color: #b06a00; font-weight: 600; }

/* --- Shared footer --- */
.site-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 26px 24px 40px;
    font-size: .82em;
    color: var(--muted);
    border-top: 1px solid var(--border);
    margin-top: 30px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* --- Mobile --- */
@media (max-width: 720px) {
    .topbar-inner {
        padding: 10px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .topbar-inner > span:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 14px;
    }
    .topbar a.nav-link { margin-right: 0 !important; font-size: .92em; }
    .brand { font-size: 1.05em; }

    .page { padding: 16px 14px 40px; }
    .hero { padding: 16px 18px 14px; }
    .hero h1 { font-size: 1.3em; }
    .hero .subtitle { font-size: .88em; }

    /* Summary cards: full width, stacked */
    .cards { gap: 10px; }
    .card { min-width: 0; max-width: none; flex: 1 1 100%; padding: 12px 16px; }

    /* Tables stay readable and swipeable */
    table { font-size: .84em; }
    th, td { padding: 9px 10px; }
    .table-card { border-radius: 12px; }

    /* Stake calculator: inputs stack full width */
    .calc-grid { flex-direction: column; gap: 12px; }
    .calc-grid label { width: 100%; }
    .calc-grid input, .calc-grid select { width: 100%; min-width: 0; }
    .calc-result .row { gap: 16px; }
    .calc-result .big { font-size: 1.2em; }

    .site-footer { padding: 20px 14px 32px; }
}

/* --- Data health warning (only rendered when something is stale) --- */
.health-warn {
    max-width: 1200px;
    margin: 24px auto 0;
    padding: 10px 18px;
    background: var(--red-bg);
    border: 1px solid var(--red);
    border-radius: 10px;
    font-size: .86em;
}
.health-warn a { color: var(--red); font-weight: 600; }
@media (max-width: 720px) { .health-warn { margin: 16px 14px 0; } }
