/*
 * Recipe list and search results (EXT:rezepte, Templates/Recipe/List.html and Search.html,
 * Partials/Card.html, Partials/Pagination.html, Partials/SearchForm.html).
 * Loaded through the AssetCollector by those templates only. Every rule is scoped to the plugin wrapper,
 * so it outweighs the global card rules of EXT:kochbuch/Resources/Public/Css/rezept-cards.css without
 * depending on them. Colours follow recipe-detail.css: orange accent for surfaces and lines, the darker
 * red for text (contrast above 4.5:1).
 */
.rezepte-list,
.rezepte-search {
    --rezept-accent: var(--bs-primary, #ef7b4f);
    --rezept-accent-text: var(--bs-secondary, #bf3f27);
    --rezept-accent-soft: #fdeee7;
    --rezept-sand-soft: #f7f2ed;
    --rezept-muted: #6c6c6c;
    --rezept-border: #e6ded6;
    --rezept-radius: 0.5rem;
    --rezept-card-min: 260px;
    margin-bottom: 2rem;
}

.rezepte-list a:focus-visible,
.rezepte-search a:focus-visible,
.rezepte-list button:focus-visible,
.rezepte-search button:focus-visible {
    outline: 2px solid var(--rezept-accent-text);
    outline-offset: 2px;
}

/* Search form above the list */
.rezepte-list .rezepte-search-form,
.rezepte-search .rezepte-search-form {
    margin-bottom: 1.5rem;
}

.rezepte-list .rezepte-search-form label,
.rezepte-search .rezepte-search-form label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.rezepte-list .rezepte-search-form .input-group,
.rezepte-search .rezepte-search-form .input-group {
    display: flex;
    max-width: 32rem;
}

.rezepte-list .rezepte-search-form .form-control,
.rezepte-search .rezepte-search-form .form-control {
    flex: 1 1 auto;
    border: 1px solid var(--rezept-border);
    border-radius: var(--rezept-radius) 0 0 var(--rezept-radius);
}

.rezepte-list .rezepte-search-form .form-control:focus,
.rezepte-search .rezepte-search-form .form-control:focus {
    border-color: var(--rezept-accent);
    box-shadow: 0 0 0 0.2rem var(--rezept-accent-soft);
}

.rezepte-list .rezepte-search-form .btn,
.rezepte-search .rezepte-search-form .btn {
    background-color: var(--rezept-accent);
    border: 1px solid var(--rezept-accent);
    border-radius: 0 var(--rezept-radius) var(--rezept-radius) 0;
    color: #000;
    font-weight: 600;
}

/* Active category/tag filter and search summary */
.rezepte-list .rezepte-filter,
.rezepte-search .rezepte-search-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    background: var(--rezept-sand-soft);
    border-left: 4px solid var(--rezept-accent);
    border-radius: var(--rezept-radius);
}

.rezepte-list .rezepte-filter-reset {
    margin-left: auto;
    color: var(--rezept-accent-text);
    font-size: 0.875rem;
}

/* Grid of cards: as many columns as fit, without the fixed thirds of the old news layout */
.rezepte-list .rezepte,
.rezepte-search .rezepte {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(var(--rezept-card-min), 100%), 1fr));
    gap: 1.5rem;
    width: 100%;
}

.rezepte-list .rezept-cards,
.rezepte-search .rezept-cards {
    display: block;
    width: auto;
    padding: 0;
}

/* One card */
.rezepte-list .rezept-cards .rezept,
.rezepte-search .rezept-cards .rezept {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--rezept-border);
    border-radius: var(--rezept-radius);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.rezepte-list .rezept-cards .rezept:hover,
.rezepte-list .rezept-cards .rezept:focus-within,
.rezepte-search .rezept-cards .rezept:hover,
.rezepte-search .rezept-cards .rezept:focus-within {
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    .rezepte-list .rezept-cards .rezept,
    .rezepte-search .rezept-cards .rezept {
        transition: none;
    }

    .rezepte-list .rezept-cards .rezept:hover,
    .rezepte-list .rezept-cards .rezept:focus-within,
    .rezepte-search .rezept-cards .rezept:hover,
    .rezepte-search .rezept-cards .rezept:focus-within {
        transform: none;
    }
}

/* Photo: full card width, same height on every card */
.rezepte-list .rezept-cards .card-img-top,
.rezepte-search .rezept-cards .card-img-top {
    width: 100%;
    margin: 0;
}

.rezepte-list .rezept-cards .card-img-top a,
.rezepte-search .rezept-cards .card-img-top a {
    display: block;
    border: 0;
}

.rezepte-list .rezept-cards .rezept img.rezept-center,
.rezepte-search .rezept-cards .rezept img.rezept-center {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 300px;
    margin: 0 auto;
    object-fit: cover;
    border-radius: 0;
}

/* Title and teaser */
.rezepte-list .rezept-cards .card-body,
.rezepte-search .rezept-cards .card-body {
    flex: 1 1 auto;
    padding: 1rem 1rem 0.5rem;
}

.rezepte-list .rezept-cards .rezept-name,
.rezepte-search .rezept-cards .rezept-name {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    margin: 0 0 0.5rem;
    padding: 0;
}

/* Doubled class: the theme colours links with a selector of its own that a single class does not outweigh. */
.rezepte-list .rezept-cards .rezept-name.rezept-name a,
.rezepte-search .rezept-cards .rezept-name.rezept-name a {
    color: inherit;
    text-decoration: none;
}

.rezepte-list .rezept-cards .rezept-name a:hover,
.rezepte-search .rezept-cards .rezept-name a:hover {
    color: var(--rezept-accent-text);
}

.rezepte-list .rezept-cards .teaser-text,
.rezepte-search .rezept-cards .teaser-text {
    color: var(--rezept-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Footer: categories and tags as chips, button at the bottom */
.rezepte-list .rezept-cards .card-footer,
.rezepte-search .rezept-cards .card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.375rem;
    margin: 0;
    padding: 0.5rem 1rem 1rem;
    background: none;
    border-top: 0;
}

.rezepte-list .rezept-cards .category-titletag,
.rezepte-list .rezept-cards .tag-titletag,
.rezepte-search .rezept-cards .category-titletag,
.rezepte-search .rezept-cards .tag-titletag {
    flex-basis: 100%;
    margin-top: 0.25rem;
    color: var(--rezept-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rezepte-list .rezept-cards .news-list-category,
.rezepte-list .rezept-cards .news-list-tags,
.rezepte-search .rezept-cards .news-list-category,
.rezepte-search .rezept-cards .news-list-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.375rem;
}

.rezepte-list .rezept-cards .tag-devider,
.rezepte-search .rezept-cards .tag-devider {
    display: none;
}

.rezepte-list .rezept-cards .news-list-category a,
.rezepte-list .rezept-cards .news-list-tags a,
.rezepte-search .rezept-cards .news-list-category a,
.rezepte-search .rezept-cards .news-list-tags a {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    line-height: 1.5;
    text-decoration: none;
}

.rezepte-list .rezept-cards .news-list-category.news-list-category a,
.rezepte-search .rezept-cards .news-list-category.news-list-category a {
    background: var(--rezept-accent-soft);
    color: var(--rezept-accent-text);
}

.rezepte-list .rezept-cards .news-list-tags.news-list-tags a,
.rezepte-search .rezept-cards .news-list-tags.news-list-tags a {
    background: var(--rezept-sand-soft);
    color: #333;
}

.rezepte-list .rezept-cards .news-list-category a:hover,
.rezepte-list .rezept-cards .news-list-tags a:hover,
.rezepte-search .rezept-cards .news-list-category a:hover,
.rezepte-search .rezept-cards .news-list-tags a:hover {
    text-decoration: underline;
}

.rezepte-list .rezept-cards .btn.btn-success,
.rezepte-search .rezept-cards .btn.btn-success {
    display: block;
    width: 100%;
    margin: 0.75rem 0 0;
    padding: 0.5rem 1rem;
    background-color: var(--rezept-accent);
    border-color: var(--rezept-accent);
    border-radius: var(--rezept-radius);
    color: #000;
    font-weight: 600;
    text-align: center;
}

.rezepte-list .rezept-cards .btn.btn-success:hover,
.rezepte-search .rezept-cards .btn.btn-success:hover {
    background-color: var(--rezept-accent-text);
    border-color: var(--rezept-accent-text);
    color: #fff;
}

/* Pagination */
.rezepte-list .page-navigation,
.rezepte-search .page-navigation {
    width: 100%;
    margin-top: 2rem;
}

.rezepte-list .f3-widget-paginator,
.rezepte-search .f3-widget-paginator {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rezepte-list .f3-widget-paginator li,
.rezepte-search .f3-widget-paginator li {
    display: block;
    margin: 0;
    min-width: 2.25rem;
    line-height: 2.25rem;
    text-align: center;
}

.rezepte-list .f3-widget-paginator a,
.rezepte-search .f3-widget-paginator a {
    display: block;
    padding: 0 0.75rem;
    border: 1px solid var(--rezept-border);
    border-radius: var(--rezept-radius);
    color: var(--rezept-accent-text);
    text-decoration: none;
}

.rezepte-list .f3-widget-paginator a:hover,
.rezepte-search .f3-widget-paginator a:hover {
    background: var(--rezept-accent-soft);
    border-color: var(--rezept-accent);
}

.rezepte-list .f3-widget-paginator .current,
.rezepte-search .f3-widget-paginator .current {
    padding: 0 0.75rem;
    background: var(--rezept-accent);
    border-radius: var(--rezept-radius);
    color: #000;
    font-weight: 600;
}

/* Empty list */
.rezepte-list .no-news-found,
.rezepte-search .no-news-found {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--rezept-muted);
    background: var(--rezept-sand-soft);
    border-radius: var(--rezept-radius);
}

@media print {
    .rezepte-list .rezepte-search-form,
    .rezepte-list .page-navigation,
    .rezepte-list .rezept-cards .btn,
    .rezepte-search .rezepte-search-form,
    .rezepte-search .page-navigation,
    .rezepte-search .rezept-cards .btn {
        display: none;
    }

    .rezepte-list .rezept-cards .rezept,
    .rezepte-search .rezept-cards .rezept {
        break-inside: avoid;
        box-shadow: none;
        transform: none;
    }
}
