:root {
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --accent: #14B8A6;
    --background: #F7F8FC;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --text: #0F172A;
    --muted: #64748B;
    --success: #16A34A;
    --warning: #F59E0B;
    --danger: #DC2626;
    --info: #0EA5E9;
    --radius-card: 12px;
    --radius-control: 10px;
    --input-height: 44px;
    --focus-ring: 0 0 0 4px rgba(79, 70, 229, 0.25);
}

* {
    box-sizing: border-box;
}

/* Bootstrap's spacing/type scale is all rem-based, relative to this root
   font-size - shrinking it here scales buttons, form controls, tables,
   badges and headings down together consistently, without needing to
   recompile Bootstrap from source (it's loaded precompiled from a CDN). */
html {
    font-size: 87.5%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn {
    border-radius: var(--radius-control);
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    transition: all 0.2s ease-in-out;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--focus-ring);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

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

.btn-danger:hover,
.btn-danger:focus {
    background-color: #B91C1C;
    border-color: #B91C1C;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.25);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-control,
.form-select {
    border-radius: var(--radius-control);
    min-height: var(--input-height);
    border-color: var(--border);
    padding: 0.55rem 0.85rem;
    background-color: var(--surface);
}

.form-select {
    /* .form-select's dropdown-arrow icon is a fixed-position background
       image, not part of normal text flow - it needs more right padding
       than a plain .form-control or option text runs into the arrow. */
    padding-right: 2.25rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 0.35rem;
    border-color: var(--border);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
}

.card {
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.card-header,
.card-footer {
    background-color: var(--surface);
    border-color: var(--border);
}

.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.table {
    border-color: var(--border);
}

.table thead th {
    background-color: #F1F5F9;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

.modal-content {
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.modal-backdrop.show {
    opacity: 0.5;
}

.dropdown-menu {
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(79, 70, 229, 0.08);
}

.navbar {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #fff;
}

.pagination .page-link {
    border-radius: 10px;
    border-color: var(--border);
    color: var(--text);
}

.pagination .page-link:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.alert {
    border-radius: var(--radius-card);
    border: 1px solid transparent;
}

.alert-success {
    background-color: rgba(22, 163, 74, 0.1);
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.2);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-danger {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.2);
}

.alert-info {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--info);
    border-color: rgba(14, 165, 233, 0.2);
}

.badge {
    border-radius: 999px;
    font-weight: 600;
    padding: 0.35em 0.75em;
}

.badge.bg-success {
    background-color: var(--success) !important;
}

.badge.bg-warning {
    background-color: var(--warning) !important;
    color: #111827;
}

.badge.bg-danger {
    background-color: var(--danger) !important;
}

.badge.bg-info {
    background-color: var(--info) !important;
}

.page-header {
    margin-bottom: 1.5rem;
}

.text-muted {
    color: var(--muted) !important;
}

.bg-light {
    background-color: var(--background) !important;
}

.bg-white {
    background-color: var(--surface) !important;
}

.border {
    border-color: var(--border) !important;
}

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


.member-widget-card {
    min-height: 220px;
}

.member-widget-card .border-bottom:last-child {
    border-bottom: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Openingstijden (Beheer > Rijbakken/Banen): dag, van, tot, gesloten. De tijdvelden
   krijgen altijd genoeg breedte voor "22:00" plus het klokje; op smalle kaarten
   valt "Gesloten" netjes onder de tijden in plaats van buiten de kaart. */
.opening-hours-row {
    display: grid;
    grid-template-columns: minmax(5.5rem, 1fr) minmax(7rem, 8rem) minmax(7rem, 8rem) auto;
    gap: .5rem .75rem;
    align-items: center;
    margin-bottom: .5rem;
}
.opening-hours-row .form-control { min-width: 0; }
.opening-hours-closed { white-space: nowrap; }
#openingHours { container-type: inline-size; }
@container (max-width: 28rem) {
    .opening-hours-row { grid-template-columns: 1fr 1fr; }
    .opening-hours-day { grid-column: 1 / -1; font-weight: 600; }
    .opening-hours-row { margin-bottom: 1rem; }
}

/* Mode switch "Mijn vereniging | Beheer" in the top bar (App/app_nav.php, App/lib/helpers_ui_mode.php). */
.mode-switch .mode-switch-btn {
    padding: .2rem .7rem;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.4;
}
.mode-switch.w-100 .mode-switch-btn {
    padding: .45rem .7rem;
}
.mode-switch .mode-switch-btn[aria-pressed="true"] {
    color: #111827;
}
/* Top bar: menu items stay on one line (the switch and attention list take some room). */
@media (min-width: 992px) {
    #appNavDesktop .nav-link { white-space: nowrap; }
    #attentionMenu .attention-menu { min-width: 22rem; }
}

/* Where you are + club switcher (App/app_nav.php, App/lib/helpers_club_switch.php):
   the active club's logo/initials and name on the left, its colour as accent. */
.navbar.club-nav {
    border-top: 3px solid var(--club-color, var(--primary));
}
.club-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    max-width: min(22rem, 52vw);
    margin-right: .5rem;
    white-space: normal; /* Bootstrap's .navbar-brand is nowrap: the name may take two lines */
    padding: .2rem .35rem .2rem .2rem;
    color: #fff;
    text-decoration: none;
    border: 0;
    border-radius: 10px;
}
button.club-brand:hover,
button.club-brand:focus-visible,
.club-switcher.show .club-brand {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}
.club-brand.dropdown-toggle::after {
    margin-left: .1rem;
    opacity: .75;
}
.club-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
    text-align: left;
}
/* Owner feedback: the club name is always shown whole - never "..." - and
   may wrap onto a second line; long names are set a step smaller
   (App/app_nav.php adds .club-brand-long > 24 characters, -xlong > 40). */
.club-brand-name {
    font-weight: 700;
    font-size: 1rem;
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    line-height: 1.15;
    padding-bottom: 1px;
    box-shadow: inset 0 -2px 0 var(--club-color, var(--primary));
}
.club-brand-long .club-brand-name { font-size: .9rem; }
.club-brand-xlong .club-brand-name { font-size: .82rem; }
.club-brand-long .club-brand-platform,
.club-brand-xlong .club-brand-platform { display: none; } /* the name needs the room; the platform shows in the tab/title */
.club-brand-platform {
    font-size: .7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .55);
    letter-spacing: .02em;
}
.club-logo {
    flex: 0 0 auto;
    border-radius: 8px;
    background: #fff;
    object-fit: contain;
}
.club-initials {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--club-color, var(--primary));
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .02em;
    line-height: 1;
}
.club-initials[hidden] {
    display: none;
}
.club-switcher-menu {
    width: min(24rem, calc(100vw - 1.5rem));
    max-height: min(70vh, 32rem);
    overflow-y: auto;
    padding-top: .25rem;
}
.club-switch-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .85rem;
    border-left: 3px solid transparent;
    white-space: normal;
}
.club-switch-item:hover,
.club-switch-item:focus-visible {
    border-left-color: var(--club-color, var(--primary));
}
.club-switch-item.active,
.club-switch-item.active:hover {
    background: rgba(79, 70, 229, .06);
    color: var(--text);
    border-left-color: var(--club-color, var(--primary));
    cursor: default;
}
.club-switch-text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}
.club-switch-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.club-switch-roles {
    font-size: .8rem;
    color: var(--muted);
}
.club-switch-count[hidden] {
    display: none;
}
/* Phone and tablet (menu in the offcanvas): the club name gets the first row
   next to the menu button, the "Lid | Beheerder" switch moves to a row below. */
@media (max-width: 991.98px) {
    .club-nav > .container { flex-wrap: wrap; row-gap: .35rem; }
    .club-nav .club-brand,
    .club-nav .club-switcher { flex: 1 1 0; max-width: none; min-width: 0; }
    .club-nav .club-switcher .club-brand { width: 100%; }
    .club-nav .navbar-toggler { order: 2; flex: 0 0 auto; margin-right: .3rem; }
    /* Its red count stays inside the screen (also with three digits). */
    .club-nav .attention-toggler-badge { left: auto !important; right: -.45rem; transform: translateY(-40%) !important; }
    .club-nav #modeSwitchBar { order: 3; flex: 0 0 100%; margin: 0 !important; display: flex; justify-content: flex-end; }
}
@media (max-width: 575.98px) {
    .club-brand { margin-right: .25rem; }
    .club-brand-platform { display: none; }
    .club-brand-name { font-size: .92rem; }
    .club-brand-long .club-brand-name { font-size: .85rem; }
    .club-brand-xlong .club-brand-name { font-size: .78rem; }
}
/* Laptop widths: compact items on the right (icon instead of the e-mail
   address and the word "Instellingen"; both stay for screen readers and in
   the tooltip), so the club name has room. Wide screens show everything. */
@media (min-width: 992px) {
    #appNavDesktop .nav-link { padding-left: .45rem; padding-right: .45rem; }
    .nav-account-icon { display: none; }
}
@media (min-width: 1400px) {
    .club-brand { max-width: 30rem; } /* wide screens: most names fit on one line */
}
@media (min-width: 992px) and (max-width: 1399.98px) {
    .nav-account-icon { display: inline; }
    #appNavDesktop .nav-compact-label {
        position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
        overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
    }
}
/* "Mijn clubs" overview: a card per club (account/index.php). */
.club-card {
    border-top: 4px solid var(--club-color, var(--primary));
}
.club-card-active {
    box-shadow: 0 0 0 2px rgba(22, 163, 74, .25);
}
.club-card .min-w-0,
.club-brand .min-w-0 {
    min-width: 0;
}
.club-card .btn-link:not(.text-danger) {
    color: var(--primary);
    text-decoration: none;
}
.club-card .btn-link:hover {
    text-decoration: underline;
}
