/* ==========================================================================
   K3 Course List Page – image card filter layout
   ========================================================================== */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.k3-uclp-wrapper {
    display: block;
    font-family: inherit;
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 1200px);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.is-layout-constrained > .k3-uclp-wrapper,
.entry-content.is-layout-constrained > .k3-uclp-wrapper {
    max-width: var(--wp--style--global--wide-size, 1200px);
}

body.has-k3-unscheduled-course-list-page {
    --k3uclp-title-teal: #00adca;
}

body.has-k3-unscheduled-course-list-page .is-layout-constrained > .wp-block-post-title,
body.has-k3-unscheduled-course-list-page .wp-block-post-title {
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 1200px);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

body.has-k3-unscheduled-course-list-page .k3-page-header-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 24px;
    align-items: end;
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 1200px);
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 3px solid var(--k3uclp-title-teal, #00adca);
    box-sizing: border-box;
}

body.has-k3-unscheduled-course-list-page .k3-page-header-title {
    grid-column: 1 / 2;
    min-width: 0;
    width: 100%;
}

body.has-k3-unscheduled-course-list-page .k3-page-header-title .wp-block-post-title,
body.has-k3-unscheduled-course-list-page .k3-page-header-title h1 {
    width: auto;
    max-width: 100%;
    margin: 0 !important;
    padding: 0;
    border: 0;
    color: var(--k3uclp-title-teal, #00adca);
    font-size: clamp(1.85rem, 2.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: 0;
    white-space: nowrap;
}

body.has-k3-unscheduled-course-list-page .k3-page-header-title .wp-block-post-title a {
    color: inherit;
    text-decoration: none;
}

body.has-k3-unscheduled-course-list-page .k3-page-header-title .wp-block-post-title a:hover,
body.has-k3-unscheduled-course-list-page .k3-page-header-title .wp-block-post-title a:focus-visible {
    color: #0097b2;
}

/* Standalone post title when login header layout is not used. */
body.has-k3-unscheduled-course-list-page .is-layout-constrained > .wp-block-post-title:not(.k3-page-header-title .wp-block-post-title),
body.has-k3-unscheduled-course-list-page .entry-content > .wp-block-post-title:first-child {
    margin-bottom: 24px !important;
    padding-bottom: 14px;
    border-bottom: 3px solid var(--k3uclp-title-teal, #00adca);
    color: var(--k3uclp-title-teal, #00adca);
    font-size: clamp(1.85rem, 2.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.12;
}

body.has-k3-unscheduled-course-list-page .is-layout-constrained > .wp-block-post-title:not(.k3-page-header-title .wp-block-post-title) a,
body.has-k3-unscheduled-course-list-page .entry-content > .wp-block-post-title:first-child a {
    color: inherit;
    text-decoration: none;
}

body.has-k3-unscheduled-course-list-page .k3-page-header-login {
    grid-column: 2 / 3;
    justify-self: stretch;
    align-self: end;
    width: 100%;
    max-width: none;
    margin-left: 0;
}

@media (max-width: 767px) {
    body.has-k3-unscheduled-course-list-page .k3-page-header-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    body.has-k3-unscheduled-course-list-page .k3-page-header-title .wp-block-post-title {
        white-space: normal;
    }

    body.has-k3-unscheduled-course-list-page .k3-page-header-login {
        align-self: flex-end;
        width: auto;
    }
}

/* ── Body (sidebar + main column) ─────────────────────────────────────────── */
.k3-uclp-body {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.k3-uclp-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Top filter bar (Kursgruppe) ─────────────────────────────────────────── */
.k3-uclp-top-filter {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.k3-uclp-cards--top {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: stretch;
    width: 100%;
}

/* ── Card group ───────────────────────────────────────────────────────────── */
.k3-uclp-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.k3-uclp-cards--vertical {
    flex-direction: column;
}

/* ── Shared filter card base ──────────────────────────────────────────────── */
.k3-uclp-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    cursor: pointer;
    text-align: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: none;
}

.k3-uclp-card:hover,
.k3-uclp-card:focus-visible {
    outline: none;
    transform: translateY(-2px);
}

/* ── Top Kursgruppe image cards ───────────────────────────────────────────── */
.k3-uclp-card--top {
    flex: 1 1 0;
    min-width: 0;
    min-height: 185px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 20px 10px 14px;
    background: var(--k3uclp-card-color, #42A5F5);
    color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.k3-uclp-card--top:hover,
.k3-uclp-card--top:focus-visible {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.k3-uclp-card--top.is-active {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 6px 18px rgba(0, 0, 0, 0.22);
    transform: translateY(-3px);
}

.k3-uclp-card__icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #ffffff;
    flex-shrink: 0;
}

.k3-uclp-card__icon {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.k3-uclp-card--top .k3-uclp-card__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    width: 100%;
}

/* ── Active filter tags ───────────────────────────────────────────────────── */
.k3-uclp-active-tags {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 0;
}

.k3-uclp-active-tags.is-visible {
    display: flex;
    justify-content: center;
}

.k3-uclp-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border: 1px solid #9edbe8;
    border-radius: 6px;
    background: #ffffff;
    color: #1f6f86;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.k3-uclp-active-tag:hover,
.k3-uclp-active-tag:focus-visible {
    background: #f0fbfd;
    border-color: #00bcd4;
    outline: none;
}

.k3-uclp-active-tag__remove {
    font-size: 16px;
    line-height: 1;
    opacity: 0.75;
}

/* ── Left sidebar ─────────────────────────────────────────────────────────── */
.k3-uclp-sidebar {
    flex: 0 0 200px;
    width: 200px;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-self: flex-start;
    min-width: 0;
    box-sizing: border-box;
}

.k3-uclp-nav-link {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: none;
    border-radius: 6px;
    background: #00bcd4;
    color: #ffffff !important;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.18s ease;
}

.k3-uclp-nav-link:hover,
.k3-uclp-nav-link:focus-visible {
    background: #00a3b9;
    color: #ffffff !important;
    outline: none;
}

.k3-uclp-reset {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: none;
    border-radius: 6px;
    background: #e53935;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.18s ease;
}

.k3-uclp-reset:hover,
.k3-uclp-reset:focus-visible {
    background: #c62828;
    outline: none;
}

.k3-uclp-date-filter {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: none;
    border-radius: 6px;
    background: #00bcd4;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.18s ease;
}

.k3-uclp-date-filter:hover,
.k3-uclp-date-filter:focus-visible {
    background: #00a3b9;
    outline: none;
}

.k3-uclp-date-filter.is-active {
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.35);
}

/* ── Date filter modal ────────────────────────────────────────────────────── */
.k3-uclp-date-modal[hidden],
.k3-uclp-detail-modal[hidden] {
    display: none !important;
}

.k3-uclp-date-modal,
.k3-uclp-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.k3-uclp-date-modal__backdrop,
.k3-uclp-detail-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.k3-uclp-date-modal__panel,
.k3-uclp-detail-modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
    padding: 22px 20px 18px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.k3-uclp-date-modal__title,
.k3-uclp-detail-modal__title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    color: #222;
}

.k3-uclp-date-modal__label,
.k3-uclp-detail-modal__label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.k3-uclp-date-modal__input,
.k3-uclp-detail-modal__select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cfd6de;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

.k3-uclp-date-modal__input:focus,
.k3-uclp-detail-modal__select:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.2);
}

.k3-uclp-date-modal__actions,
.k3-uclp-detail-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.k3-uclp-date-modal__btn,
.k3-uclp-detail-modal__btn {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.k3-uclp-date-modal__btn--cancel,
.k3-uclp-detail-modal__btn--cancel {
    background: #eef1f4;
    color: #444;
}

.k3-uclp-date-modal__btn--cancel:hover,
.k3-uclp-date-modal__btn--cancel:focus-visible,
.k3-uclp-detail-modal__btn--cancel:hover,
.k3-uclp-detail-modal__btn--cancel:focus-visible {
    background: #e2e6ea;
    outline: none;
}

.k3-uclp-date-modal__btn--apply,
.k3-uclp-detail-modal__btn--apply {
    background: #00bcd4;
    color: #ffffff;
}

.k3-uclp-date-modal__btn--apply:hover,
.k3-uclp-date-modal__btn--apply:focus-visible,
.k3-uclp-detail-modal__btn--apply:hover,
.k3-uclp-detail-modal__btn--apply:focus-visible {
    background: #00a3b9;
    outline: none;
}

body.k3-uclp-date-modal-open,
body.k3-uclp-detail-modal-open {
    overflow: hidden;
}

.k3-uclp-filter-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.k3-uclp-filter-heading {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 6px;
    background: #00bcd4;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
    text-align: center;
    cursor: pointer;
    transition: background 0.18s ease;
}

.k3-uclp-filter-heading:hover,
.k3-uclp-filter-heading:focus-visible {
    background: #00a3b9;
    outline: none;
}

.k3-uclp-filter-heading.is-active {
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.35);
}

/* ── Sidebar image cards ──────────────────────────────────────────────────── */
.k3-uclp-card--sidebar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
    border: 1px solid #d5dbe3;
    border-radius: 10px;
    background: #ffffff;
    color: #333333;
    box-shadow: none;
}

.k3-uclp-card--sidebar:hover,
.k3-uclp-card--sidebar:focus-visible {
    border-color: #00bcd4;
    box-shadow: 0 3px 10px rgba(0, 188, 212, 0.18);
}

.k3-uclp-card--sidebar.is-active {
    border-color: #00bcd4;
    background: #f0fbfd;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.25);
    transform: none;
}

.k3-uclp-card--sidebar .k3-uclp-card__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.k3-uclp-card__photo {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
}

/* ── Course list content area ─────────────────────────────────────────────── */
.k3-uclp-content {
    position: relative;
    isolation: isolate;
    min-width: 0;
    min-height: 280px;
    border-top: 1px solid #b8e4ee;
    padding-top: 18px;
}

.k3-uclp-content__body {
    position: relative;
    z-index: 1;
    min-height: inherit;
}

.k3-uclp-content.is-loading .k3-uclp-content__body {
    pointer-events: none;
    user-select: none;
}

.k3-uclp-content .kurs-template-filter-toolbar {
    display: none !important;
}

body:has(.k3-uclp-wrapper) #k3-course-timeline-drawer,
body.has-k3-unscheduled-course-list-page #k3-course-timeline-drawer {
    display: none !important;
}

.k3-uclp-content .k3-timeline-trigger,
.k3-uclp-content .k3-timeline-separator {
    display: none !important;
}

/* ── Loading overlay (always on top of course list) ──────────────────────── */
.k3-uclp-loading-overlay[hidden] {
    display: none !important;
}

.k3-uclp-loading-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100%;
    padding: 24px 16px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: k3clpOverlayIn 0.25s ease;
}

.k3-uclp-loading-overlay.is-viewport-fixed {
    position: fixed;
    right: auto;
    bottom: auto;
    z-index: 99990;
    min-height: 0;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 24px;
}

.k3-uclp-loading-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    width: min(100%, 320px);
    padding: 28px 24px 24px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow:
        0 16px 40px rgba(0, 60, 80, 0.12),
        0 0 0 1px rgba(0, 188, 212, 0.12);
    animation: k3clpPanelIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.k3-uclp-loading-rings {
    position: relative;
    width: 72px;
    height: 72px;
}

.k3-uclp-loading-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.k3-uclp-loading-ring--outer {
    border-top-color: #00bcd4;
    border-right-color: rgba(0, 188, 212, 0.25);
    animation: k3clpSpin 1.1s linear infinite;
}

.k3-uclp-loading-ring--inner {
    inset: 10px;
    border-bottom-color: #26c6da;
    border-left-color: rgba(38, 198, 218, 0.2);
    animation: k3clpSpinReverse 0.85s linear infinite;
}

.k3-uclp-loading-ring--core {
    inset: 22px;
    background: radial-gradient(circle at 30% 30%, #e0f7fa, #b2ebf2);
    border: none;
    animation: k3clpPulse 1.4s ease-in-out infinite;
}

.k3-uclp-loading-message {
    margin: 0;
    color: #3a5560;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.k3-uclp-loading-progress {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.k3-uclp-loading-progress__header {
    display: flex;
    justify-content: flex-end;
}

.k3-uclp-loading-progress__percent {
    color: #1f6f86;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.k3-uclp-loading-progress__track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8f4f7;
}

.k3-uclp-loading-progress__bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00bcd4, #26c6da);
    transition: width 0.35s ease;
    position: relative;
    overflow: hidden;
}

.k3-uclp-loading-progress__bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 100%
    );
    animation: k3clpProgressShimmer 1.2s ease-in-out infinite;
}

@keyframes k3clpOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes k3clpPanelIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes k3clpSpin {
    to { transform: rotate(360deg); }
}

@keyframes k3clpSpinReverse {
    to { transform: rotate(-360deg); }
}

@keyframes k3clpPulse {
    0%, 100% {
        transform: scale(0.92);
        opacity: 0.75;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes k3clpProgressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ── Placeholder ─────────────────────────────────────────────────────────── */
.k3-uclp-placeholder {
    padding: 24px 0;
    color: #888;
    font-size: 14px;
    font-style: italic;
}

/* ── Error state ──────────────────────────────────────────────────────────── */
.k3-uclp-error {
    padding: 16px 20px;
    background: #fff3f3;
    border: 1px solid #f5a0a0;
    border-radius: 8px;
    color: #c00;
    font-size: 14px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .k3-uclp-sidebar {
        flex: 0 0 170px;
        width: 170px;
    }

    .k3-uclp-cards--top {
        flex-wrap: wrap;
    }

    .k3-uclp-card--top {
        flex: 1 1 calc(33.333% - 10px);
        min-height: 160px;
    }

    .k3-uclp-card__icon-wrap {
        width: 64px;
        height: 64px;
    }

    .k3-uclp-card__icon {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 767px) {
    .k3-uclp-body {
        flex-direction: column;
    }

    .k3-uclp-sidebar {
        flex: none;
        width: 100%;
    }

    /* Keep inhouse detail cards visible (Kursbereich modal is disabled on this page). */
    .k3-uclp-filter-section .k3-uclp-cards {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    /* Kursgruppe: icon-only row (no description labels). */
    .k3-uclp-cards--top {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 8px;
    }

    .k3-uclp-card--top {
        position: relative;
        flex: 1 1 0;
        min-width: 0;
        min-height: 0;
        aspect-ratio: 1 / 1;
        padding: 8px;
        justify-content: center;
        gap: 0;
        border-radius: 12px;
    }

    .k3-uclp-card__icon-wrap {
        width: 58%;
        height: 58%;
        max-width: 56px;
        max-height: 56px;
    }

    .k3-uclp-card__icon {
        width: 70%;
        height: 70%;
    }

    .k3-uclp-card--top .k3-uclp-card__label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* Endless paging */
.k3-uclp-endless {
    display: flex;
    justify-content: center;
    padding: 20px 12px 28px;
    position: relative;
}

.k3-uclp-endless[hidden] {
    display: none !important;
}

.k3-uclp-endless__sentinel {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
    opacity: 0;
}

.k3-uclp-endless__panel {
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

.k3-uclp-endless__panel p {
    margin: 0;
}

.k3-uclp-endless__spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto 10px;
    border: 2px solid #e5e7eb;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: k3uclp-endless-spin 0.8s linear infinite;
}

@keyframes k3uclp-endless-spin {
    to {
        transform: rotate(360deg);
    }
}
