.recipes-panel {
    min-width: 0;
}

.recipes-layout {
    display: grid;
    gap: 1.5rem;
    min-width: 0;
}

.recipes-header h1,
.recipes-header__copy {
    margin: 0;
}

.recipes-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.75rem;
    overflow-x: auto;
    border-bottom: 1px solid rgba(15, 26, 46, 0.12);
}

.recipes-tab {
    appearance: none;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(15, 26, 46, 0.66);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 0.7rem 1rem;
    transition: color 160ms ease, background-color 160ms ease;
}

.recipes-tab[aria-selected="true"] {
    background-color: rgba(255, 255, 255, 0.78);
    color: var(--color-secondary);
}

.recipes-header__copy {
    margin-top: 0.45rem;
    color: var(--color-text-accent);
}

.recipes-controls {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.recipes-create-button {
    flex: 0 0 auto;
    text-decoration: none;
}

.recipes-filter-scroll {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.3rem 0;
}

.recipes-search input,
.recipes-filter select,
.recipes-filter input:not(.account-multiselect__input) {
    appearance: none;
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-background);
    color: var(--color-text);
    font: inherit;
}

.recipes-filter select {
    padding-right: 2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--color-secondary) 50%), linear-gradient(135deg, var(--color-secondary) 50%, transparent 50%);
    background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
}

.recipes-search {
    flex: 0 0 400px;
    width: 400px;
}

.recipes-filter {
    flex: 0 0 160px;
}

.recipes-ingredients-filter {
    flex-basis: 260px;
}

.recipes-ingredients-filter .account-multiselect__trigger {
    min-height: 42px;
    background: var(--color-background);
}

.recipes-ingredients-filter .account-multiselect__options {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: auto;
    left: 0;
    z-index: 10;
    flex-wrap: wrap;
    width: min(320px, calc(100vw - 2rem));
    max-height: 180px;
    margin-top: 0;
    overflow-y: auto;
    padding: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-background);
    box-shadow: 0 18px 40px rgba(15, 26, 46, 0.08);
}

.recipes-controls.has-open-ingredient-filter,
.recipes-controls.has-open-ingredient-filter .recipes-filter-scroll {
    overflow: visible;
}

.recipes-search input:focus-visible,
.recipes-filter select:focus-visible,
.recipes-filter input:not(.account-multiselect__input):focus-visible,
.recipes-ingredients-filter .account-multiselect__trigger:focus-within {
    border-color: var(--color-primary);
    outline: 2px solid rgba(226, 61, 40, 0.16);
    outline-offset: 1px;
}

.recipes-controls__reset {
    flex: 0 0 auto;
    white-space: nowrap;
}

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.recipes-tab-panel,
.recipes-section {
    display: grid;
    gap: 1.5rem;
}

#recipes-explore-sections {
    display: grid;
    gap: 1.5rem;
}

#recipes-all-sections[hidden],
#recipes-explore-sections[hidden] {
    display: none;
}

#recipes-all-sections .recipes-section + .recipes-section,
#recipes-explore-sections .recipes-section + .recipes-section {
    padding-top: 1.5rem;
}

.recipes-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.recipes-section__header h2,
.recipes-section__empty {
    margin: 0;
}

.recipes-section__controls {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    flex: 0 0 auto;
}

.recipes-row-nav {
    min-width: 1.25rem;
    justify-content: center;
    font-size: 1.15rem;
    line-height: 1;
}

.recipes-section__empty {
    color: var(--color-text-accent);
}

.recipes-row {
    display: flex;
    gap: 1rem;
    min-width: 0;
    overflow: hidden;
    scroll-behavior: smooth;
}

.recipes-row .recipe-card {
    flex: 0 0 calc((100% - 3rem) / 4);
}

.recipe-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid rgba(15, 26, 46, 0.11);
    border-radius: 16px;
    background: linear-gradient(145deg, #fff 55%, rgba(241, 238, 232, 0.42));
    box-shadow: 0 10px 28px rgba(15, 26, 46, 0.04);
}

.recipe-card--loading {
    gap: 1rem;
    min-height: 220px;
}

.recipe-card__heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.recipe-card__heading h2 {
    margin: 0.25rem 0 0;
    font-family: "Sora", sans-serif;
    font-size: 1.2rem;
    line-height: 1.3;
}

.recipe-card__type {
    margin: 0;
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.recipe-card__saved-icon {
    width: 19px;
    height: 23px;
    flex: 0 0 auto;
}

.recipe-card__saved-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 32px;
    padding: 0.25rem;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.recipe-card__saved-toggle:hover .recipe-card__saved-icon,
.recipe-card__saved-toggle:focus-visible .recipe-card__saved-icon {
    filter: brightness(0.8) saturate(1.4);
}

.recipe-card__saved-toggle:focus-visible {
    outline: 2px solid rgba(226, 61, 40, 0.45);
    outline-offset: 2px;
}

.recipe-card__saved-toggle.is-animating {
    animation: recipe-bookmark-feedback 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes recipe-bookmark-feedback {
    0% { transform: scale(1) rotate(0); }
    45% { transform: scale(1.26) rotate(-7deg); }
    72% { transform: scale(0.94) rotate(3deg); }
    100% { transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
    .recipe-card__saved-toggle.is-animating { animation: none; }
}

.recipe-card__meta,
.recipe-card__tags,
.recipe-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.9rem;
}

.recipe-card__meta {
    margin-top: 0.8rem;
    color: var(--color-text-accent);
    font-size: 0.88rem;
}

.recipe-card__meta span + span::before {
    content: "·";
    margin-right: 0.9rem;
}

.recipe-card__tags {
    margin-top: 0.8rem;
}

.recipe-card__tag {
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 26, 46, 0.06);
    color: var(--color-secondary);
    font-size: 0.78rem;
}

.recipe-card__actions {
    margin-top: auto;
    padding-top: 1rem;
    justify-content: space-between;
}

.recipe-card__actions .recipe-card__saved-toggle {
    margin-left: auto;
}

.recipe-card__details {
    display: grid;
    grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.4fr);
    gap: 2rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(15, 26, 46, 0.1);
}

.recipe-card__details h3 {
    margin: 0 0 0.65rem;
    font-family: "Sora", sans-serif;
    font-size: 0.96rem;
}

.recipe-card__ingredients,
.recipe-card__steps {
    margin: 0;
    padding-left: 1.25rem;
}

.recipe-card__ingredients li,
.recipe-card__steps li {
    margin-bottom: 0.45rem;
}

.recipe-card__source {
    grid-column: 1 / -1;
    margin: 0;
}

.recipes-empty {
    display: grid;
    justify-items: start;
    gap: 0.75rem;
    min-height: 280px;
    align-content: center;
    padding: 2rem;
    border: 1px dashed rgba(15, 26, 46, 0.18);
    border-radius: 16px;
    background: rgba(241, 238, 232, 0.3);
}

.recipes-empty h2,
.recipes-empty p {
    margin: 0;
}

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

    .recipes-row .recipe-card {
        flex-basis: calc((100% - 1rem) / 2);
    }
}

@media (max-width: 560px) {
    .recipes-controls,
    .recipe-card__details {
        grid-template-columns: 1fr;
    }

    .recipes-section__header {
        align-items: flex-start;
    }

    .recipes-grid {
        grid-template-columns: 1fr;
    }

    .recipes-row {
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding: 0 0.25rem 0.6rem;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .recipes-row::-webkit-scrollbar {
        display: none;
    }

    .recipes-row .recipe-card {
        flex-basis: min(82vw, 22rem);
        scroll-snap-align: start;
    }
}
