/*
 * Programm-Filter — Basis-Layout.
 * Bewusst minimal gehalten — Theme-spezifisches Styling kann in
 * thueringentag_theme/Resources/Public/Css/layout.css ergänzt werden.
 *
 * Accessibility-Ziele (WCAG 2.1 AA):
 * - Text-Kontrast >= 4.5:1 auf Weiß
 * - UI-Komponenten/Borders >= 3:1
 * - Sichtbarer :focus-visible-Indikator auf allen interaktiven Elementen
 * - Touch-Targets mindestens 32x32px (idealerweise 44px)
 * - Respektiert prefers-reduced-motion und forced-colors
 */

/* Visually-hidden: für Screen-Reader-only Texte (sr-only-Pattern) */
.programm .visually-hidden {
    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;
}

/* Universeller Fokus-Indikator — gilt für alle interaktiven Elemente
   im Plugin. focus-visible greift nur bei Keyboard-Fokus, nicht bei
   Maus-Klick. */
.programm a:focus-visible,
.programm button:focus-visible,
.programm input:focus-visible,
.programm select:focus-visible {
    outline: 3px solid #1d3557;
    outline-offset: 2px;
    border-radius: 3px;
}

/* Reduced-Motion respektieren */
@media (prefers-reduced-motion: reduce) {
    .programm *,
    .programm *::before,
    .programm *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/* Forced-Colors-Mode (High-Contrast) — Border statt Background-Tönung,
   damit System-Farben nicht überschrieben werden */
@media (forced-colors: active) {
    .programm-chip,
    .programm-filter-submit,
    .programm-pagination__current {
        border: 1px solid CanvasText;
        forced-color-adjust: none;
    }
}

.programm-filter {
    margin: 1.5rem 0 4rem;
}

.programm-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.programm-filter-group {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    background: #FFFFFF;
}

.programm-filter-group__title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.programm-filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    margin: 0 -0.5rem;
    min-height: 32px;
    font-size: 0.95rem;
    border-radius: 3px;
    cursor: pointer;
}

.programm-filter-option:hover {
    background: rgba(29, 53, 87, 0.06);
}

.programm-filter-option input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    /* Mindestgröße der nativen Checkbox für Maus/Touch */
    width: 18px;
    height: 18px;
}

.programm-filter-option__label {
    flex: 1;
}

/* Counter — #555 statt #666 für besseren Kontrast (7.45:1 auf Weiß) */
.programm-filter-option__count {
    color: #575757;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
}

/* Zero-Items: #767676 erfüllt WCAG AA (4.54:1 auf Weiß).
   #aaa hatte nur 2.32:1 und war damit nicht barrierefrei. */
.programm-filter-option--zero .programm-filter-option__label,
.programm-filter-option--zero .programm-filter-option__count {
    color: #575757;
}

/* Markiert eine ausgewählte Filter-Option (Checkbox checked) */
.programm-filter-option:has(input[type="checkbox"]:checked) {
    background: rgba(29, 53, 87, 0.08);
    border-radius: 3px;
    padding: 0.25rem 0.5rem;
    margin: 0 -0.5rem;
}

.programm-filter-option:has(input[type="checkbox"]:checked) .programm-filter-option__label {
    color: #1d3557;
    font-weight: 600;
}

/* Akzentfarbe der Browser-Checkbox auf Dunkelblau setzen */
.programm-filter input[type="checkbox"] {
    accent-color: #1d3557;
    color: #575757;
}

.programm-filter-actions {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Submit-Button — Style angelehnt an die globalen .side-btn
   (Theme-Datei layout.css). #fff auf #A6213A = 4.50:1, knapp WCAG AA
   für Normaltext. Bei Bedarf ggf. Größe anheben. */
.programm-filter-submit,
.programm-filter-submit.btn,
.programm-filter-submit.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #A6213A;
    color: #fff;
    border: none;
    font-family: Arial, sans-serif;
    font-size: clamp(0.7rem, 0.9vw, 0.9rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 24px;
    min-height: 44px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: background 0.25s ease, color 0.25s ease;
}

.programm-filter-submit:hover,
.programm-filter-submit:focus,
.programm-filter-submit.btn:hover,
.programm-filter-submit.btn:focus,
.programm-filter-submit.btn-primary:hover,
.programm-filter-submit.btn-primary:focus {
    background: #092031;
    color: #fff;
}

.programm-filter-reset {
    color: #555;
    text-decoration: underline;
    font-size: 0.95rem;
}

.programm-filter-reset:hover,
.programm-filter-reset:focus {
    color: #A6213A;
}

/* Empty-State (vor dem ersten Submit). #555 auf #f6f6f6 = 7.05:1 */
.programm-empty-state {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #f6f6f6;
    border-left: 4px solid #A6213A;
    color: #333;
    font-size: 1rem;
}

/* Aktive-Filter-Chips */
.programm-active-filters {
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.programm-active-filters__title {
    font-weight: 600;
    margin-right: 0.25rem;
}

/* Chip — #fff auf #1d3557 = 12.45:1 (deutlich über WCAG AAA). */
.programm-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    min-height: 32px;
    background: #1d3557;
    color: #fff;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.3;
    transition: background 0.15s ease;
}

.programm-chip:hover,
.programm-chip:focus {
    background: #122540;
    color: #fff!important;
    text-decoration: none;
}

.programm-chip__remove {
    font-weight: 700;
    line-height: 1;
}

/* Liste */
.programm-result-count {
    margin: 0 0 1rem;
    font-weight: 600;
}

.programm-day-header {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.25rem;
    border-bottom: 2px solid #A6213A;
    padding-bottom: 0.25rem;
}

/* Tile-Grid: 4 Kacheln nebeneinander, responsiv abgestuft */
.programm-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.programm-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    height: 100%;
}

.programm-item:hover,
.programm-item:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 53, 87, 0.15);
    border-color: #1d3557;
}

/* Bild: feste Aspect-Ratio, deckend */
.programm-item__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #eee;
    overflow: hidden;
}

.programm-item__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0!important;
}

.programm-item__media-link {
    display: block;
    width: 100%;
    height: 100%;
}

.programm-item__media-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: #eee;
}

/* Content unterhalb des Bildes */
.programm-item__content {
    padding: 0.85rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.programm-item__datetime {
    margin: 0;
    font-size: 0.875rem;
    color: #555;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.programm-item__title {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
    /* Lange Titel sauber umbrechen */
    overflow-wrap: break-word;
    hyphens: auto;
}

.programm-item__title a {
    color: #1d3557;
    text-decoration: none;
    /* Erweitert die klickbare Fläche optisch über den Text hinaus
       — Mindestberührungsfläche für Touch */
    display: inline-block;
    min-height: 24px;
}

.programm-item__title a:hover,
.programm-item__title a:focus-visible {
    text-decoration: underline;
}

/* Teaser — auf 3 Zeilen begrenzt, damit Kacheln gleich hoch wirken.
   #444 auf Weiß = 9.74:1 (WCAG AAA). */
.programm-item__teaser {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #444;
    /* Multi-Line-Truncation: 3 Zeilen, Rest mit Ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Reduced-Motion: keine Hover-Bewegung */
@media (prefers-reduced-motion: reduce) {
    .programm-item {
        transition: border-color 0.15s ease;
    }
    .programm-item:hover,
    .programm-item:focus-within {
        transform: none;
        box-shadow: none;
    }
}

.programm-no-results {
    padding: 1rem;
    background: #f6f6f6;
    border-left: 4px solid #999;
    margin: 1rem 0;
}

/* Pagination */
.programm-pagination {
    margin: 2rem 0;
}

.programm-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.programm-pagination a,
.programm-pagination .programm-pagination__current {
    display: inline-block;
    padding: 0.5rem 0.85rem;
    min-width: 44px;
    min-height: 44px;
    text-align: center;
    border: 1px solid #767676;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
}

.programm-pagination__current {
    background: #A6213A;
    color: #fff;
    border-color: #A6213A;
}

.programm-pagination a:hover {
    background: #f0f0f0;
}

/* Responsive: 4 → 3 → 2 → 1 Kachel pro Reihe */
@media (max-width: 1199px) {
    .programm-items {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 899px) {
    .programm-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 519px) {
    .programm-items {
        grid-template-columns: 1fr;
    }
}
