/* Prevent horizontal scroll from full-width sections */
html,
body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Delay showing loading indicator to prevent flash on fast loads */
#loading {
    opacity: 0;
    animation: fadeInLoading 0.15s ease-in 0.15s forwards;
}

@keyframes fadeInLoading {
    to {
        opacity: 1;
    }
}

body {
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/food-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    opacity: 0.50;
}

main.container {
    padding: 0;
    margin: 0;
}

.auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

/* Site header - glassmorphism style */
.site-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.5rem 1.5rem;
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.header-content>* {
    flex: 1;
}

.logo {
    font-family: 'Pacifico', cursive;
    font-size: 1.5rem;
    color: #e67e22;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.user-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    font-size: 0.8rem;
    padding-right: 1rem;
}

.user-menu span {
    color: #555;
}

.user-menu a {
    color: #e67e22;
    text-decoration: none;
    font-weight: 500;
}

.user-menu a:hover {
    text-decoration: underline;
}

/* User dropdown */
.user-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    color: #555 !important;
    font-size: 0.8rem !important;
    padding: 0.25rem 0.5rem !important;
    min-width: auto !important;
    cursor: pointer;
}

.dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border-radius: 4px;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 120px;
    z-index: 200;
    padding: 0.25rem 0;
}

.dropdown-item {
    display: block;
    padding: 0.4rem 1rem;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 0.75rem;
    font-weight: normal !important;
}

.dropdown-item:hover {
    background: #f5f5f5;
    text-decoration: none !important;
}

/* Global button styles - pumpkin color */
button,
[type="submit"],
.actions button {
    font-size: 0.75rem !important;
    padding: 0.5rem 1.25rem !important;
    border-radius: 6px;
    min-width: 160px;
    text-align: center;
    background: linear-gradient(180deg, #f39c12 0%, #e67e22 50%, #d35400 100%) !important;
    border: 1px solid #c0392b !important;
    color: #fff !important;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:hover,
[type="submit"]:hover,
.actions button:hover {
    background: linear-gradient(180deg, #f5ab35 0%, #e98b39 50%, #dc6a1a 100%) !important;
    cursor: pointer;
}

button:disabled,
[type="submit"]:disabled {
    background: linear-gradient(180deg, #f5c67a 0%, #e8a85c 50%, #d98a4a 100%) !important;
    border-color: #c9a080 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Navigation button — compact orange gradient. Use for all banner nav elements.
   Works on <a> and <button>. Never add role="button" to <a> tags (Pico v2 makes it blue). */
.nav-btn {
    display: inline-block;
    font-size: 0.68rem !important;
    padding: 0.28rem 0.62rem !important;
    border-radius: 5px;
    min-width: auto !important;
    white-space: nowrap;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    flex-shrink: 0;
    background: linear-gradient(180deg, #f39c12 0%, #e67e22 50%, #d35400 100%) !important;
    border: 1px solid #c0392b !important;
    color: #fff !important;
}

.nav-btn:hover {
    background: linear-gradient(180deg, #f5ab35 0%, #e98b39 50%, #dc6a1a 100%) !important;
    color: #fff !important;
}

/* Remove default article margins from Pico CSS */
#add-dishes-section article,
#meal-plan-section article {
    margin-bottom: 0;
}

/* Auth card styling */
.auth-card {
    width: 100%;
    max-width: 340px;
    margin: 0;
    padding: 1.5rem 1.75rem !important;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
}

.auth-tagline {
    text-align: center;
    color: var(--muted-color);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.auth-card form input {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.auth-card form button[type="submit"] {
    width: 100%;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.forgot-password {
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.75rem;
}

.input-hint {
    display: block;
    font-size: 0.65rem;
    font-style: italic;
    color: var(--muted-color);
    margin-top: -0.75rem;
    margin-bottom: 1rem;
}

.form-switch {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* Add dishes section */
#add-dishes-section {
    padding: 0.75rem 1.5rem 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 45px);
}

/* Welcome banner - glassmorphism style */
.welcome-banner {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.5rem 1.5rem;
    text-align: center;
    margin: 0 auto 0.75rem auto;
    box-sizing: border-box;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Match banner width to card layout on each page */
#add-dishes-section .welcome-banner {
    max-width: 1100px;
    width: 100%;
}

#meal-plan-section .welcome-banner {
    max-width: 1200px;
    width: 100%;
}

.welcome-banner h1 {
    margin-bottom: 0.15rem;
    font-size: 1rem;
}

.welcome-banner p {
    color: var(--muted-color);
    margin-bottom: 0;
    font-size: 0.7rem;
}

/* Meal plan section */
#meal-plan-section {
    padding: 0.75rem 1.5rem 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 45px);
}

/* Meal plan card headers */
.meal-plan-card header h3,
.shopping-list-card header h3 {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

/* Meal plan layout - side by side */
.meal-plan-layout {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: flex-start;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 0.75rem auto;
}

.meal-plans-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1.4;
    max-width: 720px;
}

.meal-plan-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

/* Meal plan accordion adjustments */
.meal-plan-card .accordion-header {
    padding: 0.35rem 0 0.75rem 0 !important;
    font-size: 0.85rem !important;
    border-bottom: 1px solid var(--pico-muted-border-color, #e0e0e0);
    margin-bottom: 0.75rem;
}

.meal-plan-card .accordion-section {
    border-bottom: none;
}

/* Ideas button inside accordion header - matches secondary-outline-btn style */
.ideas-btn {
    display: inline-block;
    background: transparent;
    border: 2px solid #e67e22;
    border-radius: 6px;
    color: #e67e22 !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    padding: 0.35rem 0.75rem;
    white-space: nowrap;
    cursor: pointer;
    margin-right: 0.75rem;
    width: 135px;
    text-align: center;
}

.ideas-btn:hover {
    background: rgba(230, 126, 34, 0.1);
}

/* Make accordion title take remaining space when ideas button is present */
.dish-options-card .accordion-header>span:first-child {
    flex: 1;
}

/* Dishes list accordion adjustments — override meal-plan-card defaults */
.dish-options-card .accordion-section {
    border-bottom: none;
}

.dish-options-card .accordion-section.open .accordion-content {
    max-height: 500px;
    overflow-y: auto;
}

.meal-plan-card .accordion-section.open .accordion-content {
    max-height: 1000px;
}

.accordion-title-with-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dietary-indicator-inline {
    font-size: 0.7rem;
    color: #e67e22;
    font-weight: 400;
    font-style: italic;
}

.shopping-list-card {
    flex: 1;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.meal-plan-card header h3,
.shopping-list-card header h3 {
    margin-bottom: 0.5rem;
}

/* Side by side layout */
.dishes-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: start;
    gap: 1.5rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto 1.5rem auto;
}

/* Shared card styling */
.card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
}

.card>h3 {
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0;
}

/* Card header with title and button */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.card-header h3 {
    font-size: 0.85rem;
    line-height: 1;
    margin: 0;
    padding: 0;
    flex: 1;
    align-self: center;
}

.card-header button,
.card-header [type="submit"] {
    min-width: 105px !important;
    max-width: 105px !important;
    padding: 0.35rem 0.5rem !important;
    font-size: 0.7rem !important;
    white-space: nowrap;
    text-align: center !important;
    overflow: hidden;
}

/* Card header button group */
.card-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-header-buttons button {
    min-width: 125px !important;
    max-width: 125px !important;
}

/* Secondary outline button style */
.secondary-outline-btn {
    background: transparent !important;
    border: 2px solid #e67e22 !important;
    color: #e67e22 !important;
}

@media (max-width: 768px) {
    .card-header-buttons button {
        min-width: 90px !important;
        max-width: 90px !important;
        font-size: 0.6rem !important;
        padding: 0.3rem 0.35rem !important;
    }
}

.secondary-outline-btn:hover {
    background: rgba(230, 126, 34, 0.1) !important;
}

.secondary-outline-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dish form card */
.dish-form-card {
    flex: 1.2;
    max-width: 480px;
}

.dish-form-card .card-header {
    padding-top: 0.35rem;
}

.dish-form-card form {
    display: flex;
    flex-direction: column;
}

.dish-form-card small {
    display: block;
    margin-top: -0.25rem;
    margin-bottom: 0.5rem;
    color: var(--muted-color);
    font-style: italic;
    font-size: 0.65rem;
}

/* Meal name search dropdown */
.meal-name-search-wrapper {
    position: relative;
}

.meal-name-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.meal-name-dropdown .search-result-item {
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    font-size: 0.75rem;
    border-bottom: 1px solid #eee;
}

.meal-name-dropdown .search-result-item:last-child {
    border-bottom: none;
}

.meal-name-dropdown .search-result-item:hover {
    background: #fff8f3;
}

.meal-name-dropdown .result-name {
    font-weight: 500;
    color: #333;
}

.meal-name-dropdown .result-cuisine {
    color: #888;
    font-size: 0.65rem;
    margin-left: 0.3rem;
}

.meal-name-dropdown .no-results {
    padding: 0.5rem 0.6rem;
    color: #888;
    font-style: italic;
    font-size: 0.7rem;
}

.dish-form-card label {
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
}

.dish-form-card input,
.dish-form-card textarea {
    padding: 0.4rem;
    font-size: 0.75rem;
}

/* Ingredient autocomplete wrapper */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-ghost {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.4rem;
    font-size: 0.75rem;
    font-family: inherit;
    line-height: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    pointer-events: none;
    overflow: hidden;
}

.ghost-real {
    visibility: hidden;
}

.ghost-suggestion {
    color: #bbb;
}


/* Dish option cards (dinner + breakfast) */
.dish-options-card {
    width: 100%;
}



/* Card content fills available space, pushing footer to bottom */
.card-content {
    flex: 1;
}

/* Align both button containers at the same level */
.card-footer {
    padding-top: 0.5rem;
    border-top: 1px solid var(--muted-border-color);
}

/* Empty state for dishes list */
.dishes-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted-color);
    font-style: italic;
    font-size: 0.8rem;
    padding: 1rem;
    height: 100%;
}

.dishes-empty-state p {
    margin: 0;
}

/* Make Add Dish and Generate Meal Plan buttons same width and aligned */
.card-footer button {
    width: 100%;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

/* Meal plan grid: 4 cols = Mon-Thu row 1, Fri-Sun row 2 */
.meal-plan-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
}

.meal-day {
    background: var(--card-background-color);
    border: 1px solid var(--muted-border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    text-align: center;
}

.meal-day .day-name {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.25rem;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.meal-day .dish-name {
    font-size: 0.7rem;
}

.no-meal-day {
    font-style: italic;
    color: #aaa;
    font-size: 0.65rem;
}

.meal-day .dish-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: rgba(230, 126, 34, 0.2);
}

.meal-day .dish-link:hover,
.meal-day .dish-link:active {
    color: #e67e22;
    text-decoration: underline;
}

/* Multi-meal display styles */
.dish-name.multi-meal {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meal-slot {
    display: flex;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.1rem 0;
}

.meal-slot .dish-link {
    flex: 1;
    min-width: 0;
}

.meal-label {
    font-size: 0.65rem;
    color: #e67e22;
    font-weight: 600;
    flex-shrink: 0;
}

/* Recipe detail page */
.recipe-page-layout {
    max-width: 994px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    justify-content: center;
}

.recipe-page-card {
    width: 100%;
    max-width: 994px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.recipe-page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--muted-border-color);
}

.recipe-page-header .nav-btn {
    position: absolute;
    left: 0;
    min-width: auto !important;
    padding: 0.35rem 0.7rem !important;
    font-size: 0.7rem !important;
    white-space: nowrap;
}

.recipe-title-group {
    text-align: center;
}

.recipe-page-name {
    font-size: 1rem;
    font-weight: 600;
}

.recipe-page-cuisine {
    font-size: 0.75rem;
    color: #999;
}

.recipe-page-card .recipe-section {
    margin-bottom: 1rem;
}

.recipe-page-card .recipe-section:last-child {
    margin-bottom: 0;
}

.recipe-page-card .recipe-section h4 {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.recipe-page-card .recipe-section ul {
    list-style: disc;
    padding-left: 1rem;
    font-size: 0.75rem;
    margin: 0;
    columns: 3;
    column-gap: 1rem;
}

.recipe-page-card .recipe-section ul li {
    margin-bottom: 0.25rem;
    break-inside: avoid;
}

.recipe-page-card .preparation-text {
    font-size: 0.75rem;
    line-height: 1.6;
    color: #444;
}

/* Responsive: 2 columns on smaller screens */
@media (max-width: 500px) {
    .recipe-page-card .recipe-section ul {
        columns: 2;
    }

    .recipe-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .recipe-page-header .nav-btn {
        position: static;
    }

    .recipe-title-group {
        width: 100%;
    }
}

@media (max-width: 350px) {
    .recipe-page-card .recipe-section ul {
        columns: 1;
    }
}

/* Dishes list */
#dishes-list {
    list-style: none;
    padding: 0;
}

#dishes-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--muted-border-color);
    font-size: 0.75rem;
}

#dishes-list li:last-child {
    border-bottom: none;
}

#dishes-list .dish-info {
    flex: 1;
}

#dishes-list .dish-name {
    font-weight: 500;
}

#dishes-list .dish-cuisine {
    font-size: 0.65rem;
    font-weight: 400;
    color: #999;
}

#dishes-list .dish-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-block;
    padding: 0.25rem 0;
    -webkit-tap-highlight-color: rgba(230, 126, 34, 0.2);
}

#dishes-list .dish-link:hover,
#dishes-list .dish-link:active {
    color: #e67e22;
}

#dishes-list .delete-btn {
    background: none !important;
    border: none !important;
    color: var(--del-color, #c62828) !important;
    cursor: pointer;
    padding: 0.25rem !important;
    margin: 0;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dishes-list .delete-btn:hover {
    background: rgba(198, 40, 40, 0.1) !important;
}

/* Dish list search filter */
.dish-search {
    display: block !important;
    width: 100% !important;
    margin: 0 0 0.4rem 0 !important;
    padding: 0.2rem 0.5rem !important;
    font-size: 0.72rem !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: 0 !important;
    border-radius: 4px !important;
    border: 1px solid var(--pico-muted-border-color, rgba(255,255,255,0.2)) !important;
    background: transparent !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    -webkit-appearance: none;
    appearance: none;
}

.dish-no-results {
    font-size: 0.75rem;
    color: var(--pico-muted-color, #888);
    text-align: center;
    padding: 0.4rem 0;
    margin: 0;
}

/* Shopping list categories - stacked rows */
.shopping-categories-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.shopping-category {
    font-size: 0.7rem;
    line-height: 1.5;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.shopping-category:last-child {
    border-bottom: none;
}

.category-title {
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 0.3rem;
    letter-spacing: 0.5px;
    color: #e67e22;
}

.shopping-category .ingredient-name {
    color: #333;
    text-transform: capitalize;
}

.shopping-category .ingredient-details {
    font-size: 0.6rem;
    color: #6c757d;
    font-style: italic;
}

/* Actions footer */
.actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

/* Responsive - Tablet (768px - 1024px) */
@media (max-width: 1024px) {

    .dishes-layout,
    .meal-plan-layout,
    #add-dishes-section .welcome-banner,
    #meal-plan-section .welcome-banner {
        max-width: 95%;
        gap: 1rem;
    }

    .dish-form-card {
        max-width: 55%;
    }

    .meal-plan-card {
        max-width: 62%;
    }

    .shopping-list-card {
        max-width: 36%;
    }

}

/* Responsive - Small tablet / Large phone (576px - 768px) */
@media (max-width: 768px) {

    #add-dishes-section,
    #meal-plan-section {
        min-height: calc(100vh - 45px);
        padding: 0.5rem 1rem 1rem 1rem;
    }

    .dishes-layout,
    .meal-plan-layout {
        flex-direction: column;
        align-items: center;
        width: 90%;
        max-width: 90%;
    }

    .welcome-banner,
    #add-dishes-section .welcome-banner,
    #meal-plan-section .welcome-banner {
        width: 90%;
        max-width: 90%;
        padding: 0.5rem 1rem;
    }

    .welcome-banner h1 {
        font-size: 0.9rem;
    }

    .welcome-banner p {
        font-size: 0.65rem;
    }

    .dish-form-card,
    .dishes-options-column,
    .meal-plans-column,
    .meal-plan-card,
    .shopping-list-card {
        max-width: 100%;
        width: 100%;
    }

    .meal-plan-grid {
        grid-template-columns: repeat(4, 1fr);
    }

}

/* Responsive - Phone (< 576px) */
@media (max-width: 576px) {
    .site-header {
        padding: 0.4rem 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .user-menu {
        font-size: 0.7rem;
        gap: 0.5rem;
    }

    #add-dishes-section,
    #meal-plan-section {
        min-height: calc(100vh - 60px);
        padding: 0.5rem 0.75rem 1rem 0.75rem;
    }

    .welcome-banner,
    #add-dishes-section .welcome-banner,
    #meal-plan-section .welcome-banner {
        width: 95%;
        max-width: 95%;
    }

    .dishes-layout,
    .meal-plan-layout {
        width: 95%;
        max-width: 95%;
    }

    .meal-plan-grid {
        grid-template-columns: repeat(2, 1fr);
    }


    .actions {
        flex-direction: column;
        width: 100%;
    }

    .actions button {
        width: 100%;
    }
}

/* Core Layout Utilities */
.hidden {
    display: none !important;
}

.logo {
    font-family: 'Pacifico', cursive;
    font-size: 1.5rem;
}

/* Consolidated Dishes Layout */
.dishes-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: start;
    gap: 1.5rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto 1.5rem auto;
}

/* Ensure individual cards don't "shrink" too much */
.dish-form-card {
    width: 100%;
    max-width: none;
}

/* Stacked dinner + breakfast option cards */
.dishes-options-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* Fix for Tablet/Mobile */
@media (max-width: 768px) {
    .dishes-layout {
        grid-template-columns: 1fr;
        width: 90%;
    }
}

/* Error Styles */
.error-message {
    padding: 1rem;
    background-color: #fee2e2;
    color: #b91c1c;
    border-radius: 8px;
    margin-top: 1rem;
}

.success-message {
    padding: 0.75rem 1rem;
    background-color: #d1fae5;
    color: #065f46;
    border-radius: 8px;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    text-align: center;
}

/* Profile Page */
.profile-container {
    padding: 1rem;
    max-width: 100%;
}

article.profile-card {
    max-width: 450px;
    margin: 2rem auto;
    padding: 1.5rem !important;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

article.profile-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

article.profile-card form {
    margin: 0;
}

.profile-field {
    margin-bottom: 1.25rem;
}

.profile-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
}

.readonly-field {
    margin-bottom: 1rem;
}

.readonly-field .field-value {
    display: block;
    padding: 0.5rem 0.75rem;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #666;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.editable-field input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    box-sizing: border-box;
}

.editable-field select {
    width: 100% !important;
    padding: 0.5rem 0.75rem !important;
    padding-right: 2rem !important;
    font-size: 0.85rem !important;
    background: #f5f5f5 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    margin-bottom: 0.25rem !important;
    box-sizing: border-box !important;
    color: #555 !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

.editable-field select:hover {
    background-color: #efefef !important;
}

.editable-field input:focus {
    border-color: #e67e22;
    outline: none;
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.15);
}

.editable-field select:focus {
    border-color: #e0e0e0 !important;
    outline: none !important;
    box-shadow: none !important;
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.15);
}

.editable-field small {
    display: block;
    font-size: 0.7rem;
    color: #888;
    font-style: italic;
    margin-top: 0.25rem;
}

.day-checkboxes {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.day-checkboxes label {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #ccc;
    cursor: pointer;
    color: #aaa;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    user-select: none;
}

.day-checkboxes input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.day-checkboxes label:has(input:checked) {
    background: #2d4a8a;
    border-color: #2d4a8a;
    color: white;
}

.day-checkboxes label:has(input:checked)::before {
    content: '✓';
    position: absolute;
    top: 5px;
    font-size: 0.5rem;
    line-height: 1;
    color: white;
}

.day-checkboxes label:has(input:checked) span {
    margin-top: 7px;
}

article.profile-card button[type="submit"] {
    width: 100%;
    margin-top: 0.75rem;
}

.profile-section-header {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.profile-section-header h3 {
    font-size: 0.9rem;
    margin: 0 0 0.25rem 0;
    color: #333;
}

.profile-section-header small {
    font-size: 0.7rem;
    color: #888;
    font-style: italic;
}

/* Accordion styles */
.accordion-section {
    border-bottom: 1px solid #e8e8e8;
}

.accordion-section:last-of-type {
    border-bottom: none;
}

.accordion-header {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1rem 0.25rem !important;
    background: transparent !important;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: #333 !important;
    text-align: left !important;
    transition: color 0.2s !important;
    margin: 0 !important;
}

.accordion-header:hover,
.accordion-header:active {
    color: #e67e22 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: none !important;
}

.accordion-header:focus {
    color: inherit !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

.accordion-header:focus:hover {
    color: #e67e22 !important;
}

.accordion-icon {
    font-size: 0.65rem;
    transition: transform 0.25s ease;
    color: #999;
}

.accordion-section.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 0.25rem;
}

.accordion-section.open .accordion-content {
    max-height: 1000px;
    padding: 0 0.25rem 1rem;
}

.accordion-description {
    font-size: 0.75rem;
    color: #888;
    margin: 0 0 0.75rem 0;
}

.accordion-content .profile-field:last-child {
    margin-bottom: 0;
}

/* Accordion actions (buttons inside accordions) */
.accordion-actions {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--muted-border-color);
    text-align: center;
}

.accordion-actions .secondary-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.accordion-actions .secondary-btn:hover {
    background: var(--primary);
    color: white;
}

.accordion-actions .secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile adjustments for accordion */
@media (max-width: 480px) {
    article.profile-card {
        max-width: 100%;
        margin: 1rem;
        padding: 1rem !important;
    }

    article.profile-card h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .accordion-header {
        padding: 0.85rem 0.25rem;
        font-size: 0.85rem;
    }

    .accordion-section.open .accordion-content {
        padding: 0 0.25rem 0.85rem;
    }

    .editable-field input,
    .editable-field select {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Meal Ideas Section */
#meal-ideas-section {
    padding: 0.75rem 1.5rem 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 45px);
}

#history-section {
    padding: 0.75rem 1.5rem 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 45px);
}

#meal-ideas-section .welcome-banner,
#history-section .welcome-banner {
    max-width: 1100px;
    width: 100%;
}

/* Meal Ideas Layout - Side by Side */
.meal-ideas-layout {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: flex-start;
    max-width: 1070px;
    width: 100%;
    margin: 0 auto 0.75rem auto;
}

/* Banner with back button (Meal Ideas, Meal Plan, Add Dishes, History) */
.meal-ideas-banner,
.meal-plan-banner,
.add-dishes-banner,
.history-banner {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 1rem;
}

/* .nav-btn is self-contained — no banner-specific overrides needed */

.meal-ideas-banner .banner-text,
.add-dishes-banner .banner-text,
.history-banner .banner-text {
    flex: 1;
    text-align: center;
    padding-right: 60px;
    /* Balance the single left button */
}

/* Meal plan banner has buttons on both sides — no offset needed */
.meal-plan-banner .banner-text {
    flex: 1;
    text-align: center;
    padding-right: 0;
}


/* Search Panel */
.search-panel {
    flex: 1;
    max-width: 456px;
}

.search-panel h3 {
    text-align: left;
}

.search-panel input,
.search-panel select {
    width: 100%;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    padding: 0.4rem;
}

.ingredient-search-row {
    position: relative;
    margin-bottom: 0.5rem;
}

.ingredient-search-row input {
    width: 100%;
    margin-bottom: 0;
    padding-right: 2rem;
}

#ingredient-search-btn {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
}

.ai-search-divider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.4rem 0 0.4rem;
    color: #aaa;
    font-size: 0.7rem;
}

.ai-search-divider::before,
.ai-search-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.ai-search-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.ai-search-row input {
    flex: 1;
    margin-bottom: 0;
    height: 2.1rem !important;
    min-height: unset !important;
    padding: 0 0.6rem !important;
    box-sizing: border-box !important;
    font-size: 0.75rem;
}

#ai-search-btn {
    height: 2.1rem;
    padding: 0 0.65rem;
    font-size: 0.7rem;
    white-space: nowrap;
    cursor: pointer;
    background: linear-gradient(180deg, #f39c12 0%, #e67e22 50%, #d35400 100%);
    border: 1px solid #c0392b;
    border-radius: 4px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    user-select: none;
    flex-shrink: 0;
}

#ai-search-btn:hover {
    opacity: 0.9;
}

#ai-search-btn.loading {
    opacity: 0.7;
    cursor: default;
}

#ai-search-error.ai-search-info {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.ai-fallback-notice {
    font-size: 0.7rem;
    color: #92400e;
    background: #fef3c7;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.4rem;
    font-style: italic;
}

.search-result-item .ai-badge {
    font-size: 0.6rem;
    color: #e67e22;
    margin-left: 0.25rem;
    opacity: 0.85;
}

.search-panel label {
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
}

.category-filter-group {
    border: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
}

.category-filter-group legend {
    font-size: 0.75rem;
    padding: 0;
    margin-bottom: 0.25rem;
}

.category-filter-group .checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.category-filter-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.search-results {
    max-height: 180px;
    /* Show ~4 items, rest scrollable */
    overflow-y: auto;
    margin-top: 0.5rem;
}

.search-hint,
.no-results {
    color: var(--muted-color);
    font-style: italic;
    font-size: 0.75rem;
    text-align: center;
    padding: 1rem;
}

.search-result-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--muted-border-color);
    cursor: pointer;
    font-size: 0.75rem;
}

.search-result-item:hover {
    background: rgba(230, 126, 34, 0.1);
}

.search-result-item.selected {
    background: rgba(230, 126, 34, 0.15);
}

.search-result-item .result-name {
    font-weight: 500;
}

.search-result-item .result-cuisine {
    font-size: 0.65rem;
    color: #999;
}

/* Recipe Detail Panel */
.recipe-detail-card {
    flex: 1.5;
    max-width: 580px;
}

/* Recipe header with name and button */
.recipe-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.recipe-header h3 {
    font-size: 1rem;
    margin: 0;
    flex: 1;
}

.recipe-header button,
.recipe-header [type="submit"] {
    min-width: 105px !important;
    max-width: 105px !important;
    padding: 0.35rem 0.5rem !important;
    font-size: 0.7rem !important;
    white-space: nowrap;
    text-align: center !important;
    overflow: hidden;
}


.recipe-detail-card h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.recipe-cuisine {
    color: #e67e22;
    font-size: 0.8rem;
    font-style: italic;
    margin-bottom: 1rem;
}

.recipe-section {
    margin-bottom: 1rem;
}

.recipe-section h4 {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.recipe-section ul {
    list-style: disc;
    padding-left: 1.5rem;
    font-size: 0.75rem;
    margin: 0;
}

.recipe-section ul li {
    margin-bottom: 0.25rem;
}

.preparation-text {
    font-size: 0.75rem;
    line-height: 1.6;
    white-space: pre-line;
    max-height: 300px;
    overflow-y: auto;
}

/* Responsive - Meal Ideas */
@media (max-width: 1024px) {

    .meal-ideas-layout,
    #meal-ideas-section .welcome-banner,
    #history-section .welcome-banner {
        max-width: 95%;
        gap: 1rem;
    }

    .search-panel {
        max-width: 45%;
    }

    .recipe-detail-card {
        max-width: 52%;
    }
}

@media (max-width: 768px) {
    #meal-ideas-section {
        min-height: calc(100vh - 45px);
        padding: 0.5rem 1rem 1rem 1rem;
    }

    .meal-ideas-layout {
        flex-direction: column;
        align-items: center;
        width: 90%;
        max-width: 90%;
    }

    #meal-ideas-section .welcome-banner,
    #history-section .welcome-banner {
        width: 90%;
        max-width: 90%;
    }

    .meal-ideas-banner .banner-text,
    .history-banner .banner-text {
        padding-right: 0;
    }

    .search-panel,
    .recipe-detail-card {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 576px) {

    #meal-ideas-section,
    #breakfast-ideas-section {
        min-height: calc(100vh - 60px);
        padding: 0.5rem 0.75rem 1rem 0.75rem;
    }

    #meal-ideas-section .welcome-banner,
    #breakfast-ideas-section .welcome-banner {
        width: 95%;
        max-width: 95%;
    }

    .meal-ideas-layout {
        width: 95%;
        max-width: 95%;
    }
}

/* Breakfast Ideas Section - Same as Meal Ideas */
#breakfast-ideas-section {
    padding: 0.75rem 1.5rem 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 45px);
}

#breakfast-ideas-section .welcome-banner {
    max-width: 1100px;
    width: 100%;
}

/* Breakfast recipe header button - same width as dinner */
#breakfast-recipe-detail-panel .recipe-header button {
    min-width: 105px !important;
    max-width: 105px !important;
}

/* Breakfast prep time display */
.recipe-prep-time {
    color: #666;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Breakfast dishes list - same styling as dinner dishes */
#breakfast-dishes-list {
    list-style: none;
    padding: 0;
}

#breakfast-dishes-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--muted-border-color);
    font-size: 0.75rem;
}

#breakfast-dishes-list li:last-child {
    border-bottom: none;
}

#breakfast-dishes-list .dish-info {
    flex: 1;
}

#breakfast-dishes-list .dish-name {
    font-weight: 500;
}

#breakfast-dishes-list .dish-cuisine {
    font-size: 0.65rem;
    font-weight: 400;
    color: #999;
}

#breakfast-dishes-list .dish-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-block;
    padding: 0.25rem 0;
    -webkit-tap-highlight-color: rgba(230, 126, 34, 0.2);
}

#breakfast-dishes-list .dish-link:hover,
#breakfast-dishes-list .dish-link:active {
    color: #e67e22;
}

#breakfast-dishes-list .delete-btn {
    background: none !important;
    border: none !important;
    color: var(--del-color, #c62828) !important;
    cursor: pointer;
    padding: 0.25rem !important;
    margin: 0;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#breakfast-dishes-list .delete-btn:hover {
    background: rgba(198, 40, 40, 0.1) !important;
}

/* Responsive - Breakfast Ideas */
@media (max-width: 1024px) {
    #breakfast-ideas-section .welcome-banner {
        max-width: 95%;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    #breakfast-ideas-section {
        min-height: calc(100vh - 45px);
        padding: 0.5rem 1rem 1rem 1rem;
    }

    #breakfast-ideas-section .welcome-banner {
        width: 90%;
        max-width: 90%;
    }
}

/* ==========================================
   Onboarding Section
   ========================================== */

#onboarding-section {
    padding: 0.75rem 1.5rem 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 45px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-container {
    max-width: 500px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.onboarding-welcome {
    text-align: center;
}

.onboarding-welcome h1 {
    margin-bottom: 0;
}

.onboarding-card {
    padding: 1.25rem;
}

.onboarding-card h3 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
    color: #e67e22;
}

.onboarding-intro {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.onboarding-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(180deg, #f39c12 0%, #e67e22 50%, #d35400 100%);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-text {
    font-size: 0.8rem;
    color: #333;
}

.onboarding-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.onboarding-actions button {
    width: 200px;
}

.onboarding-actions .secondary-btn {
    background: transparent !important;
    border: 2px solid #e67e22 !important;
    color: #e67e22 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

.onboarding-actions .secondary-btn:hover {
    background: rgba(230, 126, 34, 0.1) !important;
}

.onboarding-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0 0.5rem 0;
}

.onboarding-divider::before,
.onboarding-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e0e0;
}

.onboarding-divider span {
    padding: 0 0.75rem;
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
}

.onboarding-quick-start {
    text-align: center;
}

.quick-start-hint {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.onboarding-preferences {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    text-align: left;
}

.pref-section {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.pref-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cuisine-inputs {
    display: flex;
    gap: 0.5rem;
}

.cuisine-inputs input {
    flex: 1;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    min-width: 0;
}

.cuisine-inputs input:focus {
    border-color: #e67e22;
    outline: none;
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.15);
}

#onboarding-dietary {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

#onboarding-dietary:focus {
    border-color: #e67e22;
    outline: none;
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.15);
}

#onboarding-hungry-btn {
    min-width: 200px;
}

.hungry-status {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Responsive - Onboarding */
@media (max-width: 576px) {
    #onboarding-section {
        padding: 0.5rem 0.75rem 1rem 0.75rem;
        min-height: calc(100vh - 60px);
    }

    .onboarding-container {
        max-width: 95%;
    }

    .onboarding-card {
        padding: 1rem;
    }

    .onboarding-actions button {
        width: 100%;
        max-width: 200px;
    }
}

/* ==========================================
   Mobile Bottom Navigation
   ========================================== */

.mobile-bottom-nav {
    display: none;
    /* Hidden by default on desktop */
}

@media (max-width: 768px) {

    /* Hide generate/see plan button on mobile — bottom nav tab serves the same purpose */
    #generate-plan-btn {
        display: none;
    }

    /* Show bottom nav on mobile */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #e67e22, #d35400);
        padding: 0.5rem 0.25rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
        z-index: 1000;
    }

    .mobile-bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: white;
        padding: 0.25rem 0.5rem;
        cursor: pointer;
        flex: 1;
        min-width: 0;
        gap: 0.15rem;
    }

    .mobile-bottom-nav .nav-item:hover,
    .mobile-bottom-nav .nav-item:focus {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 8px;
    }

    .mobile-bottom-nav .nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }

    .mobile-bottom-nav .nav-label {
        font-size: 0.6rem;
        font-weight: 500;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .mobile-bottom-nav .nav-item:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .mobile-bottom-nav .nav-item:disabled:hover,
    .mobile-bottom-nav .nav-item:disabled:focus {
        background: transparent;
    }


    /* Add padding to main content so it doesn't get hidden behind bottom nav */
    main.container {
        padding-bottom: 80px;
    }

    /* Adjust meal plan section actions on mobile */
    #meal-plan-section .actions {
        padding-bottom: 1rem;
    }
}

/* ===== Dish Actions (rating + delete) ===== */
.dish-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

/* Rating buttons */
.rate-btn {
    background: none !important;
    border: none !important;
    cursor: pointer;
    padding: 0.15rem !important;
    margin: 0;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem !important;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.rate-btn:hover {
    opacity: 0.95 !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

.rate-btn.up.active {
    opacity: 1 !important;
    background: rgba(76, 175, 80, 0.15) !important;
}

.rate-btn.down.active {
    opacity: 1 !important;
    background: rgba(211, 47, 47, 0.1) !important;
}

/* Swap icon in meal plan grid — span so Pico CSS button rules never apply */
.swap-btn {
    display: inline-block;
    flex-shrink: 0;
    color: #888;
    cursor: pointer;
    padding: 0.1rem 0.15rem;
    font-size: 0.65rem;
    line-height: 1;
    border-radius: 3px;
    opacity: 0.8;
    transition: opacity 0.15s, color 0.15s;
    user-select: none;
}

.swap-btn:hover {
    opacity: 1;
    color: #e67e22;
    background: rgba(230, 126, 34, 0.1);
}

.swap-hidden {
    display: none !important;
}

.cook-btn {
    flex-shrink: 0;
    color: #ccc;
    cursor: pointer;
    font-size: 0.65rem;
    line-height: 1;
    width: 14px;
    text-align: center;
    user-select: none;
    transition: color 0.15s;
    padding: 0.1rem 0;
}

.cook-btn:hover {
    color: #22c55e;
}

.cook-btn.cooked {
    color: #22c55e;
}

.dish-cooked {
    opacity: 0.45;
    text-decoration: line-through;
    text-decoration-color: #aaa;
}

/* ===== Swap Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 380px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
}

.modal-close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
    color: #aaa;
    cursor: pointer;
    border-radius: 50%;
    user-select: none;
    transition: background 0.15s, color 0.15s;
}

.modal-close-btn:hover {
    background: #f0f0f0;
    color: #555;
}

.modal-hint {
    font-size: 0.8rem;
    color: #666;
    margin: 0.5rem 1.25rem 0;
}

/* Share modal */
#share-modal .modal-box {
    max-width: 540px;
}

/* Share modal body */
.share-modal-body {
    padding: 0.85rem 1.25rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.share-url-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 0.1rem;
}

.share-url-input {
    flex: 1;
    height: 2.1rem !important;
    min-height: unset !important;
    font-size: 0.75rem !important;
    padding: 0 0.6rem !important;
    background: #f8f8f8;
    color: #555;
    cursor: default;
    margin: 0;
    min-width: 0;
    box-sizing: border-box !important;
}

.copy-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 2.1rem;
    background: #e67e22;
    color: #fff;
    border-radius: 6px;
    padding: 0 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
    box-sizing: border-box;
}

.copy-link-btn:hover {
    background: #d35400;
}

.preview-link-btn {
    background: transparent;
    border: 2px solid #e67e22;
    color: #e67e22 !important;
    text-decoration: none;
}

.preview-link-btn:hover {
    background: rgba(230, 126, 34, 0.1);
}

/* Share button in accordion header — auto-width, no fixed sizing */
.ideas-btn.share-btn {
    width: auto;
    min-width: 0;
    margin-right: 0;
    padding: 0.35rem 0.6rem;
}

.share-caption {
    font-size: 0.75rem;
    color: #666;
    margin: 0;
}

.share-expiry {
    font-size: 0.7rem;
    color: #aaa;
    margin: 0;
}

.share-copy-confirm {
    font-size: 0.75rem;
    color: #27ae60;
    margin: 0;
}


.swap-dish-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
}

.swap-dish-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.swap-dish-item:last-child {
    border-bottom: none;
}

.swap-dish-item:hover {
    background: rgba(230, 126, 34, 0.07);
}

.swap-dish-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.swap-dish-cuisine {
    font-size: 0.7rem;
    color: #999;
}

.swap-empty {
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

/* ============================================
   Shopping List Override Styles
   ============================================ */

.ingredient-item {
    display: inline-block;
    position: relative;
    vertical-align: baseline;
    margin-right: 0.1rem;
}

.ingredient-item.user-added .ingredient-name {
    color: #27ae60;
    font-style: italic;
}

.ingredient-delete-btn {
    position: absolute;
    top: -3px;
    left: 100%;
    font-size: 0.6rem;
    color: #c62828;
    cursor: pointer;
    opacity: 0;
    line-height: 1;
    padding: 1px 3px;
    border-radius: 3px;
    transition: opacity 0.15s;
    user-select: none;
    white-space: nowrap;
}

.ingredient-item:hover .ingredient-delete-btn,
.ingredient-delete-btn:focus {
    opacity: 1;
}

.ingredient-delete-btn:hover {
    background: rgba(198, 40, 40, 0.12);
}


/* Add override form */
.add-override-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e8e8e8;
    flex-wrap: nowrap;
}

.add-override-form input[type="text"],
.add-override-form select {
    font-size: 0.72rem !important;
    padding: 0.22rem 0.45rem !important;
    margin: 0 !important;
    height: 1.75rem !important;
    min-height: 0 !important;
    line-height: 1 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

.add-override-form input[type="text"] {
    flex: 1;
    min-width: 0;
}

.add-override-form select {
    width: 125px !important;
    flex-shrink: 0;
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 10 6'%3E%3Cpolyline points='1,1 5,5 9,1' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 6px center !important;
    background-size: 9px 5px !important;
    padding-right: 18px !important;
}

.add-item-btn {
    font-size: 0.7rem;
    font-weight: 600;
    color: #e67e22;
    border: 1px solid #e67e22;
    cursor: pointer;
    padding: 0.22rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
}

.add-item-btn:hover {
    background: rgba(230, 126, 34, 0.12);
}

/* ============================================
   Duplicate Dish Warning
   ============================================ */

.duplicate-warning {
    font-size: 0.7rem;
    color: #c0392b;
    margin: 0.25rem 0 0 0;
    padding: 0;
}

.duplicate-warning a {
    color: #c0392b;
    font-weight: 600;
    text-decoration: underline;
}

/* ============================================
   Last Planned Date on Dish Cards
   ============================================ */

.last-planned {
    display: block;
    font-size: 0.6rem;
    color: #aaa;
    margin-top: 1px;
}

/* ============================================
   Meal History Page
   ============================================ */

.history-page-layout {
    max-width: 900px;
    margin: 1.5rem auto 0;
    padding: 0 1rem;
}

.history-week-card {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
}

.history-week-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #444;
    margin: 0 0 0.75rem 0;
}

.history-week-detail {
    padding: 0.25rem 0 0.5rem 0;
}

.history-section-header {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #e67e22;
    margin: 0.3rem 0 0.2rem 0;
}

.history-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.history-grid-cell {
    display: flex;
    flex-direction: column;
    background: rgba(230, 126, 34, 0.06);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    min-width: 80px;
}

.history-day {
    font-size: 0.6rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
}

.history-dish {
    font-size: 0.65rem;
    color: #444;
}

/* Inspire Section (Tonight's Ideas) */
#inspire-section {
    padding: 0.75rem 1.5rem 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 45px);
}

#inspire-section .welcome-banner {
    max-width: 1100px;
    width: 100%;
}

/* Banner: text centered, plan link pinned to the right absolutely */
.inspire-banner {
    position: relative;
    text-align: center;
}

/* .nav-btn handles all styling; pin to right, inset by banner's own padding (1.5rem) */
.inspire-banner .nav-btn {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Magnifier icon (same positioning as #ingredient-search-btn) */
#inspire-search-btn {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
}

/* 3-column inspire layout — equal columns spanning the banner width */
.inspire-layout {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: flex-start;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto 0.75rem auto;
}

.inspire-search-panel,
.inspire-results-panel,
.inspire-detail-card {
    flex: 1;
    min-width: 0;
}

.inspire-detail-card {
    position: relative;
    padding-right: 2rem;
}

.inspire-detail-close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    font-size: 0.7rem;
    line-height: 1;
    color: #bbb;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    user-select: none;
}

.inspire-detail-close:hover {
    color: #555;
    background: rgba(0, 0, 0, 0.06);
}

.inspire-results-list {
    max-height: 480px;
    overflow-y: auto;
}

/* When a dish/template is selected: search+results stack in left col, detail takes right 2/3 */
@media (min-width: 769px) {
    .inspire-layout.detail-open {
        display: grid;
        grid-template-columns: 1fr 2fr;
        grid-template-rows: auto 1fr;
    }

    .inspire-layout.detail-open .inspire-search-panel {
        grid-column: 1;
        grid-row: 1;
    }

    .inspire-layout.detail-open .inspire-results-panel {
        grid-column: 1;
        grid-row: 2;
        align-self: start;
    }

    .inspire-layout.detail-open .inspire-detail-card {
        grid-column: 2;
        grid-row: 1 / 3;
    }
}

.result-section-header {
    font-size: 0.65rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    padding: 0.4rem 0.5rem 0.1rem;
    letter-spacing: 0.05em;
}

@media (max-width: 1024px) {
    #inspire-section .welcome-banner,
    .inspire-layout {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    #inspire-section {
        padding: 0.5rem 1rem 1rem 1rem;
    }

    #inspire-section .welcome-banner {
        width: 90%;
        max-width: 90%;
    }

    .inspire-banner .nav-btn {
        display: none;
    }

    .mobile-bottom-nav a.nav-item {
        text-decoration: none;
    }

    .inspire-layout {
        flex-direction: column;
        align-items: center;
        width: 90%;
        max-width: 90%;
    }

    .inspire-search-panel,
    .inspire-results-panel,
    .inspire-detail-card {
        width: 100%;
    }

    .inspire-results-list {
        max-height: 300px;
    }
}

@media (max-width: 576px) {
    #inspire-section {
        padding: 0.5rem 0.75rem 1rem 0.75rem;
    }

    #inspire-section .welcome-banner,
    .inspire-layout {
        width: 95%;
        max-width: 95%;
    }
}

/* iOS Install Modal */
.ios-install-box {
    max-width: 320px;
    text-align: left;
}

.ios-install-box h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.ios-install-steps {
    padding-left: 1.25rem;
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

.ios-share-icon {
    font-size: 1.1em;
    vertical-align: middle;
}

/* Danger Zone */
.danger-zone {
    border: 1px solid #dc2626;
    margin-top: 0.75rem;
    font-size: 0.8rem;
}

.danger-zone h3 {
    color: #dc2626;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.danger-zone p {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.delete-account-btn {
    background: none;
    border: 1px solid #dc2626;
    color: #dc2626;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    width: auto;
    min-width: auto !important;
}

.delete-account-btn:hover {
    background: #dc2626;
    color: white;
}

.delete-confirm-area {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.delete-confirm-area p {
    margin-bottom: 0;
    color: #374151;
}

.delete-confirm-area input[type="text"] {
    font-family: monospace;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.delete-confirm-btn {
    background: #dc2626;
    border: none;
    color: white;
    padding: 0.3rem 0.625rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    width: auto;
    min-width: auto !important;
}

.delete-confirm-btn:hover:not(:disabled) {
    background: #b91c1c;
}

.delete-confirm-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}