/* ============================================================
   Filter Section — mobile first
   ============================================================ */

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
    margin-block: 2rem;
}

/* ---------- Top-Row: Search + Filter-Toggle ---------- */
.filter-topbar {
    display: flex;
    align-items: stretch;
    gap: 1.2rem;
    width: 100%;
    position: relative;
}

.search-container {
    flex: 1 1 auto;
    min-width: 0;
}

.filter-popover-wrap {
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    box-sizing: border-box;
    outline: none;
    border: 1px solid #d1d5db;
    background-color: transparent;
    border-radius: 32px;
    padding: 1.4rem 1.8rem;
    font: var(--lds-g-typography-ringside-body-medium);
    color: #444;
    transition: border-color 0.2s ease;
}

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
    padding: 1.4rem 1.8rem;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 32px;
    cursor: pointer;
    font: var(--lds-g-typography-ringside-body-medium);
    color: #444;
    white-space: nowrap;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    user-select: none;
}

.filter-toggle-btn svg {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.filter-toggle-btn[aria-expanded="true"] {
    background: var(--color-lilly-red);
    border-color: var(--color-lilly-red);
    color: #fff;
}

.filter-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.6rem;
    border-radius: 1rem;
    background: var(--color-lilly-red);
    color: #fff;
    font: var(--lds-g-typography-ringside-special-caption);
    font-weight: 600;
}

.filter-toggle-count[hidden] {
    display: none;
}

.filter-toggle-btn[aria-expanded="true"] .filter-toggle-count {
    background: #fff;
    color: var(--color-lilly-red);
}

/* Auf Mobile nur das Label „Filter“ ausblenden, wenn wenig Platz?
   Wir lassen es sichtbar — der Button bleibt eine Pille. */

/* ---------- Filter-Panel (Popover) ---------- */
.filter-panel {
    position: absolute;
    top: calc(100% + 0.8rem);
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
    padding: 1.6rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1.6rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    animation: filter-panel-in 0.18s ease;
}

@keyframes filter-panel-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.filter-panel[hidden] {
    display: none;
}

/* ---------- Tabs (Alle / Fortbildungen / Kongresse) ---------- */
.filter-tabs-container {
    background-color: var(--color-lilly-white);
    border-radius: 3.2rem;
    border: 1px solid #c5c5c5;
    padding: .6rem;
    width: 100%;
    position: relative;
    display: flex;
}

.filter-tabs-slider {
    position: absolute;
    background: var(--color-lilly-red);
    border-radius: 2.4rem;
    transition: transform 0.3s ease, width 0.3s ease;
    top: .6rem;
    bottom: .6rem;
    left: .6rem;
    width: 0;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.filter-tabs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 100%;
}

.filter-tabs li {
    flex: 1;
}

.filter-tab {
    cursor: pointer;
    border-radius: 2.4rem;
    padding: 1.4rem 1.8rem;
    background: none;
    border: none;
    color: #6a6a6a;
    font: var(--lds-g-typography-ringside-body-medium);
    transition: color 0.25s ease;
    white-space: nowrap;
    user-select: none;
    width: 100%;
}

.filter-tab:hover:not(.selected) {
    color: #3a3a3a;
}

.filter-tab.selected {
    color: var(--color-lilly-white);
}

/* ---------- Pills (CME, On Demand, Reset) ---------- */
.pill-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.clear-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font: var(--lds-g-typography-ringside-body-small);
    color: var(--color-lilly-bold-grey);
    white-space: nowrap;
    user-select: none;
}

.clear-filters-btn svg {
    opacity: 0.6;
}

.filter-reset-row {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
}

.filter-reset-row[hidden] {
    display: none;
}

.filter-reset-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    width: 100%;
    margin: 0 0 1.2rem 0;
}

/* ============================================================
   Ergebnisanzahl
   ============================================================ */
.results-count {
    font: var(--lds-g-typography-ringside-body-small);
    color: #6b7280;
    margin: 0 0 0.4rem;
}

/* ============================================================
   Tablet & Desktop ≥ 768px — Panel als Popover unter dem Button
   ============================================================ */
@media (min-width: 768px) {
    .filter-topbar {
        gap: 1.6rem;
    }

    .filter-panel {
        left: auto;
        right: 0;
        width: min(56rem, calc(100vw - 4rem));
        padding: 2rem;
    }

    .filter-tab {
        padding: 1.4rem 1.8rem;
    }
}

/* ---------- Desktop ≥ 1024px ---------- */
@media (min-width: 1024px) {
    .filter-panel {
        width: 60rem;
    }
}


/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 4.8rem;
}

.pagination-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    font: var(--lds-g-typography-ringside-body-small);
    width: 100%;
}

@media (min-width: 768px) {
    .pagination-controls {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 12px;
    }
}

/* Custom Dropdown: items per page */
.per-page-dropdown {
    position: relative;
}

.per-page-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #f5f5f5;
    border: none;
    border-radius: 2rem;
    padding: 0 1.2rem;
    height: 36px;
    cursor: pointer;
    color: #333;
    font: var(--lds-g-typography-ringside-body-small);
    white-space: nowrap;
    transition: background-color 0.15s;
}

.per-page-trigger:hover {
    background-color: #e8e8e8;
}

.per-page-chevron {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.per-page-dropdown.open .per-page-chevron {
    transform: rotate(180deg);
}

.per-page-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border-radius: 1.2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
    list-style: none;
    margin: 0;
    padding: 6px;
    min-width: 100%;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top left;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 100;
}

.per-page-dropdown.open .per-page-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.per-page-option {
    padding: 8px 14px;
    border-radius: 0.8rem;
    cursor: pointer;
    font: var(--lds-g-typography-ringside-body-small);
    color: #333;
    white-space: nowrap;
    transition: background-color 0.12s;
}

.per-page-option:hover {
    background-color: #f5f5f5;
}

.per-page-option.selected {
    background-color: #333;
    color: #fff;
}

.per-page-option.selected:hover {
    background-color: #444;
}

/* Nav: arrow + page buttons + arrow */
.pagination-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #f5f5f5;
    padding: 0.4rem 0.6rem;
    border-radius: 2rem;
    height: 36px;
}

.pagination-controls .pagination-btn {
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    padding: 0 4px;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

.pagination-page-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    min-width: 28px;
    height: 28px;
    border-radius: 1rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font: var(--lds-g-typography-ringside-body-small);
    color: #333;
    padding: 0 4px;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s;
}

.pagination-page-btn:hover:not(.active) {
    background-color: #e0e0e0;
}

.pagination-page-btn.active {
    background-color: #333;
    color: #fff;
    cursor: default;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: #888;
    font: var(--lds-g-typography-ringside-body-small);
    pointer-events: none;
}

.pagination-controls .pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-controls .pagination-btn img,
.pagination-controls .pagination-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}



@media (min-width: 640px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-container {
        grid-column: 1;
        grid-row: 1;
    }

    .search-container {
        grid-column: 2;
        grid-row: 1;
    }

    .therapy-filter-container {
        grid-column: 1 / 3;
        grid-row: 2;
    }

    .pill-container {
        grid-column: 1 / 3;
        grid-row: 3;
    }
}

@media (min-width: 1024px) {
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .filter-container {
        grid-column: 1;
        grid-row: 1;
    }

    .search-container {
        grid-column: 2 / 4;
        grid-row: 1;
    }

    .therapy-filter-container {
        grid-column: 1;
        grid-row: 2;
    }

    .pill-container {
        grid-column: 2 / 4;
        grid-row: 2;
        justify-content: flex-start;
        align-self: center;
    }
}


/* ── Pills ── */

.pill-container {
    width: 100%;
}

.pill {
    display: flex;
    align-items: center;
    padding: 18px;
    border: 1px solid #d1d5db;
    border-radius: 32px;
    cursor: pointer;
    font: var(--lds-g-typography-ringside-body-small);
    font-size: 18px;
    line-height: 1.2;
    color: #444;
    background: transparent;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    user-select: none;
    position: relative;
    -webkit-appearance: none;
    appearance: none;
}

.pill[aria-pressed="true"] {
    background: var(--color-lilly-red);
    border-color: var(--color-lilly-red);
    color: white;
}

.pill .pill-text {
    transition: all 0.2s ease;
}


/* ── Therapy Dropdown ── */

.therapy-filter-container {
    width: 100%;
    overflow-x: clip;
    overflow-y: visible;
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.therapy-dropdown-container {
    position: relative;
    pointer-events: auto;
    width: 100%;
    align-self: center;
    margin-bottom: 0.8rem;
}

.therapy-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 18px;
    border: 1px solid #d1d5db;
    background-color: white;
    border-radius: 32px;
    cursor: pointer;
    font: var(--lds-g-typography-ringside-body-small);
    color: #444;
    white-space: nowrap;
    transition: border-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.therapy-dropdown-btn:hover {

}

.therapy-dropdown-btn[aria-expanded="true"] {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-width: 0;
}

.therapy-dropdown-label {
    font-size: 18px;
    line-height: 1.2;
}

.therapy-dropdown-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.therapy-dropdown-btn[aria-expanded="true"] .therapy-dropdown-chevron {
    transform: rotate(180deg);
}

.therapy-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    border: 1px solid #d1d5db;
    border-top-width: 0;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    z-index: 30;
}

.therapy-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 8px;
}

.therapy-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 100%;
    padding-inline: 16px;
    padding-block: 12px;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.2;
    color: #444;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.therapy-dropdown-item:hover {
    background-color: #f3f4f6;
}

.therapy-dropdown-item input[type="checkbox"] {
    accent-color: var(--color-lilly-red);
    width: 16px;
    height: 16px;   
    cursor: pointer;
    flex-shrink: 0;
}

.therapy-dropdown-item:has(input[type="checkbox"]:checked) {
    background-color: #f3f4f6;
}

.therapy-dropdown-item--disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}



.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    box-sizing: border-box;
    outline: none;
    border: 1px solid #d1d5db;
    background-color: transparent;
    border-radius: 32px;
    padding: 18px 18px 18px 18px;
    font: var(--lds-g-typography-ringside-body-small);
    font-size: 18px;
    line-height: 1.2;
    color: #444;
    transition: border-color 0.2s ease, color 0.2s ease;
}


