/* =========================================================
   Kursfinder / Eulenkurse — global design tokens & utilities
   Stack: Bootstrap 5, HTMX, no build toolchain (plain CSS)
   ========================================================= */

/* ----- Design tokens ------------------------------------ */
:root {
    --kf-primary: #216b57;
    --kf-primary-hover: #1a5646;
    --kf-primary-soft: #e3f1e7;
    --kf-primary-softer: #f5faf3;

    /* Mint and honey are decorative (surfaces, mascot): text and icons stay ink or action green. */
    --kf-mint: #62bba3;
    --kf-honey: #f7c95c;

    --kf-accent: #216b57;
    --kf-accent-hover: #1a5646;
    --kf-accent-soft: #fff9ed;

    --kf-success: #216b57;
    --kf-success-soft: #e3f1e7;
    --kf-warning: #8a5a00;
    --kf-warning-soft: #fdf0cf;
    --kf-danger: #b3261e;
    --kf-danger-soft: #fbe5e3;

    --kf-bg: #f5faf3;
    --kf-surface: #ffffff;
    --kf-surface-raised: #fff9ed;

    --kf-text: #263d35;
    --kf-text-secondary: #52675e;
    --kf-muted: #52675e; /* 5.7:1 on --kf-bg (WCAG AA) */

    --kf-border: #d5e4da;
    --kf-border-light: #e3f1e7;

    --kf-shadow-sm: 0 1px 2px 0 rgb(38 61 53 / 0.05);
    --kf-shadow: 0 2px 6px -1px rgb(38 61 53 / 0.07);
    --kf-shadow-md: 0 8px 14px -4px rgb(38 61 53 / 0.09);
    --kf-shadow-lg: 0 14px 24px -8px rgb(38 61 53 / 0.11);
    --kf-shadow-xl: 0 24px 48px -12px rgb(38 61 53 / 0.14);

    --kf-radius: 0.75rem;
    --kf-radius-lg: 1.125rem;
    --kf-radius-xl: 1.25rem;
    --kf-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --kf-font-heading: "Manrope", system-ui, sans-serif;
    --kf-font-body: "Source Sans 3", system-ui, sans-serif;

    --bs-primary: #216b57;
    --bs-primary-rgb: 33, 107, 87;
    --bs-link-color: #216b57;
    --bs-link-color-rgb: 33, 107, 87;
    --bs-link-hover-color: #1a5646;
    --bs-link-hover-color-rgb: 26, 86, 70;
    --bs-body-font-family: var(--kf-font-body);
    --bs-body-color: #263d35;
}

/* ----- Base --------------------------------------------- */
h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .navbar-brand {
    font-family: var(--kf-font-heading);
    font-weight: 750;
    letter-spacing: -0.01em;
}

body {
    font-family: var(--kf-font-body);
    background: var(--kf-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--kf-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1 0 auto;
}

footer {
    margin-top: auto;
}

/* ----- Surfaces ----------------------------------------- */
.card,
.dropdown-menu {
    border-radius: var(--kf-radius-lg);
}

.navbar {
    border-radius: 0;
}

.card {
    background: var(--kf-surface);
    border: 1px solid var(--kf-border) !important;
    box-shadow: var(--kf-shadow);
    transition: box-shadow var(--kf-transition), transform var(--kf-transition), border-color var(--kf-transition);
}

.navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--kf-border-light);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    transition: all var(--kf-transition);
}

.navbar.scrolled {
    box-shadow: var(--kf-shadow);
    background: rgba(255, 255, 255, 0.95) !important;
}

.navbar-brand img {
    height: 32px;
}

/* ----- Course cards ------------------------------------- */
.course-card {
    transition: transform var(--kf-transition), box-shadow var(--kf-transition), border-color var(--kf-transition);
    cursor: pointer;
    overflow: visible;
    position: relative;
    z-index: 0;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--kf-shadow-lg);
    border-color: var(--kf-primary-soft);
    z-index: 3100;
}

.course-card .dropdown {
    position: relative;
    z-index: 3000;
}

.course-card .dropdown-menu {
    z-index: 3050 !important;
}

/* ----- Provider logo frames ----------------------------- */
/*
 * All logo frames use a fixed canvas so mixed-source logos render consistently.
 * Frames stay light and logos blend with mix-blend-mode: multiply, which makes
 * white logo backgrounds disappear. Logos that are white-on-transparent
 * (provider.logo_needs_dark_bg) get the --dark variant instead.
 */
.provider-logo-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--kf-border-light);
    background: linear-gradient(180deg, #ffffff 0%, var(--kf-bg) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
    flex-shrink: 0;
}

.provider-logo-frame--lg {
    width: 56px;
    height: 56px;
    padding: 8px;
}

.provider-logo-frame--xl {
    width: 76px;
    height: 76px;
    padding: 10px;
}

.provider-logo-frame--sm {
    width: 28px;
    height: 28px;
    padding: 3px;
    border-radius: 8px;
}

.provider-logo-frame--hero {
    width: 100%;
    height: 100px;
    padding: 8px 34px;
    border-radius: 10px;
    box-shadow: var(--kf-shadow-sm);
}

/* White-on-transparent logos are unreadable on the light frames */
.provider-logo-frame--dark {
    background: #596373;
    border-color: #454e5c;
}

.provider-logo-band {
    height: 92px;
    margin: -1.5rem -1.5rem 1rem;
    border-bottom: 1px solid var(--kf-border-light);
    border-top-left-radius: calc(var(--kf-radius-lg) - 1px);
    border-top-right-radius: calc(var(--kf-radius-lg) - 1px);
    background:
        radial-gradient(circle at 18% 20%, var(--kf-accent-soft) 0%, transparent 40%),
        radial-gradient(circle at 84% 78%, #ecfeff 0%, transparent 42%),
        linear-gradient(180deg, var(--kf-accent-soft) 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.provider-logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    mix-blend-mode: multiply;
}

.provider-logo-frame--dark .provider-logo-image {
    mix-blend-mode: normal;
}

.provider-logo-fallback {
    color: var(--kf-primary);
}

.provider-logo-fallback--hero {
    font-size: 1.35rem;
}

/* ----- Provider badge (course cards) -------------------- */
.provider-badge {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
    cursor: default;
}

/* ----- Status badges ------------------------------------ */
.badge {
    font-weight: 600;
    padding: 0.4em 0.8em;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
    border-radius: 999px;
}

.badge-available {
    background-color: var(--kf-success-soft);
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-almost-full {
    background-color: var(--kf-warning-soft);
    color: var(--kf-warning);
    border: 1px solid var(--kf-honey);
}

.badge-waitlist {
    background-color: var(--kf-danger-soft);
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.badge-full {
    background-color: var(--kf-primary-soft);
    color: var(--kf-text-secondary);
    border: 1px solid var(--kf-border);
}

/* ----- Forms -------------------------------------------- */
.form-label,
.form-check-label {
    color: var(--kf-text);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control,
.form-select,
.input-group-text {
    border-radius: var(--kf-radius);
    border: 1px solid var(--kf-border);
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    transition: border-color var(--kf-transition), box-shadow var(--kf-transition), background-color var(--kf-transition);
}

.form-control::placeholder {
    color: var(--kf-muted);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--kf-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--kf-primary);
    box-shadow: 0 0 0 3px var(--kf-primary-soft);
    background-color: #fff;
}

.input-group-text {
    background: var(--kf-bg);
    color: var(--kf-text-secondary);
    border-color: var(--kf-border);
}

.input-group:focus-within .input-group-text {
    border-color: var(--kf-primary);
    color: var(--kf-primary);
}

/* ----- Tom Select --------------------------------------- */
.ts-wrapper {
    border: none !important;
    box-shadow: none !important;
}

.ts-wrapper .ts-control {
    border-radius: var(--kf-radius);
    border: 1px solid var(--kf-border) !important;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    transition: border-color var(--kf-transition), box-shadow var(--kf-transition);
    background: var(--kf-surface);
}

.ts-wrapper .ts-control:hover {
    border-color: var(--kf-border) !important;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--kf-primary) !important;
    box-shadow: 0 0 0 3px var(--kf-primary-soft);
}

.ts-wrapper.multi .ts-control > div {
    background: var(--kf-primary-soft);
    border: 1px solid var(--kf-border);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.ts-dropdown {
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius);
    box-shadow: var(--kf-shadow-lg);
    margin-top: 4px;
}

.ts-dropdown .option {
    padding: 0.625rem 0.875rem;
    transition: background-color var(--kf-transition);
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: var(--kf-primary-softer);
    color: var(--kf-primary-hover);
}

/* ----- Navbar menus ------------------------------------- */
.user-dropdown-toggle {
    background: var(--kf-primary-soft);
    border: 1px solid var(--kf-border);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all var(--kf-transition);
}

.user-dropdown-toggle:hover {
    background: var(--kf-primary-softer);
    border-color: var(--kf-primary);
}

.user-menu .dropdown-menu {
    border: 1px solid var(--kf-border);
    box-shadow: var(--kf-shadow-lg);
    padding: 0.5rem;
    min-width: 200px;
}

.user-menu .dropdown-item {
    border-radius: var(--kf-radius);
    padding: 0.625rem 0.875rem;
    font-weight: 500;
    color: var(--kf-text-secondary);
    transition: all var(--kf-transition);
}

.user-menu .dropdown-item:hover {
    background: var(--kf-primary-softer);
    color: var(--kf-primary-hover);
}

.user-menu .dropdown-item i {
    opacity: 0.7;
}

.user-menu .dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--kf-border-light);
}

.main-menu .nav-link {
    white-space: nowrap;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: var(--kf-radius);
    color: var(--kf-text-secondary);
    border: 1px solid transparent;
    transition: all var(--kf-transition);
    font-size: 0.9375rem;
}

.main-menu {
    gap: 0.25rem;
}

.main-menu .nav-link:hover,
.main-menu .nav-link:focus {
    background: var(--kf-primary-softer);
    border-color: transparent;
    color: var(--kf-primary);
}

.main-menu .nav-link.active {
    background: var(--kf-primary-soft);
    color: var(--kf-primary-hover);
    border-color: var(--kf-border);
}

.user-menu-nav {
    gap: 0.25rem;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--kf-border);
    margin: 0 0.5rem;
}

.kf-user-name {
    display: inline-block;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.kf-user-header {
    color: var(--kf-text);
    font-weight: 600;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The desktop bar has no room for labels at any width: icons with a tooltip and aria-label. */
@media (min-width: 1200px) {
    .kf-user-name {
        max-width: 6rem;
    }
}

/* Collapsed menu: personal links stack under their own heading, apart from the public ones. */
@media (max-width: 1199.98px) {
    .main-menu {
        margin-bottom: 0.25rem;
    }
}

/* ----- Settings shell (account + notifications) --------- */
.kf-settings-nav-heading {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--kf-text-secondary);
    margin: 0 0 0.5rem;
}

.kf-settings-nav-list {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.kf-settings-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--kf-radius);
    border: 1px solid transparent;
    color: var(--kf-text-secondary);
    font-weight: 500;
    text-decoration: none;
}

.kf-settings-link:hover {
    background: var(--kf-primary-softer);
    color: var(--kf-primary-hover);
}

.kf-settings-link[aria-current="page"] {
    background: var(--kf-primary-soft);
    border-color: var(--kf-border);
    color: var(--kf-primary-hover);
    font-weight: 600;
}

@media (min-width: 992px) {
    .kf-settings-nav {
        position: sticky;
        top: 5rem;
    }
    .kf-settings-nav-list {
        flex-direction: column;
        flex-wrap: nowrap;
    }
}

.user-menu-list {
    border-left: 1px solid var(--kf-border);
    padding-left: 0.75rem;
    margin-left: 0.75rem;
}

/* ----- Buttons ------------------------------------------ */
.btn {
    border-radius: var(--kf-radius);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    transition: all var(--kf-transition);
    position: relative;
    overflow: hidden;
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--kf-radius-lg);
}

.btn-primary {
    background: var(--kf-accent);
    border: none;
    box-shadow: 0 1px 2px rgba(217, 119, 6, 0.15);
    color: #fff;
}

.btn-primary:hover {
    background: var(--kf-accent-hover);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(217, 119, 6, 0.15);
}

.btn-outline-primary {
    border: 1.5px solid var(--kf-border);
    color: var(--kf-text-secondary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--kf-primary-softer);
    border-color: var(--kf-primary);
    color: var(--kf-primary);
}

.btn-outline-secondary {
    border: 1.5px solid var(--kf-border);
    color: var(--kf-text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--kf-bg);
    border-color: var(--kf-border);
    color: var(--kf-text);
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--kf-radius);
    border-bottom-left-radius: var(--kf-radius);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--kf-radius);
    border-bottom-right-radius: var(--kf-radius);
}

.btn-group .btn.active {
    background: var(--kf-primary);
    border-color: var(--kf-primary);
    color: #fff;
}

/* ----- Alerts ------------------------------------------- */
.alert {
    border-radius: var(--kf-radius);
    border: 1px solid var(--kf-border);
    padding: 1rem 1.25rem;
}

.alert-info {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}

.alert-warning {
    background: var(--kf-warning-soft);
    border-color: var(--kf-honey);
    color: #92400e;
}

/* ----- Typography --------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--kf-text);
    letter-spacing: -0.025em;
}

.display-4, .display-5, .display-6 {
    font-weight: 700;
    letter-spacing: -0.03em;
}

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

.fw-semibold {
    font-weight: 600;
}

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

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

.bi {
    vertical-align: -0.125em;
}

/* ----- Star button -------------------------------------- */
.btn-star {
    border: none;
    background: none;
    color: var(--kf-honey);
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform var(--kf-transition), color var(--kf-transition);
    padding: 0.25rem;
}

.btn-star:hover {
    transform: scale(1.15);
}

.btn-star:active {
    transform: scale(0.95);
}

.btn-star.starred {
    color: var(--kf-warning);
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.3));
}

.btn-star:not(.starred) {
    color: var(--kf-border);
}

.btn-star:not(.starred):hover {
    color: var(--kf-honey);
}

/* ----- Calendar ----------------------------------------- */
#calendar {
    min-height: 500px;
}

.fc {
    font-family: var(--kf-font-body);
}

.fc .fc-button-primary {
    background: var(--kf-primary);
    border-color: var(--kf-primary);
    font-weight: 500;
    border-radius: var(--kf-radius);
    padding: 0.4rem 0.75rem;
}

.fc .fc-button-primary:hover {
    background: var(--kf-primary-hover);
    border-color: var(--kf-primary-hover);
}

.fc .fc-daygrid-day.fc-day-today {
    background: var(--kf-primary-softer);
}

.fc-event {
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8125rem;
}

.fc .fc-daygrid-event {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc .fc-daygrid-event .fc-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc .fc-daygrid-event-harness {
    margin-bottom: 1px;
}

@media (max-width: 768px) {
    .fc {
        font-size: 0.75rem;
    }

    .fc .fc-daygrid-event {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fc .fc-daygrid-event-harness {
        margin-bottom: 1px;
    }

    .fc .fc-daygrid-day-events {
        min-height: auto !important;
    }

    .fc-event {
        padding: 1px 4px;
        font-size: 0.6875rem;
        line-height: 1.2;
    }

    .fc .fc-daygrid-day-frame {
        min-height: 60px;
    }

    .fc .fc-col-header-cell-cushion,
    .fc .fc-daygrid-day-number {
        font-size: 0.75rem;
        padding: 4px;
    }

    .fc .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .fc .fc-toolbar-title {
        font-size: 1.125rem;
    }

    .fc .fc-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.8125rem;
    }
}

/* ----- Map ---------------------------------------------- */
#map {
    height: 500px;
    border-radius: var(--kf-radius-lg);
    border: 1px solid var(--kf-border);
    box-shadow: var(--kf-shadow);
}

.leaflet-popup-content-wrapper {
    border-radius: var(--kf-radius);
    box-shadow: var(--kf-shadow-lg);
}

/* ----- HTMX indicators ---------------------------------- */
.htmx-indicator {
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
    opacity: 1;
}

.spinner-border {
    border-width: 2px;
}

/* ----- Skeleton loading --------------------------------- */
.skeleton {
    background: linear-gradient(90deg, var(--kf-primary-soft) 25%, #e2e8f0 50%, var(--kf-primary-soft) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--kf-radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ----- Tables ------------------------------------------- */
.table {
    font-size: 0.9375rem;
}

.table > thead {
    background: var(--kf-bg);
}

.table > thead th {
    font-weight: 600;
    color: var(--kf-text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--kf-border);
}

.table > tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--kf-border-light);
}

.table > tbody tr:hover {
    background: var(--kf-primary-softer);
}

/* Responsive table: stacked cards on mobile */
.table-responsive-cards {
    display: block;
}

@media (max-width: 768px) {
    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--kf-border);
        border-radius: var(--kf-radius);
        padding: 1rem;
        background: var(--kf-surface);
        box-shadow: var(--kf-shadow-sm);
    }

    .table-responsive-cards tbody tr:hover {
        border-color: var(--kf-primary-soft);
    }

    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.375rem 0;
        border: none;
    }

    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
        color: var(--kf-text-secondary);
        font-size: 0.8125rem;
    }
}

/* ----- Filter sidebar (mobile slide-in) ----------------- */
@media (max-width: 991px) {
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        background: var(--kf-surface);
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding: 1.5rem;
        box-shadow: var(--kf-shadow-xl);
    }

    .filter-sidebar.show {
        transform: translateX(0);
    }

    .filter-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .filter-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
}

/* ----- Animations --------------------------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

.hover-lift {
    transition: transform var(--kf-transition), box-shadow var(--kf-transition);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--kf-shadow-lg);
}

/* ----- Scrollbar ---------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--kf-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--kf-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ----- Pagination --------------------------------------- */
.pagination .page-link {
    border: 1px solid var(--kf-border);
    color: var(--kf-text-secondary);
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    margin: 0 2px;
    border-radius: var(--kf-radius);
    transition: all var(--kf-transition);
}

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

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

.pagination .page-item.disabled .page-link {
    background: var(--kf-bg);
    color: var(--kf-muted);
}

/* ----- Empty state -------------------------------------- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--kf-primary-softer);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--kf-primary);
    font-size: 2rem;
}

/* ----- Data freshness indicator ------------------------- */
.data-status {
    font-size: 0.75rem;
    color: var(--kf-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--kf-bg);
    border-radius: var(--kf-radius);
    border: 1px solid var(--kf-border-light);
}

.data-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--kf-success);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* krakenlabs.notifications forms render bare widgets: give them Bootstrap's form-control look. */
.kf-fields select,
.kf-fields input:not([type="checkbox"]):not([type="radio"]) {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  border: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
}
.kf-fields input[type="checkbox"] { margin-right: 0.5rem; }

/* MCP landing pages (web/mcp_public.html, web/mcp_private.html). */
.kf-mcp-url { font-size: 1rem; overflow-wrap: anywhere; }
.kf-mcp-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.kf-mcp-pills a {
  border: 1px solid var(--kf-border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--kf-text);
  background: var(--kf-surface);
}
.kf-mcp-pills a:hover, .kf-mcp-pills a:focus-visible { border-color: var(--kf-primary); color: var(--kf-primary); }
.kf-mcp-clients { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 767.98px) { .kf-mcp-clients { grid-template-columns: 1fr; } }
.kf-mcp-client { scroll-margin-top: 5rem; }
.kf-mcp-client:target { border-color: var(--kf-primary); box-shadow: 0 0 0 0.2rem var(--kf-primary-soft); }
.kf-mcp-client pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 0.5rem 0.75rem;
  border-radius: var(--bs-border-radius);
  background: var(--kf-border-light);
}
.kf-mcp-client details { border-top: 1px solid var(--kf-border); margin-top: 0.75rem; padding-top: 0.5rem; }
.kf-mcp-client summary { cursor: pointer; font-weight: 600; }
/* White text on the brand colour var(--kf-primary) is only 3.1:1: the button uses a darker shade of the same
   hue (5.0:1, hover 6.0:1) and the mark keeps the brand colour on a white disc. */
.kf-claude-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--kf-primary-hover);
  border-color: var(--kf-primary-hover);
  color: #fff;
  font-weight: 600;
}
.kf-claude-btn:hover, .kf-claude-btn:focus-visible, .kf-claude-btn:active {
  background-color: var(--kf-primary-hover) !important;
  border-color: var(--kf-primary-hover) !important;
  color: #fff !important;
}
.kf-claude-disc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: #fff;
}

/* ----- Brand components (Light Mint) --------------------- */
.navbar-brand img {
    display: block;
    height: 34px;
    width: auto;
}

.kf-icon {
    flex-shrink: 0;
}

.kf-mascot {
    display: block;
    height: auto;
    max-width: 100%;
}

.empty-state .kf-mascot {
    margin: 0 auto 1rem;
}

.kf-my-toggle {
    background: var(--kf-primary-soft);
    border-radius: 999px;
    color: var(--kf-primary-hover) !important;
    font-weight: 600;
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
    white-space: nowrap;
}

.kf-hero {
    background: var(--kf-primary-soft);
    margin-top: -1.5rem;
    margin-bottom: 2.5rem;
    padding: 2.5rem 0;
}

.kf-hero-head {
    align-items: center;
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.kf-hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.kf-hero-lead {
    color: var(--kf-text-secondary);
    font-size: 1.25rem;
    margin: 0;
}

.kf-searchbar {
    align-items: end;
    background: var(--kf-surface);
    border-radius: var(--kf-radius-xl);
    box-shadow: var(--kf-shadow-md);
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr auto;
    padding: 1.25rem;
}

.kf-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.kf-input {
    align-items: center;
    background: var(--kf-surface);
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius);
    display: flex;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0 0.75rem;
}

.kf-input:focus-within {
    border-color: var(--kf-primary);
    box-shadow: 0 0 0 3px var(--kf-primary-soft);
}

.kf-input i {
    color: var(--kf-primary);
}

.kf-input input {
    background: transparent;
    border: 0;
    color: var(--kf-text);
    flex: 1;
    font-size: 1.0625rem;
    min-width: 0;
    outline: none;
}

.kf-catalog-note {
    color: var(--kf-text-secondary);
    margin: 0.75rem 0 0;
}

.kf-page-head {
    background: var(--kf-primary-soft);
    margin-bottom: 1.5rem;
    margin-top: -1.5rem;
    padding: 1.25rem 0;
}

.kf-page-head h1 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.kf-searchbar--compact {
    background: transparent;
    box-shadow: none;
    gap: 0.75rem;
    padding: 0;
}

.kf-section {
    margin-bottom: 2.5rem;
}

.kf-section h2 {
    font-size: 1.625rem;
    margin-bottom: 1rem;
}

.kf-section-head {
    align-items: baseline;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.kf-more-link {
    color: var(--kf-primary);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.kf-area-grid {
    display: grid;
    gap: 0.875rem;
    grid-template-columns: repeat(4, 1fr);
}

.kf-area-card {
    align-items: center;
    background: var(--kf-primary-soft);
    border-radius: var(--kf-radius-lg);
    color: var(--kf-text);
    display: flex;
    flex-direction: column;
    font-family: var(--kf-font-heading);
    font-weight: 750;
    gap: 0.5rem;
    line-height: 1.25;
    min-height: 44px;
    padding: 1rem;
    text-align: center;
    text-decoration: none;
    transition: background var(--kf-transition);
}

.kf-area-card:hover {
    background: #d5eadc;
    color: var(--kf-text);
}

.kf-course-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kf-course-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, 1fr);
}

.kf-course-card {
    align-items: center;
    background: var(--kf-surface);
    border: 1px solid var(--kf-border-light);
    border-radius: var(--kf-radius-xl);
    box-shadow: var(--kf-shadow-sm);
    display: grid;
    gap: 0.25rem 1rem;
    grid-template-columns: 48px minmax(0, 1fr) minmax(9.5rem, auto) auto;
    padding: 0.875rem 1rem;
    position: relative;
    transition: box-shadow var(--kf-transition), border-color var(--kf-transition);
}

.kf-course-card:hover {
    border-color: var(--kf-mint);
    box-shadow: var(--kf-shadow-md);
}

.kf-course-icon {
    color: var(--kf-primary);
    display: flex;
    justify-content: center;
}

.kf-course-topic {
    color: var(--kf-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.kf-course-title {
    font-size: 1.125rem;
    line-height: 1.3;
    margin: 0 0 0.125rem;
}

.kf-course-title a {
    color: var(--kf-text);
    text-decoration: none;
}

.kf-course-title a:hover {
    color: var(--kf-primary);
}

.kf-course-meta {
    align-items: baseline;
    color: var(--kf-text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.375rem;
}

.kf-course-provider {
    color: var(--kf-text);
    font-weight: 600;
    position: relative;
    text-decoration: none;
    z-index: 2;
}

.kf-course-provider:hover {
    color: var(--kf-primary);
    text-decoration: underline;
}

.kf-missing {
    color: var(--kf-text-secondary);
    font-size: 0.9375rem;
    font-style: italic;
    font-weight: 400;
}

.kf-course-side {
    align-items: flex-start;
    border-left: 1px solid var(--kf-border-light);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding-left: 1rem;
}

.kf-course-price {
    font-family: var(--kf-font-heading);
    font-size: 1.25rem;
    font-weight: 750;
}

.kf-course-price.kf-missing,
.kf-course-price--note {
    font-family: var(--kf-font-body);
    font-size: 0.9375rem;
    font-weight: 400;
}

.kf-course-actions {
    align-items: center;
    display: flex;
    gap: 0.125rem;
}

.kf-course-action {
    position: relative;
    z-index: 2;
}

.kf-course-chevron {
    color: var(--kf-primary);
    margin-left: 0.25rem;
}

.kf-status {
    align-items: center;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}

.kf-status-available { background: var(--kf-primary-soft); color: var(--kf-primary-hover); }
.kf-status-almost_full,
.kf-status-waitlist { background: var(--kf-warning-soft); color: #5f3f00; }
.kf-status-full,
.kf-status-cancelled { background: var(--kf-danger-soft); color: var(--kf-danger); }
.kf-status-past,
.kf-status-completed,
.kf-status-unavailable { background: #e9eeeb; color: var(--kf-text-secondary); }

.kf-course-card--stacked {
    align-items: start;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    height: 100%;
}

.kf-course-card--stacked .kf-course-side {
    align-items: center;
    border-left: 0;
    border-top: 1px solid var(--kf-border-light);
    flex-direction: row;
    grid-column: 1 / -1;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0.625rem 0 0;
}

.kf-course-card--stacked .kf-course-actions {
    grid-column: 3;
    grid-row: 1;
}

.kf-results-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.kf-view-tabs {
    display: flex;
    gap: 0.375rem;
}

.kf-view-tab {
    align-items: center;
    background: var(--kf-surface);
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius);
    color: var(--kf-text);
    display: inline-flex;
    font-weight: 600;
    gap: 0.375rem;
    min-height: 40px;
    padding: 0 0.75rem;
    text-decoration: none;
}

.kf-view-tab.active {
    background: var(--kf-primary);
    border-color: var(--kf-primary);
    color: #fff;
}

.kf-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kf-provider-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kf-chip {
    align-items: center;
    background: var(--kf-surface);
    border: 1px solid var(--kf-border);
    border-radius: 999px;
    color: var(--kf-text);
    display: inline-flex;
    font-size: 0.9375rem;
    font-weight: 600;
    min-height: 36px;
    padding: 0.25rem 0.75rem;
    text-decoration: none;
}

.kf-chip-row .kf-chip {
    white-space: nowrap;
}

.kf-chip:hover {
    border-color: var(--kf-primary);
    color: var(--kf-primary);
}

.kf-chip-more {
    display: contents;
}

.kf-chip-more summary {
    cursor: pointer;
    list-style: none;
}

.kf-chip-more .kf-chip-row {
    flex-basis: 100%;
}

.filter-sidebar .ts-wrapper.form-select {
    background: none;
    border: 0;
    box-shadow: none;
    min-height: 0;
    padding: 0;
}

.filter-sidebar .form-check {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    padding-left: 0.5rem !important;
}

.filter-sidebar .form-check-input {
    float: none;
    flex-shrink: 0;
    margin: 0;
}

.filter-sidebar .form-label {
    color: var(--kf-text) !important;
    font-size: 0.9375rem !important;
    font-weight: 600;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.kf-footer {
    background: var(--kf-surface);
    border-top: 1px solid var(--kf-border-light);
    padding: 2rem 0;
}

.kf-footer-link {
    color: var(--kf-text-secondary);
    text-decoration: none;
}

.kf-footer-link:hover {
    color: var(--kf-primary);
    text-decoration: underline;
}

@media (max-width: 1199.98px) {
    .kf-my-toggle {
        display: inline-flex;
        margin: 0.25rem 0;
    }

    .navbar-nav .nav-link {
        align-items: center;
        display: flex;
        min-height: 44px;
    }
}

@media (max-width: 991.98px) {
    .kf-area-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kf-course-grid {
        grid-template-columns: 1fr;
    }

    .kf-results-toolbar {
        justify-content: space-between;
    }
}

@media (max-width: 767.98px) {
    .kf-hero {
        padding: 1.5rem 0;
    }

    .kf-searchbar {
        grid-template-columns: 1fr;
    }

    .kf-section h2 {
        font-size: 1.375rem;
    }

    .kf-area-card {
        flex-direction: row;
        padding: 0.625rem;
        text-align: left;
    }

    .kf-area-card img {
        height: 40px;
        width: 50px;
    }

    .kf-course-card {
        align-items: start;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 0.875rem;
    }

    .kf-course-icon {
        display: none;
    }

    .kf-course-side {
        align-items: center;
        border-left: 0;
        flex-direction: row;
        flex-wrap: wrap;
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: space-between;
        padding-left: 0;
    }

    .kf-course-actions {
        grid-column: 2;
        grid-row: 1;
    }

    .kf-chip-row {
        flex-wrap: nowrap;
        margin: 0 -0.75rem;
        overflow-x: auto;
        padding: 0 0.75rem 0.25rem;
        scrollbar-width: none;
    }

    .kf-chip,
    .kf-view-tab {
        min-height: 44px;
    }

    .kf-view-tab {
        padding: 0 0.625rem;
    }

    .kf-view-tabs {
        flex: 1;
        justify-content: space-between;
    }
}

@media (max-width: 575.98px) {
    .kf-area-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .kf-view-tab {
        font-size: 0.875rem;
    }

    .kf-view-tab i {
        display: none;
    }

    .btn-star {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Cookie notice and the placeholder that keeps third-party map tiles from loading */
.kf-consent-bar {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    max-width: 22rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    background: #fff;
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.kf-consent-bar[hidden] {
    display: none;
}

.kf-consent-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.kf-consent-link {
    padding: 0;
    text-align: left;
    background: none;
    border: 0;
}

.kf-map-gate {
    position: absolute;
    inset: 0;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    pointer-events: none;
}

.kf-map-gate-card {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    align-items: center;
    max-width: 18rem;
    padding: 0.625rem 0.875rem;
    text-align: center;
    pointer-events: auto;
    background: #fff;
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius);
}

#courseMap {
    position: relative;
}

@media (max-width: 575.98px) {
    .kf-consent-bar {
        right: 0.5rem;
        bottom: 0.5rem;
        left: 0.5rem;
        max-width: none;
    }

    .kf-consent-actions .btn {
        flex: 1;
        min-height: 44px;
    }
}

/* Finished courses stay readable but are plainly not on offer any more */
.kf-course-card--past {
    background: var(--kf-bg);
    box-shadow: none;
}

.kf-course-card--past .kf-course-title a,
.kf-course-card--past .kf-course-price {
    color: var(--kf-text-secondary);
}

.kf-past-notice {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: #5f3f00;
    background: var(--kf-warning-soft);
    border-radius: var(--kf-radius);
}
