/* ============================================================
   Hutoszekrenyem - main stylesheet
   Palette and layout follow the project design mockup.
   Class names are kebab-case and colors use hexadecimal values.
   ============================================================ */

:root {
    --color-forest-dark: #1f5d48;
    --color-forest-deep: #184a39;
    --color-forest-accent: #2c7a5b;
    --color-forest-light: #a9d3bf;
    --color-cream: #fbeed9;
    --color-cream-border: #21331c;
    --color-card-foot: #dcefdc;
    --color-section: #e7e6e1;
    --color-text-dark: #1f3a2c;
    --color-white: #ffffff;
    --color-danger: #b3261e;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--color-text-dark);
    background-color: var(--color-white);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

/* Full-width layout: the content spans the whole page instead of a narrow
   centered column, with responsive side padding so it never touches the edges. */
.container {
    max-width: 100%;
    padding-left: clamp(1.25rem, 4vw, 4rem);
    padding-right: clamp(1.25rem, 4vw, 4rem);
}

/* ---------- Navigation bar ---------- */
.site-navbar {
    background-color: var(--color-forest-dark);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.site-navbar .nav-link {
    color: var(--color-forest-light);
    font-weight: 500;
    margin: 0 0.6rem;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
    color: var(--color-white);
}

.navbar-toggler {
    border-color: var(--color-forest-light);
}

.navbar-toggler-icon {
    filter: invert(1);
}

.site-greeting {
    color: var(--color-white);
    font-weight: 500;
    margin-right: 0.4rem;
}

.btn-auth-outline,
.btn-auth-solid {
    border-radius: 4px;
    font-weight: 600;
    padding: 0.45rem 1.1rem;
}

.btn-auth-outline {
    background-color: var(--color-forest-accent);
    color: var(--color-white);
}

.btn-auth-outline:hover,
.btn-auth-outline:focus {
    background-color: var(--color-forest-deep);
    color: var(--color-white);
}

.btn-auth-solid {
    background-color: var(--color-forest-deep);
    color: var(--color-white);
}

.btn-auth-solid:hover,
.btn-auth-solid:focus {
    background-color: #123a2c;
    color: var(--color-white);
}

/* ---------- Hero with ingredient search ---------- */
/* ---------- Hero with ingredient search (centered) ---------- */
.hero {
    position: relative;
    overflow: hidden;
    background-color: var(--color-forest-dark);
    color: var(--color-white);
    padding: 4rem 0 4.5rem;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background-color: var(--color-forest-accent);
    opacity: 0.35;
    z-index: 0;
}

.hero::before {
    width: 460px;
    height: 460px;
    top: -120px;
    right: -60px;
}

.hero::after {
    width: 260px;
    height: 260px;
    bottom: -80px;
    right: 160px;
    opacity: 0.25;
}

.hero-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--color-forest-light);
    margin-bottom: 2rem;
}

.hero-search {
    display: flex;
    gap: 0.75rem;
    max-width: 720px;
    margin: 0 auto;
    justify-content: center;
    flex-wrap: wrap;
}

.search-field {
    position: relative;
    flex: 1 1 360px;
}

.search-input {
    width: 100%;
    padding: 0.9rem 1.1rem;
    font-size: 1rem;
    background-color: var(--color-white);
    border: 1px solid #c9c8c1;
    border-radius: 6px;
}

.search-input:focus {
    outline: 3px solid var(--color-forest-light);
    outline-offset: 1px;
    border-color: var(--color-forest-accent);
}

.suggestion-list {
    list-style: none;
    margin: 0.35rem 0 0;
    padding: 0.25rem 0;
    position: absolute;
    width: 100%;
    background-color: var(--color-white);
    border: 1px solid #cfcfc8;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

.suggestion-item {
    padding: 0.55rem 1.1rem;
    color: var(--color-text-dark);
    cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item:focus {
    background-color: var(--color-card-foot);
}

.search-button {
    flex: 0 0 auto;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-forest-dark);
    background-color: var(--color-cream);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.search-button:hover,
.search-button:focus {
    background-color: #f3e1c2;
}

/* ---------- Light content section ---------- */
.section-light {
    background-color: var(--color-section);
    padding: 2.75rem 0 3.5rem;
}

.section-heading {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 1.75rem 0 1.25rem;
}

.search-status {
    font-weight: 500;
    color: var(--color-forest-dark);
    margin-bottom: 1rem;
}

.empty-state {
    color: #5a5a52;
    font-style: italic;
}

/* ---------- Category chevrons ---------- */
.category-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    /* Smooth horizontal scrolling on narrow screens instead of ugly stacking. */
    scrollbar-width: thin;
}

.category-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 170px;
    padding: 0.85rem 2.6rem;
    background-color: var(--color-cream-border);
    clip-path: polygon(0 0, 100% 0, calc(100% - 24px) 50%, 100% 100%, 0 100%, 24px 50%);
    text-decoration: none;
    font-weight: 600;
}

.category-chip::before {
    content: "";
    position: absolute;
    inset: 2px;
    background-color: var(--color-cream);
    clip-path: polygon(0 0, 100% 0, calc(100% - 23px) 50%, 100% 100%, 0 100%, 23px 50%);
    z-index: 0;
}

.chip-label {
    position: relative;
    z-index: 1;
    color: var(--color-forest-dark);
}

.category-chip.is-active::before {
    background-color: #f3e1c2;
}

.category-chip:focus-visible {
    outline: 3px solid var(--color-forest-dark);
    outline-offset: 2px;
}

/* ---------- Recipe cards ---------- */
.recipe-card {
    display: block;
    height: 100%;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text-dark);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recipe-card:hover,
.recipe-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.recipe-card-media {
    aspect-ratio: 16 / 10;
    background-color: #eef0ec;
}

.recipe-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.recipe-card-body {
    background-color: var(--color-card-foot);
    padding: 1rem 1.1rem;
}

.recipe-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.6rem;
}

.recipe-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-card-category {
    color: #4a6a58;
}

.recipe-card-price {
    font-weight: 700;
    color: var(--color-forest-dark);
}

/* ---------- Forms (login, register) ---------- */
.form-card {
    max-width: 480px;
    margin: 1rem auto;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    padding: 2rem;
}

.form-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    text-align: center;
}

.field-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    min-height: 1.1rem;
    margin-top: 0.25rem;
}

.btn-primary-green {
    background-color: var(--color-forest-dark);
    color: var(--color-white);
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border: none;
}

.btn-primary-green:hover,
.btn-primary-green:focus {
    background-color: var(--color-forest-deep);
    color: var(--color-white);
}

.form-footer {
    text-align: center;
    margin-top: 1.25rem;
}

.form-footer a {
    color: var(--color-forest-dark);
    font-weight: 600;
}

/* ---------- Recipe detail ---------- */
.recipe-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    overflow: hidden;
    padding: 1.5rem;
}

.recipe-detail-media img {
    width: 100%;
    border-radius: 8px;
    object-fit: cover;
}

.recipe-detail-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.recipe-detail-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.recipe-detail-description {
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.recipe-detail-subtitle {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.ingredient-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ingredient-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e2dc;
}

.ingredient-amount {
    color: #4a6a58;
    font-weight: 600;
}

/* ---------- Footer ---------- */
.site-footer {
    background-color: var(--color-forest-deep);
    color: var(--color-forest-light);
    text-align: center;
    padding: 1.1rem 0;
    flex-shrink: 0;
}

/* ---------- Flash toast (login/logout/registration messages) ---------- */
.flash-toast {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 280px;
    max-width: 92vw;
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    background-color: var(--color-white);
    color: var(--color-text-dark);
    font-weight: 500;
    border: 1px solid #e2e1d9;
    box-shadow: 0 12px 32px rgba(15, 50, 35, 0.2);
    animation: flash-in 0.35s ease;
}

.flash-toast.flash-success {
    border-left: 4px solid var(--color-forest-dark);
}

.flash-toast.flash-danger {
    border-left: 4px solid #9e2b25;
}

.flash-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: var(--color-white);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.flash-success .flash-icon {
    background-color: var(--color-forest-dark);
}

.flash-danger .flash-icon {
    background-color: #9e2b25;
}

.flash-toast.flash-hide {
    animation: flash-out 0.4s ease forwards;
}

@keyframes flash-in {
    from { opacity: 0; transform: translate(-50%, -14px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes flash-out {
    from { opacity: 1; transform: translate(-50%, 0); }
    to   { opacity: 0; transform: translate(-50%, -14px); }
}

/* ---------- Admin area ---------- */
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.admin-nav-link {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    color: var(--color-forest-dark);
    font-weight: 600;
    text-decoration: none;
}

.admin-nav-link:hover,
.admin-nav-link:focus {
    background-color: var(--color-card-foot);
}

.admin-nav-link.is-active {
    background-color: var(--color-forest-dark);
    color: var(--color-white);
    border-color: var(--color-forest-dark);
}

/* Dashboard stat cards */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.admin-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 1.25rem 1.5rem;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text-dark);
}

.admin-stat:hover,
.admin-stat:focus {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.admin-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-forest-dark);
}

.admin-stat-label {
    color: #4a6a58;
    font-weight: 600;
}

/* Wider card for tables and forms (the narrow .form-card does not fit) */
.admin-panel {
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

.admin-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.admin-panel-head .admin-panel-title {
    margin: 0;
}

/* Add-new forms laid out as a responsive row */
.admin-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}

.admin-inline-field {
    flex: 1 1 200px;
}

.admin-inline-form > .btn {
    margin-top: 1.95rem;
}

/* Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.75rem 0.6rem;
    border-bottom: 1px solid #e2e2dc;
    vertical-align: middle;
}

.admin-table th {
    color: var(--color-forest-dark);
    font-weight: 700;
}

.admin-table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.admin-edit-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.admin-edit-form .form-control {
    width: auto;
    flex: 1 1 140px;
}

.admin-delete-form {
    display: inline;
}

.is-blocked-row {
    background-color: #fbe9e8;
}

.admin-self-note {
    color: #5a5a52;
    font-style: italic;
}

/* Recipe review (approval queue) */
.admin-review-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    color: #4a6a58;
}

.admin-review-description {
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.admin-review-actions {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.admin-reject-form {
    flex: 1 1 320px;
    max-width: 460px;
}

.admin-reject-form .btn {
    margin-top: 0.5rem;
}

.admin-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.admin-note {
    margin: 1.25rem 0 0;
    color: #5a5a52;
    font-style: italic;
    font-size: 0.9rem;
}

/* Status badges (shared by recipe status and account state) */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-approved {
    background-color: var(--color-card-foot);
    color: var(--color-forest-deep);
}

.status-pending {
    background-color: #fdf0d5;
    color: #8a6d1f;
}

.status-rejected {
    background-color: #fbe2e0;
    color: var(--color-danger);
}

/* Secondary and destructive buttons in the admin area */
.btn-soft {
    background-color: var(--color-card-foot);
    color: var(--color-forest-dark);
    font-weight: 600;
    padding: 0.45rem 1rem;
    border: 1px solid #cdd8cd;
}

.btn-soft:hover,
.btn-soft:focus {
    background-color: #cfe6cf;
    color: var(--color-forest-deep);
}

.btn-danger-outline {
    background-color: var(--color-white);
    color: var(--color-danger);
    font-weight: 600;
    padding: 0.45rem 1rem;
    border: 1px solid var(--color-danger);
}

.btn-danger-outline:hover,
.btn-danger-outline:focus {
    background-color: var(--color-danger);
    color: var(--color-white);
}

/* ---------- Recipe submission form (Chunk C) ---------- */
.recipe-form-card {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.ingredient-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1.25rem;
}

.ingredient-fieldset legend {
    float: none;
    width: auto;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ingredient-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

/* The name field carries the absolutely-positioned suggestion dropdown. */
.ingredient-name-wrap {
    position: relative;
    flex: 1 1 45%;
}

.ingredient-unit,
.ingredient-quantity {
    flex: 1 1 22%;
}

.ingredient-remove {
    flex: 0 0 auto;
    line-height: 1;
    padding: 0.45rem 0.8rem;
    font-size: 1.1rem;
}

/* The "add new ingredient" entry stands apart from real matches. */
.suggestion-create {
    font-style: italic;
    font-weight: 600;
    color: var(--color-forest-accent);
    border-top: 1px solid #e2e2dc;
}

.image-preview {
    display: block;
    max-width: 240px;
    width: 100%;
    margin-top: 0.75rem;
    border: 1px solid #cdd8cd;
    border-radius: 8px;
}

/* ---------- Favorites + weekly menu (Chunk D) ---------- */
/* The column wraps the card and the floating heart button. */
.recipe-card-col {
    position: relative;
    height: 100%;
}

.favorite-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.favorite-icon {
    font-size: 1.2rem;
    line-height: 1;
    color: #b9c2bb;
    transition: color 0.15s ease, transform 0.15s ease;
}

.favorite-btn:hover .favorite-icon,
.favorite-btn:focus-visible .favorite-icon {
    color: var(--color-danger);
    transform: scale(1.1);
}

.favorite-btn.is-active .favorite-icon {
    color: var(--color-danger);
}

.favorite-btn:disabled {
    cursor: default;
    opacity: 0.6;
}

/* Labelled variant used on the recipe detail page. */
.favorite-btn-labelled {
    position: static;
    width: auto;
    height: auto;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--color-forest-dark);
    box-shadow: none;
}

.favorite-btn-labelled .favorite-label-remove {
    display: none;
}

.favorite-btn-labelled.is-active .favorite-label-add {
    display: none;
}

.favorite-btn-labelled.is-active .favorite-label-remove {
    display: inline;
}

/* Favorites page heading row with the "build menu" action. */
.section-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.75rem 0 1.25rem;
}

.section-head-row .section-heading {
    margin: 0;
}

/* Inline create-menu form fields. */
.inline-field {
    flex: 1 1 220px;
}

/* The menu name does not need the full width of the panel. */
#menu-create-form .inline-field {
    flex: 0 1 22rem;
    max-width: 22rem;
}

/* Menu list. */
.menu-list {
    display: grid;
    gap: 1rem;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.menu-item-day {
    display: inline-block;
    font-weight: 700;
    color: var(--color-forest-dark);
    background-color: var(--color-card-foot);
    border-radius: 999px;
    padding: 0.2rem 0.8rem;
    font-size: 0.85rem;
}

.menu-item-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0.35rem 0 0.25rem;
}

.menu-item-count {
    color: #4a6a58;
    font-size: 0.9rem;
}

.menu-item-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.menu-delete-form {
    margin: 0;
}

/* Recipe picker (favorite recipes as selectable tiles). */
.menu-recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
}

.menu-recipe-option {
    display: flex;
    flex-direction: column;
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--color-white);
}

.menu-recipe-option.is-selected {
    border-color: var(--color-forest-accent);
    box-shadow: 0 0 0 2px var(--color-forest-light);
}

.menu-recipe-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.menu-recipe-option img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

.menu-recipe-name {
    padding: 0.55rem 0.7rem;
    font-weight: 600;
    background-color: var(--color-card-foot);
}

/* ---------- Weekly planner menus ---------- */

/* Menu cards on the menus list: a responsive grid, up to 3 per row. */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.menu-card {
    display: flex;
    flex-direction: column;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    overflow: hidden;
}

.menu-card-main {
    display: block;
    padding: 1.1rem 1.25rem;
    text-decoration: none;
    color: var(--color-text-dark);
    flex: 1 0 auto;
}

.menu-card-main:hover {
    background-color: var(--color-card-foot);
}

.menu-card-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    color: var(--color-forest-dark);
}

.menu-card-count {
    color: #4a6a58;
    font-size: 0.9rem;
}

.menu-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #e1e8e1;
}

/* Weekly planner grid (shared by the view and edit pages). */
.planner {
    display: grid;
    gap: 1rem;
}

.planner-day {
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    background-color: var(--color-white);
    padding: 1rem 1.1rem;
}

.planner-day-title {
    margin: 0 0 0.75rem;
    color: var(--color-forest-dark);
    font-size: 1.15rem;
    border-bottom: 2px solid var(--color-card-foot);
    padding-bottom: 0.4rem;
}

.planner-meals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
}

.planner-cell {
    background-color: var(--color-section);
    border-radius: 6px;
    padding: 0.7rem 0.8rem;
}

.planner-meal-title {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-forest-accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.planner-empty {
    margin: 0;
    color: #8a9a8f;
}

/* View page: recipe links inside each cell. */
.planner-recipe-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.planner-recipe {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--color-text-dark);
    background-color: var(--color-white);
    border: 1px solid #d7e0d7;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
}

.planner-recipe:hover {
    border-color: var(--color-forest-accent);
}

.planner-recipe img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 4px;
    flex: 0 0 auto;
}

.planner-recipe-name {
    font-weight: 600;
    font-size: 0.92rem;
}

/* Edit page: one recipe picker per day/meal cell. */
.planner-meal-select {
    background-color: var(--color-section);
    border-radius: 6px;
    padding: 0.7rem 0.8rem;
}

.planner-meal-select .form-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-forest-accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Keep the menu-name input from stretching across the whole panel. */
.menu-name-field {
    max-width: 22rem;
}

@media (max-width: 992px) {
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .menu-grid {
        grid-template-columns: 1fr;
    }

    .planner-meals {
        grid-template-columns: 1fr;
    }
}

/* ---------- Keyword search + My Fridge (Chunk E) ---------- */
.keyword-search {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.keyword-search .search-field {
    flex: 1 1 280px;
}

/* The drag-and-drop builder is shown only when JS is active; otherwise the
   plain multi-select fallback is used. */
.fridge-builder {
    display: none;
}

.fridge--js .fridge-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.fridge--js .fridge-fallback {
    display: none;
}

.fridge-pane {
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    padding: 1.25rem;
}

.fridge-pane-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

.fridge-add-field {
    position: relative;
    margin-bottom: 1rem;
}

.fridge-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fridge-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background-color: var(--color-card-foot);
    color: var(--color-forest-dark);
    border: 1px solid #cdd8cd;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.fridge-chip:hover,
.fridge-chip:focus-visible {
    background-color: #cfe6cf;
}

.fridge-chip.is-used {
    opacity: 0.45;
}

.fridge-chip-in {
    background-color: var(--color-forest-accent);
    color: var(--color-white);
    border-color: var(--color-forest-accent);
}

.fridge-chip-remove {
    font-size: 1.05rem;
    line-height: 1;
}

.fridge-dropzone {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-content: flex-start;
    min-height: 140px;
    padding: 1rem;
    border: 2px dashed #b9c2bb;
    border-radius: 8px;
    background-color: var(--color-section);
}

.fridge-dropzone.is-drag-over {
    border-color: var(--color-forest-accent);
    background-color: var(--color-card-foot);
}

.fridge-empty {
    color: #5a5a52;
    font-style: italic;
    margin: 0;
}

.fridge-actions {
    margin-bottom: 1.5rem;
}

/* Fridge result cards with the ingredient breakdown. */
.fridge-result {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--color-white);
    border: 1px solid #cdd8cd;
    border-radius: 8px;
    overflow: hidden;
}

.fridge-result-media {
    display: block;
    aspect-ratio: 16 / 10;
    background-color: #eef0ec;
}

.fridge-result-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fridge-result-body {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fridge-result-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text-dark);
    text-decoration: none;
}

.fridge-result-title:hover {
    color: var(--color-forest-dark);
}

.fridge-missing-note {
    margin: 0;
    font-weight: 600;
    color: var(--color-danger);
}

.fridge-missing-note.is-complete {
    color: var(--color-forest-accent);
}

.fridge-ingredient-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.fridge-ingredient-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
}

/* Highlight the missing ingredients (the spec's key requirement). */
.fridge-ingredient-list li.is-missing {
    background-color: #fbe2e0;
    color: var(--color-danger);
    font-weight: 600;
}

.fridge-ingredient-list li.is-missing .fridge-ingredient-name::before {
    content: "+ ";
}

.fridge-ingredient-list li.is-have {
    background-color: var(--color-card-foot);
    color: var(--color-forest-deep);
}

.fridge-ingredient-list li.is-have .fridge-ingredient-name::before {
    content: "\2713\00a0";
}

/* ---------- Responsive adjustments ---------- */
@media (max-width: 768px) {
    .hero {
        padding: 3rem 0 3.5rem;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .search-button {
        flex: 1 1 100%;
    }

    .recipe-detail {
        grid-template-columns: 1fr;
    }

    .admin-inline-form > .btn {
        margin-top: 0;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table tr {
        margin-bottom: 1rem;
        border: 1px solid #e2e2dc;
        border-radius: 8px;
        padding: 0.5rem;
    }

    .admin-table td {
        border-bottom: none;
    }

    /* Stack the ingredient row fields on narrow screens. */
    .ingredient-row {
        flex-wrap: wrap;
    }

    .ingredient-name-wrap,
    .ingredient-unit,
    .ingredient-quantity {
        flex: 1 1 100%;
    }

    .ingredient-remove {
        flex: 1 1 100%;
    }

    .menu-item {
        align-items: flex-start;
    }

    .menu-item-actions {
        width: 100%;
    }

    .fridge--js .fridge-builder {
        grid-template-columns: 1fr;
    }
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    .recipe-card {
        transition: none;
    }

    .recipe-card:hover,
    .recipe-card:focus-visible {
        transform: none;
    }

    .flash-toast,
    .flash-toast.flash-hide {
        animation: none;
    }

    .flash-toast.flash-hide {
        opacity: 0;
    }
}

/* ---------- Confirm modal ---------- */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(20, 40, 30, 0.55);
}

.confirm-modal-overlay[hidden] {
    display: none;
}

.confirm-modal {
    background-color: var(--color-white);
    border-radius: 10px;
    padding: 1.5rem 1.6rem 1.25rem;
    max-width: 24rem;
    width: 100%;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.confirm-modal-text {
    margin: 0 0 1.25rem;
    color: var(--color-text-dark);
    font-size: 1.05rem;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}
