/* Carpool — mobile-first stylesheet */

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5d6677;
    --border: #d9dde4;
    --primary: #1f6feb;
    --primary-text: #ffffff;
    --danger: #c62828;
    --ok-bg: #e5f5ea;
    --ok-text: #155c2e;
    --info-bg: #e6eefc;
    --info-text: #1a3f7a;
    --error-bg: #fdecec;
    --error-text: #8e1b1b;
    --free: #2e7d32;
    --full: #8a8f99;
    --radius: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1c2029;
        --text: #e8eaef;
        --muted: #a2a9b7;
        --border: #343a47;
        --primary: #4c8df6;
        --danger: #ef6b6b;
        --ok-bg: #173323;
        --ok-text: #a8e3bb;
        --info-bg: #1a2a47;
        --info-text: #b8cff7;
        --error-bg: #3d1c1c;
        --error-text: #f5b5b5;
        --free: #7bcf80;
        --full: #8a8f99;
    }
}

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

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.5;
}

a {
    color: var(--primary);
}

h1,
h2 {
    line-height: 1.25;
    margin: 0 0 0.75rem;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.2rem;
    margin-top: 1.75rem;
}

.panel h2,
.panel > h1 {
    margin-top: 0;
}

.wrap {
    max-width: 40rem;
    margin: 0 auto;
    padding: 0 1rem;
}

main.wrap {
    padding-bottom: 3rem;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.site-title {
    display: block;
    padding: 0.9rem 0;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}

.muted {
    color: var(--muted);
}

.center {
    text-align: center;
    margin-top: 2rem;
}

.back {
    display: inline-block;
    padding: 0.5rem 0;
}

.empty {
    color: var(--muted);
    font-style: italic;
}

/* Forms */

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

label {
    font-weight: 600;
}

input[type="text"],
input[type="search"],
input[type="password"],
select {
    width: 100%;
    min-height: 3rem;
    padding: 0.6rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

input:focus,
select:focus,
.button:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 1px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.6rem 1.1rem;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.button.primary {
    color: var(--primary-text);
    background: var(--primary);
    border-color: var(--primary);
}

.button.danger {
    color: var(--danger);
    border-color: var(--danger);
}

form > .button,
.stack > .button {
    width: 100%;
}

.choice {
    border: 0;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.choice legend {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.option input {
    width: 1.3rem;
    height: 1.3rem;
    margin: 0;
}

.option:has(input:checked) {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.add-form:has(#role-seek:checked) .driver-fields {
    display: none;
}

.add-form:has(#role-drive:checked) .driver-fields .muted {
    display: none;
}

details.panel summary {
    cursor: pointer;
    font-weight: 600;
    min-height: 2rem;
}

details[open] summary {
    margin-bottom: 0.75rem;
}

/* Flash messages */

.flash {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.flash-ok {
    background: var(--ok-bg);
    color: var(--ok-text);
}

.flash-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.flash-error {
    background: var(--error-bg);
    color: var(--error-text);
}

/* Search */

.search-label {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.search-row {
    display: flex;
    gap: 0.5rem;
}

.search-row input {
    flex: 1;
    min-height: 3.25rem;
    font-size: 1.15rem;
}

.results {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
}

.results li + li {
    border-top: 1px solid var(--border);
}

.results a {
    display: flex;
    flex-direction: column;
    padding: 0.7rem 0.25rem;
    min-height: 3rem;
    text-decoration: none;
    color: var(--text);
}

.result-name {
    font-weight: 600;
    color: var(--primary);
}

.result-status {
    font-size: 0.95rem;
    color: var(--muted);
}

#geen-resultaat {
    margin-top: 0.5rem;
}

#geen-resultaat .button {
    width: 100%;
}

/* Cars */

.cars {
    display: grid;
    gap: 1rem;
}

.car {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.car-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.car-label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
}

.car-driver {
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
}

.car-note {
    margin: 0.5rem 0 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.badge {
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    color: var(--free);
    border: 1px solid currentColor;
    white-space: nowrap;
}

.badge-full {
    color: var(--full);
}

.seats {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.seat {
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    overflow-wrap: anywhere;
}

.seat-taken {
    background: var(--bg);
}

.seat-taken a {
    text-decoration: none;
    font-weight: 600;
}

.seat-free {
    border: 2px dashed var(--border);
    color: var(--muted);
}

.join {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.join form .button {
    width: 100%;
}

/* People */

.people {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.people a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.4rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
}

.total {
    margin-top: 1rem;
}

.status {
    margin: 0;
    color: var(--muted);
}

@media (min-width: 40rem) {
    .button {
        width: auto;
    }
}
