/* Community Centre Bookings — plain CSS, no framework */

:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --ink: #1f2328;
    --muted: #6b7076;
    --line: #dcdad4;
    --accent: #1e6b52;
    --accent-ink: #ffffff;
    --accent-soft: #e3f1ea;
    --warn: #8a5a00;
    --warn-soft: #fff4dc;
    --danger: #a3282b;
    --tentative: #b7791f;
    --tentative-soft: #fff7e6;
    --cancelled: #8b8f94;
    --radius: 6px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; margin: 2rem 0 .75rem; }
code { font-family: ui-monospace, Consolas, monospace; }

/* ---- Shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 210px; flex-shrink: 0; background: #22322c; color: #e8efe9;
    display: flex; flex-direction: column; padding: 1rem .75rem; gap: 2px;
}
.sidebar .brand { font-weight: 700; font-size: 1.05rem; line-height: 1.25; padding: .25rem .5rem 1rem; }
.sidebar a { color: #dfe8e2; text-decoration: none; padding: .45rem .6rem; border-radius: var(--radius); }
.sidebar a:hover { background: rgba(255,255,255,.08); }
.sidebar a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.sidebar .nav-section { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: 1rem .6rem .25rem; }
.sidebar .spacer { flex: 1; }
.sidebar .signed-in { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; border-top: 1px solid rgba(255,255,255,.15); padding-top: .75rem; }
.sidebar .signed-in span { padding: 0 .6rem .25rem; opacity: .75; word-break: break-all; }
.sidebar .signed-in .btn.link { color: #dfe8e2; text-align: left; padding: .45rem .6rem; }
.content { flex: 1; padding: 1.5rem 2rem 3rem; min-width: 0; }

@media (max-width: 800px) {
    .shell { flex-direction: column; }
    .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar .brand { padding: .25rem .5rem; }
    .sidebar .spacer, .sidebar .nav-section { display: none; }
    .sidebar .signed-in { flex-direction: row; border: 0; padding: 0; }
    .content { padding: 1rem; }
}

/* ---- Common ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.hint, .audit, .empty, .muted { color: var(--muted); }
.audit { font-size: .85rem; margin-top: 2rem; }
.nowrap { white-space: nowrap; }
ul.plain { padding-left: 1.1rem; }

.btn {
    display: inline-block; font: inherit; cursor: pointer; text-decoration: none;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    padding: .45rem .85rem; border-radius: var(--radius); line-height: 1.2;
}
.btn:hover { border-color: #b9b6ae; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.link { background: none; border: none; color: var(--accent); padding: .45rem .25rem; text-decoration: underline; }
.btn.small { padding: .25rem .55rem; font-size: .85rem; }
.btn.small.link { padding: .25rem; }

input, select, textarea {
    font: inherit; color: inherit; padding: .45rem .55rem;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }

.callout { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: .75rem 1rem; border-radius: var(--radius); margin: 1rem 0; }
.callout.warning { background: var(--warn-soft); border-color: var(--tentative); }
.callout.success { background: var(--accent-soft); }
.callout ul { margin: .5rem 0; }
.callout p { margin: .25rem 0; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; background: #eee; }
.badge.confirmed { background: var(--accent-soft); color: var(--accent); }
.badge.tentative { background: var(--tentative-soft); color: var(--warn); border: 1px dashed var(--tentative); }
.badge.cancelled { background: #eeeeee; color: var(--cancelled); text-decoration: line-through; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #faf9f7; }
.table tr.muted td { color: var(--muted); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: .25rem; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem 1.25rem; max-width: 900px; }
.form-grid label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.form-grid label > input, .form-grid label > select, .form-grid label > textarea { font-weight: 400; }
.form-grid label small { font-weight: 400; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid label.check, label.check { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0; background: var(--surface); }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
fieldset .inline { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
fieldset label.check { display: inline-flex; margin-right: .75rem; }
input.narrow { width: 4.5rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1.25rem 0; }
.validation-message, .validation-errors, .validation-summary-errors { color: var(--danger); font-size: .85rem; font-weight: 400; }
.validation-errors ul, .validation-summary-errors ul { margin: 0; padding-left: 1rem; }
.invalid { border-color: var(--danger); }

/* ---- Calendar ---- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 1100px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .week { grid-template-columns: 1fr; } }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 9rem; display: flex; flex-direction: column; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day header { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .9rem; }
.day header a { text-decoration: none; font-size: 1.2rem; line-height: 1; padding: 0 .3rem; border-radius: 4px; }
.day header a:hover { background: var(--accent-soft); }
.day .empty { font-size: .85rem; margin: .6rem; }
.booking {
    display: flex; flex-direction: column; gap: .1rem; margin: .4rem .4rem 0; padding: .4rem .5rem;
    border-radius: 4px; text-decoration: none; color: var(--ink); font-size: .85rem;
    background: var(--accent-soft); border-left: 4px solid var(--accent);
}
.booking:last-child { margin-bottom: .4rem; }
.booking:hover { filter: brightness(.97); }
.booking .time { font-weight: 600; font-variant-numeric: tabular-nums; }
.booking .time .repeat { margin-left: .4rem; }
.booking .title { font-weight: 500; }
.booking .meta { color: var(--muted); font-size: .8rem; }
.booking .badge { align-self: flex-start; margin-top: .15rem; }
.booking.tentative { background: repeating-linear-gradient(135deg, var(--tentative-soft) 0 8px, #fffdf8 8px 16px); border-left: 4px dashed var(--tentative); }
.booking.cancelled { background: #f1f1f1; border-left-color: var(--cancelled); color: var(--muted); }
.booking.cancelled .title { text-decoration: line-through; }
.legend { margin-top: 1rem; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.swatch { display: inline-block; width: 1rem; height: .8rem; border-radius: 2px; margin-left: .6rem; }
.swatch.confirmed { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.swatch.tentative { background: var(--tentative-soft); border-left: 3px dashed var(--tentative); }
.swatch.cancelled { background: #f1f1f1; border-left: 3px solid var(--cancelled); }

/* ---- Account pages ---- */
.account-page { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 4rem 1rem; }
.account-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 2rem; width: 100%; max-width: 440px; }
.account-card .brand { color: var(--accent); font-weight: 700; margin: 0 0 1rem; }
.account-card h1 { margin-bottom: 1rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
.stack label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.stack label small { font-weight: 400; color: var(--muted); }
.stack input { font-weight: 400; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .75rem; }
.qr { margin: .75rem 0; }
.qr img { image-rendering: pixelated; border: 1px solid var(--line); }
.key { display: inline-block; background: #f3f2ef; padding: .15rem .4rem; border-radius: 4px; letter-spacing: .05em; }
.recovery-codes { columns: 2; list-style: none; padding: 0; font-size: 1.05rem; }
.recovery-codes li { padding: .2rem 0; }

/* ---- Blazor error bar ---- */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: var(--warn-soft); border-top: 2px solid var(--tentative); padding: .75rem 1.25rem;
}
#blazor-error-ui .reload { margin-left: .5rem; }

/* Closures and bank holidays */
.day.closed { background: repeating-linear-gradient(45deg, #f4f4f4 0 10px, #ececec 10px 20px); }
.day-note { margin: .4rem .5rem 0; padding: .25rem .45rem; border-radius: 4px; font-size: .8rem; font-weight: 600; }
.day-note.closure { background: #e2e2e2; color: #444; border-left: 3px solid #777; }
.day-note.holiday { background: #eef3fb; color: #2f5597; border-left: 3px solid #7a9cd6; font-weight: 500; }
.swatch.closed { background: #e2e2e2; border-left: 3px solid #777; }
.swatch.holiday { background: #eef3fb; border-left: 3px solid #7a9cd6; }
.holiday-note { color: #2f5597; }
small.holiday-note { display: block; margin-top: .2rem; }
