* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary color palette - Modern and sophisticated */
    --primary-color: #FF6B35;
    --primary-light: #FF8C61;
    --primary-dark: #E84A1F;
    --accent-color: #FCA311;
    --accent-hover: #F48C06;
    
    /* Neutral palette */
    --dark-bg: #1A1A2E;
    --medium-bg: #16213E;
    --light-bg: #F8F9FA;
    --white: #FFFFFF;
    
    /* Text colors */
    --text-dark: #2D2D2D;
    --text-medium: #5A5A5A;
    --text-light: #8A8A8A;
    --text-white: #FFFFFF;
    
    /* Border and dividers */
    --border-color: #E0E0E0;
    --border-accent: #FFE5D9;
    
    /* Semantic colors */
    --success-color: #52B788;
    --warning-color: #F77F00;
    --error-color: #E63946;
    --info-color: #457B9D;
    
    /* Shadows - Modern and subtle */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Component specific */
    --card-shadow: var(--shadow-md);
    --card-shadow-hover: var(--shadow-xl);
    
    /* Food-themed accents */
    --spice-orange: #FF8C42;
    --herb-green: #52B788;
    --tomato-red: #E63946;
    --curry-yellow: #FCA311;
    --olive-green: #95D5B2;
    
    /* Spacing system */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #F8F9FA 0%, #E9ECEF 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 10px;
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
}

/* Adaptive padding based on screen size */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
}

@media (min-width: 1024px) {
    body {
        padding: 30px;
    }
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--text-white);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
    pointer-events: none;
}

@media (min-width: 768px) {
    header {
        padding: 4rem 2.5rem;
    }
}

@media (min-width: 1024px) {
    header {
        padding: 4.5rem 3rem;
    }
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1::before {
    content: '🍽️ ';
    font-size: 0.9em;
}

@media (min-width: 768px) {
    header h1 {
        font-size: 3rem;
    }
}

@media (min-width: 1024px) {
    header h1 {
        font-size: 3.5rem;
    }
}

.tagline {
    font-size: 1.125rem;
    opacity: 0.95;
    font-weight: 400;
    letter-spacing: 0.01em;
    position: relative;
}

@media (min-width: 768px) {
    .tagline {
        font-size: 1.25rem;
    }
}

.controls-panel {
    padding: 2.5rem;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .controls-panel {
        padding: 3rem;
    }
}

@media (min-width: 1024px) {
    .controls-panel {
        padding: 3.5rem;
    }
}

.controls-panel h2 {
    margin-bottom: 2rem;
    color: var(--text-dark);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.controls-panel h2::before {
    content: '⚙️ ';
    font-size: 1em;
    margin-right: 0.5rem;
}

/* Multi-column layout for controls on larger screens */
@media (min-width: 1280px) {
    .controls-panel {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .controls-panel h2 {
        grid-column: 1 / -1;
    }
}

.control-group {
    margin-bottom: 1.75rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9375rem;
    letter-spacing: 0.01em;
}

.location-group {
    background: linear-gradient(135deg, #FFF9F5 0%, #FFF3E9 100%);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-accent);
    box-shadow: var(--shadow-sm);
}

.location-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

#zipcode {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    background: var(--white);
    font-family: inherit;
}

#zipcode:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.btn-small {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--primary-color);
    color: var(--text-white);
    transition: all var(--transition-base);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn-small:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-small:active {
    transform: translateY(0);
}

.location-hint {
    font-size: 0.8125rem;
    color: var(--text-light);
    font-style: normal;
}

#genre-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    font-family: inherit;
}

#genre-select:hover, #genre-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

#start-day-select, #servings-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    #start-day-select, #servings-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    font-family: inherit;
}

#start-day-select:hover, #start-day-select:focus,
#servings-select:hover, #servings-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

#complexity-slider {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-lg);
    background: linear-gradient(to right, var(--herb-green) 0%, var(--accent-color) 50%, var(--tomato-red) 100%);
    outline: none;
    -webkit-appearance: none;
    box-shadow: var(--shadow-sm);
}

#complexity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 3px solid var(--white);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

#complexity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-lg);
}

#complexity-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 3px solid var(--white);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

#meat-veggie-slider {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-lg);
    background: linear-gradient(to right, var(--herb-green) 0%, var(--curry-yellow) 50%, var(--tomato-red) 100%);
    outline: none;
    -webkit-appearance: none;
    box-shadow: var(--shadow-sm);
}

#meat-veggie-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--spice-orange);
    border: 3px solid var(--white);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

#meat-veggie-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-lg);
}

#meat-veggie-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--spice-orange);
    border: 3px solid var(--white);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.btn-primary, .btn-secondary {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-color);
    color: var(--text-white);
    width: 100%;
    box-shadow: var(--shadow-md);
}

.btn-primary::before {
    content: '🍳 ';
    font-size: 1.1em;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--accent-hover);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Blacklist Panel */
.blacklist-panel {
    padding: 2.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .blacklist-panel {
        padding: 3rem;
    }
}

@media (min-width: 1024px) {
    .blacklist-panel {
        padding: 3.5rem;
    }
}

.blacklist-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.blacklist-panel h2 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.blacklist-panel h2::before {
    content: '🚫 ';
    font-size: 1em;
    margin-right: 0.5rem;
}

.blacklist-panel.preferred-panel h2::before {
    content: '⭐ ';
    font-size: 1em;
    margin-right: 0.5rem;
}

.blacklist-panel.pantry-panel h2::before {
    content: '🥫 ';
    font-size: 1em;
    margin-right: 0.5rem;
}

.blacklist-description {
    color: var(--text-medium);
    margin-bottom: 0;
    font-size: 0.875rem;
}

.btn-history {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--white);
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    font-family: inherit;
}

.btn-history:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-view-menu {
    background: var(--herb-green);
    color: var(--text-white);
    border-color: var(--herb-green);
}

.btn-view-menu:hover {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--text-white);
}

.blacklist-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

#blacklist-input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    background: var(--white);
    font-weight: 400;
    font-family: inherit;
}

#blacklist-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

#add-blacklist-btn {
    padding: 0.875rem 2rem;
    font-size: 0.9375rem;
    white-space: nowrap;
}

.blacklist-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 60px;
    padding: 1.5rem;
    background: var(--light-bg);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
}

@media (min-width: 768px) {
    .blacklist-items {
        padding: 1.5rem;
        gap: 0.875rem;
    }
}

.blacklist-items:empty::after {
    content: "No foods yet. Add foods you don't like above.";
    color: var(--text-light);
    font-style: normal;
    width: 100%;
    text-align: center;
    padding: 1.25rem;
    font-size: 0.875rem;
}

.blacklist-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--tomato-red);
    color: var(--text-white);
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    text-transform: capitalize;
}

.blacklist-item::before {
    content: '🚫';
    font-size: 1em;
}

.blacklist-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.blacklist-item .remove-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--text-white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    transition: all var(--transition-base);
    font-weight: bold;
}

.blacklist-item .remove-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg) scale(1.1);
}

/* Preferred Ingredients Panel */
.preferred-panel {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
}

.preferred-panel h2 {
    color: var(--text-dark);
}

.preferred-item {
    background: var(--herb-green);
    box-shadow: var(--shadow-sm);
}
    text-transform: capitalize;
}

.preferred-item::before {
    content: '⭐';
    font-size: 1em;
}

.preferred-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

#preferredlist-input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    background: var(--white);
    font-weight: 400;
    font-family: inherit;
}

#preferredlist-input:focus {
    border-color: var(--herb-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.1);
}

#add-preferredlist-btn {
    padding: 0.875rem 1.75rem;
    font-size: 0.9375rem;
    white-space: nowrap;
    background: var(--herb-green);
    border: none;
    font-weight: 600;
}

#add-preferredlist-btn:hover {
    background: var(--success-color);
}

#preferredlist-items:empty::after {
    content: "No preferred foods yet. Add foods you love above.";
    color: var(--text-light);
    font-style: normal;
    width: 100%;
    text-align: center;
    padding: 1.25rem;
    font-size: 0.875rem;
}

/* Pantry Items Panel */
.pantry-panel {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
}

.pantry-panel h2 {
    color: var(--text-dark);
}

.pantry-item {
    background: var(--curry-yellow);
    box-shadow: var(--shadow-sm);
    text-transform: capitalize;
}

.pantry-item::before {
    content: '🥫';
    font-size: 1em;
}

.pantry-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

#pantrylist-input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    background: var(--white);
    font-weight: 400;
    font-family: inherit;
}

#pantrylist-input:focus {
    border-color: var(--curry-yellow);
    outline: none;
    box-shadow: 0 0 0 3px rgba(252, 163, 17, 0.1);
}

#add-pantrylist-btn {
    padding: 0.875rem 1.75rem;
    font-size: 0.9375rem;
    white-space: nowrap;
    background: var(--curry-yellow);
    border: none;
    font-weight: 600;
}

#add-pantrylist-btn:hover {
    background: var(--accent-color);
}

#pantrylist-items:empty::after {
    content: "No pantry items yet. Add items you already have above.";
    color: var(--text-light);
    font-style: normal;
    width: 100%;
    text-align: center;
    padding: 1.25rem;
    font-size: 0.875rem;
}

.pantry-note {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-top: 0.75rem;
    font-style: normal;
}

/* Generate Button Container */
.generate-button-container {
    padding: 2.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

@media (min-width: 768px) {
    .generate-button-container {
        padding: 3rem;
    }
}

.loading {
    padding: 60px 20px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.cooking-scene {
    position: relative;
    min-height: 300px;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.chef-container {
    width: 100%;
    text-align: center;
}

.chef-hat {
    font-size: 5em;
    animation: chef-cook 3s ease-in-out infinite;
    display: inline-block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.cooking-pot-container {
    position: relative;
    width: 120px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pot {
    font-size: 4em;
    animation: pot-bubble 2s ease-in-out infinite;
    display: inline-block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.steam {
    position: absolute;
    width: 10px;
    height: 50px;
    background: linear-gradient(to top, rgba(100, 150, 255, 0.4), transparent);
    border-radius: 50%;
    animation: steam-rise 2.5s ease-in-out infinite;
    bottom: 60px;
    filter: blur(2px);
}

.steam:nth-child(2) {
    left: 30%;
    animation-delay: 0.5s;
}

.steam:nth-child(3) {
    left: 50%;
    animation-delay: 0s;
}

.steam:nth-child(4) {
    left: 70%;
    animation-delay: 1s;
}

.ingredients-flying {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 10px;
}

.ingredient {
    font-size: 2.5em;
    display: inline-block;
    animation: ingredient-dance 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    cursor: default;
}

.ing1 { animation-delay: 0s; }
.ing2 { animation-delay: 0.3s; }
.ing3 { animation-delay: 0.6s; }
.ing4 { animation-delay: 0.9s; }
.ing5 { animation-delay: 1.2s; }
.ing6 { animation-delay: 1.5s; }

.loading-messages {
    width: 100%;
    margin-top: 20px;
}

.loading-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    animation: text-pulse 2s ease-in-out infinite;
}

.loading-patience {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.05));
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color), var(--accent-color));
    background-size: 200% 100%;
    animation: progress-flow 2s linear infinite;
    border-radius: 10px;
    width: 100%;
}

.loading-tip {
    color: var(--text-light);
    font-size: 1em;
    font-style: italic;
    min-height: 60px;
    animation: fade-in-out 3s ease-in-out infinite;
    padding: 0 20px;
    line-height: 1.5;
    transition: opacity 0.3s ease-in-out;
}

@keyframes chef-cook {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(-5deg); }
    75% { transform: translateY(-10px) rotate(5deg); }
}

@keyframes pot-bubble {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(-2deg); }
    50% { transform: scale(1.1) rotate(0deg); }
    75% { transform: scale(1.05) rotate(2deg); }
}

@keyframes steam-rise {
    0% {
        opacity: 0;
        transform: translateY(0) scaleX(1);
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scaleX(2);
    }
}

@keyframes ingredient-dance {
    0%, 100% { 
        transform: translateY(0) rotate(0deg) scale(1); 
    }
    25% { 
        transform: translateY(-20px) rotate(-15deg) scale(1.1); 
    }
    50% {
        transform: translateY(-10px) rotate(0deg) scale(1.05);
    }
    75% { 
        transform: translateY(-20px) rotate(15deg) scale(1.1); 
    }
}

@keyframes text-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes progress-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes fade-in-out {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Responsive loading animation */
@media (max-width: 768px) {
    .loading {
        padding: 40px 15px;
    }
    
    .cooking-scene {
        min-height: 250px;
    }
    
    .chef-hat {
        font-size: 4em;
    }
    
    .pot {
        font-size: 3em;
    }
    
    .ingredient {
        font-size: 2em;
    }
    
    .loading-title {
        font-size: 1.3em;
    }
    
    .loading-patience {
        font-size: 1em;
        padding: 10px 15px;
    }
    
    .loading-tip {
        font-size: 0.9em;
        min-height: 50px;
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .cooking-scene {
        min-height: 220px;
        gap: 15px;
    }
    
    .chef-hat {
        font-size: 3.5em;
    }
    
    .pot {
        font-size: 2.5em;
    }
    
    .ingredient {
        font-size: 1.8em;
    }
    
    .ingredients-flying {
        gap: 10px;
    }
    
    .loading-title {
        font-size: 1.2em;
    }
    
    .loading-patience {
        font-size: 0.9em;
        padding: 8px 12px;
    }
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    padding: 2.5rem;
    background: var(--light-bg);
}

@media (min-width: 768px) {
    .results {
        padding: 3rem;
    }
}

@media (min-width: 1024px) {
    .results {
        padding: 3.5rem;
    }
}

.results-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .results-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2.5rem;
    }
}

.results-header h2 {
    font-size: 1.75rem;
    color: var(--text-dark);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.results-header h2::before {
    content: '🍽️ ';
    font-size: 1em;
    margin-right: 0.5rem;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 480px) {
    .results-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

@media (min-width: 1024px) {
    .results-actions {
        gap: 0.75rem;
        flex-wrap: nowrap;
    }
}

.weekly-plan {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .weekly-plan {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Desktop: 3 columns */
@media (min-width: 1280px) {
    .weekly-plan {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Large Desktop: show more columns if there's space */
@media (min-width: 1600px) {
    .weekly-plan {
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    }
}

.day-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.day-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity var(--transition-base);
}

@media (min-width: 768px) {
    .day-card {
        padding: 1.75rem;
    }
}

@media (min-width: 1024px) {
    .day-card {
        padding: 2rem;
    }
}

.day-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.day-card:hover::before {
    opacity: 1;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.day-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.01em;
}

.day-name::before {
    content: '📅 ';
    font-size: 1em;
    margin-right: 0.25rem;
}

.recipe-title {
    font-size: 1.375rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.recipe-title::before {
    content: '🍲 ';
    font-size: 1em;
    margin-right: 0.25rem;
}

@media (min-width: 768px) {
    .recipe-title {
        font-size: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .recipe-title {
        font-size: 1.625rem;
    }
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

@media (min-width: 768px) {
    .recipe-meta {
        gap: 1rem;
    }
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.complexity-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: var(--accent-color);
    color: var(--text-white);
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-sm);
}

.advance-prep-notice {
    background: #FFF9F5;
    border-left: 4px solid var(--spice-orange);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.advance-prep-notice strong {
    color: var(--text-dark);
}

.section-title {
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.ingredients-hint {
    font-size: 0.8125rem;
    color: var(--text-medium);
    font-style: normal;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--light-bg);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.ingredients-list, .steps-list {
    list-style-position: inside;
    line-height: 1.8;
}

.cooking-icons-guide {
    background: var(--light-bg);
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 3px solid var(--primary-color);
}

.cooking-icons-guide small {
    color: var(--text-light);
    font-size: 0.8125em;
    font-weight: 500;
}

.ingredients-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.ingredient-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
    gap: 12px;
}

.ingredient-pantry-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--accent-color);
}

.ingredient-pantry-checkbox:checked + .ingredient-text {
    opacity: 0.5;
    text-decoration: line-through;
    color: var(--text-light);
}

.ingredient-text {
    flex: 1;
    transition: opacity 0.2s, color 0.2s;
}

.steps-list li {
    padding: 14px 0;
    padding-left: 12px;
    font-size: 0.9375em;
    line-height: 1.7;
    border-bottom: 1px dashed var(--border-color);
}

.steps-list li:last-child {
    border-bottom: none;
}

.regenerate-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.regenerate-header {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    font-size: 0.875em;
    letter-spacing: 0.3px;
}

.regenerate-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.regenerate-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.regenerate-row label {
    font-size: 0.9em;
    color: var(--text-light);
    font-weight: 500;
    min-width: 120px;
}

.dish-name-row {
    flex-direction: column;
    align-items: stretch;
    background: var(--light-bg);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.dish-name-row label {
    min-width: auto;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.regenerate-dish-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95em;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.regenerate-dish-input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.dish-hint {
    font-size: 0.75em;
    color: var(--text-light);
    margin-top: 6px;
    font-style: normal;
}

.regenerate-genre-select,
.regenerate-protein-select,
.regenerate-veggie-select,
.regenerate-complexity-select {
    flex: 1;
    min-width: 150px;
    padding: 10px 16px;
    font-size: 0.875em;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.regenerate-genre-select:focus,
.regenerate-protein-select:focus,
.regenerate-veggie-select:focus,
.regenerate-complexity-select:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.regenerate-notice {
    font-size: 0.85em;
    color: #e67e22;
    padding: 8px 12px;
    background: #fff3e0;
    border-radius: 6px;
    border-left: 3px solid #e67e22;
    width: 100%;
}

.btn-regenerate {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--primary-color);
    color: var(--text-white);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    font-family: inherit;
}

.btn-regenerate::before {
    content: '🔄 ';
    margin-right: 0.25rem;
}

.btn-regenerate:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: var(--primary-dark);
}

.btn-regenerate:active {
    transform: translateY(0);
}

.rating-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid var(--light-bg);
}

.rating-header {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: 0.95em;
}

.star-rating {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.star {
    font-size: 2em;
    cursor: pointer;
    transition: all 0.2s;
    color: #ddd;
}

.star:hover,
.star.filled {
    color: #ffd700;
    transform: scale(1.1);
}

.rating-notes-container {
    margin-top: 15px;
}

.rating-notes {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9em;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 10px;
}

.rating-notes:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn-submit-rating {
    padding: 10px 20px;
    font-size: 0.875em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--success-color);
    color: white;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

.btn-submit-rating:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    background: #047857;
}

/* Recipe Sign-off Styles */
.recipe-signoff-section {
    margin-top: 28px;
    padding: 24px;
    background: #f0fdf4;
    border-radius: 10px;
    border: 1px solid #bbf7d0;
}

.signoff-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 16px;
}

.recipe-signoff-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--success-color);
    flex-shrink: 0;
}

.signoff-text {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9375em;
    font-weight: 600;
    color: #065f46;
}

.signoff-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    font-size: 1.125em;
    font-weight: 700;
}

.recipe-signoff-checkbox:not(:checked) ~ .signoff-text {
    opacity: 0.6;
}

.recipe-signoff-checkbox:not(:checked) ~ .signoff-text .signoff-icon {
    background: #9ca3af;
}

/* Approved recipe card styling */
.day-card.recipe-approved {
    border-color: var(--success-color);
    background: linear-gradient(to bottom, #f0fdf4, white);
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.15);
}

.day-card.recipe-approved .day-name {
    color: var(--success-color);
}

.day-card.recipe-approved::before {
    content: '✓ APPROVED';
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--success-color);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.6875em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.day-card {
    position: relative;
}

.rating-success {
    padding: 16px;
    background: var(--success-color);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-2xl);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-2xl);
}

.close {
    position: absolute;
    right: 1.25rem;
    top: 1.25rem;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-medium);
    cursor: pointer;
    transition: all var(--transition-base);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.close:hover {
    color: var(--text-dark);
    background: var(--light-bg);
}

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    padding-right: 48px; /* Space for close button */
    font-size: 1.75rem;
    color: var(--text-dark);
    font-weight: 600;
}

.grocery-total {
    background: linear-gradient(135deg, #e74c3c 0%, #ff6b6b 50%, #f39c12 100%);
    color: white;
    padding: 36px;
    border-radius: 20px;
    margin: 24px 0;
    text-align: center;
    border: 3px solid #d68910;
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.3);
}

.total-label {
    font-size: 0.9em;
    opacity: 0.95;
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.total-label::before {
    content: '🛒 ';
    font-size: 1.3em;
}

.total-amount {
    font-size: 2.75em;
    font-weight: 700;
    margin: 12px 0;
    letter-spacing: -1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.cost-note {
    font-size: 0.8125em;
    opacity: 0.85;
    margin-top: 8px;
    font-style: normal;
}

.grocery-list {
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.grocery-category {
    margin-bottom: 25px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 16px 22px;
    border-radius: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    border: 2px solid #a93226;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2);
}

.category-name {
    font-size: 1em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.category-total {
    font-size: 1.125em;
    font-weight: 700;
}

.category-items {
    padding-left: 10px;
}

.grocery-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 2px dashed var(--border-color);
    transition: all 0.2s;
    background: white;
}

.grocery-item:hover {
    background: linear-gradient(to right, #fffaf5 0%, #fff5eb 100%);
    transform: translateX(4px);
}

.item-main {
    flex: 1;
}

.item-name {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.item-name::before {
    content: '🥫 ';
    font-size: 0.9em;
}

.item-details {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 3px;
}

.item-used {
    color: var(--secondary-color);
    font-size: 0.85em;
    font-style: italic;
}

.item-note {
    background: #fff3e0;
    color: #e67e22;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    margin-top: 8px;
    border-left: 3px solid #e67e22;
}

.item-cost {
    font-weight: bold;
    color: var(--success-color);
    font-size: 1.2em;
    margin-left: 20px;
    white-space: nowrap;
}

/* ============================================
   COMPREHENSIVE RESPONSIVE DESIGN
   ============================================ */

/* Small Mobile Devices (< 480px) */
@media (max-width: 479px) {
    .results-header h2 {
        font-size: 1.25em;
    }
    
    .recipe-title {
        font-size: 1.375em;
    }
    
    .blacklist-header-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .header-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .header-buttons .btn-history {
        width: 100%;
    }
    
    .results-actions button {
        font-size: 0.875em;
        padding: 12px 16px;
    }
    
    .btn-approve-all, .btn-finalize, .btn-publish {
        white-space: normal;
        text-align: center;
    }
}

/* Mobile Devices (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .results-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .results-actions button {
        flex: 1 1 calc(50% - 5px);
        min-width: 140px;
    }
}

/* Tablets and below (< 768px) */
@media (max-width: 767px) {
    .modal-content {
        padding: 20px;
        width: 95%;
        max-width: 95%;
    }
    
    .modal-wide {
        width: 95%;
    }
    
    .blacklist-input-group {
        flex-direction: column;
    }
    
    #blacklist-input,
    #preferredlist-input,
    #pantrylist-input {
        width: 100%;
    }
    
    #add-blacklist-btn,
    #add-preferredlist-btn,
    #add-pantrylist-btn {
        width: 100%;
    }
    
    .location-input-group {
        flex-direction: column;
    }
    
    #zipcode {
        width: 100%;
    }
    
    .btn-small {
        width: 100%;
    }
    
    .optimization-stats {
        grid-template-columns: 1fr;
    }
    
    .optimization-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .optimization-actions {
        flex-direction: column-reverse;
    }
    
    .optimization-actions button {
        width: 100%;
    }
}

/* Tablets (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .results-actions {
        flex-wrap: wrap;
    }
    
    .results-actions button {
        flex: 1 1 auto;
        min-width: 120px;
    }
    
    .container {
        border-radius: 12px;
    }
}

/* Small Desktop (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .modal-content {
        max-width: 800px;
    }
    
    .modal-wide {
        max-width: 1000px;
    }
}

/* Large Desktop (>= 1280px) */
@media (min-width: 1280px) {
    .modal-content {
        max-width: 900px;
    }
    
    .modal-wide {
        max-width: 1200px;
    }
    
    /* Show more content side-by-side */
    .recipe-meta {
        gap: 20px;
    }
}

/* Ultra-wide screens (>= 1600px) */
@media (min-width: 1600px) {
    .container {
        max-width: 1800px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 767px) and (orientation: landscape) {
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.75em;
    }
    
    .tagline {
        font-size: 1em;
    }
}

/* Print optimizations */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        max-width: 100%;
    }
    
    .controls-panel,
    .blacklist-panel,
    .loading,
    .btn-primary,
    .btn-secondary,
    .btn-history,
    .results-actions {
        display: none;
    }
    
    .weekly-plan {
        grid-template-columns: 1fr;
    }
    
    .day-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
    }
}

/* Optimization Stats Card */
.optimization-stats-card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: var(--card-shadow);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.stats-header h3 {
    color: var(--text-dark);
    font-size: 1.5em;
    margin: 0;
}

.optimization-badge {
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9375em;
    color: white;
    letter-spacing: 0.3px;
}

.waste-high {
    background: var(--success-color);
}

.waste-medium {
    background: var(--warning-color);
}

.waste-low {
    background: #ef4444;
}

.stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid var(--primary-light);
}

.stat-item-full {
    grid-column: 1 / -1;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.stat-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9em;
}

.stat-value {
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1em;
}

.reused-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.reused-ingredient {
    background: var(--primary-light);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.875em;
    font-weight: 600;
}

.stats-footer {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-style: italic;
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 16px 32px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    font-weight: 600;
    font-size: 0.9375em;
    z-index: 10000;
    transition: bottom 0.3s ease-in-out;
    max-width: 90%;
    text-align: center;
}

.notification-toast.show {
    bottom: 32px;
}

/* Recipe History Modal */
.modal-wide {
    max-width: 920px;
    max-height: 90vh;
    overflow: hidden;
    padding: 0;
    position: relative;
    background: linear-gradient(to bottom, #ffffff 0%, #fafbfc 100%);
    border: 1px solid rgba(255, 107, 53, 0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 2rem 2.5rem 1.5rem 2.5rem;
    padding-right: 4rem; /* Space for close button */
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C61 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.history-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.history-header h2 {
    margin: 0;
    font-size: 2rem;
    color: white;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.history-header h2::before {
    content: '📖 ';
    font-size: 1.8rem;
    margin-right: 0.5rem;
}

.btn-delete-all {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.btn-delete-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.9);
}

.btn-delete-all:active {
    transform: translateY(0);
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 0;
    padding: 2rem 2.5rem;
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.stat-box {
    text-align: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #FF6B35 0%, #FCA311 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-box:hover {
    border-color: rgba(255, 107, 53, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.15);
}

.stat-box:hover::before {
    opacity: 1;
}

.stat-number {
    font-size: 2.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #FF6B35 0%, #FCA311 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -1.5px;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-medium);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 1.5rem 2.5rem 2rem 2.5rem;
}

/* Custom scrollbar for history list */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #FF6B35 0%, #FCA311 100%);
    border-radius: 10px;
    transition: background 0.2s;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #E84A1F 0%, #F48C06 100%);
}

.empty-history {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #fff 0%, #fafbfc 100%);
    border-radius: 16px;
    margin: 1rem;
    border: 2px dashed rgba(255, 107, 53, 0.2);
}

.empty-history::before {
    content: '🍳';
    display: block;
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.empty-history::after {
    content: 'No recipes yet. Generate your first weekly plan!';
    display: block;
    font-size: 1.125rem;
    color: var(--text-medium);
    font-weight: 500;
    margin-top: 0.5rem;
}

.history-date-group {
    margin-bottom: 30px;
}

.history-date {
    font-size: 1.125rem;
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    padding-left: 12px;
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(90deg, rgba(255, 107, 53, 0.05) 0%, transparent 100%);
    border-radius: 0 8px 8px 0;
}

.history-recipes {
    display: grid;
    gap: 15px;
}

.history-card {
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.history-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #FF6B35 0%, #FCA311 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.history-card:hover {
    border-color: rgba(255, 107, 53, 0.3);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.12);
    transform: translateY(-2px);
}

.history-card:hover::before {
    opacity: 1;
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-card-header h4 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.btn-delete-recipe {
    background: rgba(239, 68, 68, 0.05);
    border: none;
    color: #dc2626;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-delete-recipe:hover {
    background: rgba(239, 68, 68, 0.15);
    transform: scale(1.1);
    color: #b91c1c;
}

.btn-delete-recipe:active {
    transform: scale(0.95);
}

.history-card-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: var(--text-light);
}

.history-card-rating {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.rating-good {
    color: #00b894;
}

.rating-ok {
    color: #fdcb6e;
}

.rating-poor {
    color: #d63031;
}

.history-card-notes {
    font-style: italic;
    color: var(--text-light);
    padding: 10px;
    background: var(--light-bg);
    border-radius: 6px;
    border-left: 3px solid var(--secondary-color);
    font-size: 0.9em;
}

.close-history {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    font-weight: 400;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
    line-height: 1;
}

.close-history:hover,
.close-history:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.1);
}

.close-history:active {
    transform: rotate(90deg) scale(0.95);
}

/* Optimization and Recipe Detail Modal Close Buttons */
.close-optimization,
.close-recipe-detail {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    z-index: 10;
    line-height: 1;
}

.close-optimization:hover,
.close-recipe-detail:hover {
    color: var(--text-dark);
    background: var(--light-bg);
    transform: scale(1.05);
}

.close-optimization:active,
.close-recipe-detail:active {
    transform: scale(0.95);
}

/* Modal Header with Actions */
.modal-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.modal-header-with-actions h2 {
    margin: 0;
}

.btn-copy-keep {
    padding: 10px 20px;
    font-size: 0.875em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--warning-color);
    color: white;
    transition: all 0.2s;
}

.btn-copy-keep:hover {
    background: #b45309;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

/* Publish Menu Button */
.btn-publish {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid var(--info-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--info-color);
    color: var(--text-white);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn-publish::before {
    content: '📣 ';
    margin-right: 0.25rem;
}

.btn-publish:hover {
    background: #3A6C8E;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Weekly Menu Modal - Fun Design */
.menu-modal {
    backdrop-filter: blur(5px);
}

.modal-menu {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(to bottom, white 0%, #fff5eb 100%);
    border: 4px solid var(--spice-orange);
}

.menu-hero {
    background: linear-gradient(135deg, #e74c3c 0%, #ff6b6b 50%, #f39c12 100%);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 140, 66, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, #e74c3c 0%, #ff6b6b 50%, #f39c12 100%);
    padding: 48px 40px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid var(--curry-yellow);
}

.menu-hero::before {
    content: '🍝 🍕 🍜 🍛 🥘 🌮 🍱';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    opacity: 0.1;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 30px;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.menu-hero-content {
    position: relative;
    z-index: 1;
}

.menu-icon {
    font-size: 4em;
    margin-bottom: 15px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.menu-title {
    font-size: 2.25em;
    margin: 15px 0 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
}

.menu-title::before {
    content: '🍽️ ';
}

.menu-title::after {
    content: ' 🍴';
}

.menu-subtitle {
    font-size: 1.125em;
    opacity: 0.95;
    position: relative;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.menu-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: var(--light-bg);
    flex-wrap: wrap;
}

.btn-menu-action {
    padding: 10px 20px;
    font-size: 0.875em;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: white;
    color: var(--text-dark);
    transition: all 0.2s;
}

.btn-menu-action:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--primary-color);
}

.weekly-menu-content {
    padding: 30px;
    max-height: calc(90vh - 300px);
    overflow-y: auto;
    background: white;
}

.menu-generating {
    text-align: center;
    padding: 60px 20px;
    color: #ec4899;
}

.menu-generating p {
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: 600;
}

.weekly-menu-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.menu-day-card {
    background: linear-gradient(to bottom, white 0%, #fffbf5 100%);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(243, 156, 18, 0.15);
    transition: all 0.3s;
    border: 3px solid var(--spice-orange);
}

.menu-day-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 30px rgba(231, 76, 60, 0.25);
    border-color: var(--tomato-red);
}

.animate-in {
    animation: slideIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-day-badge {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 3px solid #d68910;
}

.day-emoji {
    font-size: 1.5em;
}

.day-name {
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-card-content {
    padding: 20px;
}

.menu-dish-name {
    font-size: 1.3em;
    color: #1f2937;
    margin-bottom: 12px;
    font-weight: 700;
}

.menu-cuisine-tag {
    display: inline-block;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 2px solid #a93226;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2);
}

.menu-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    font-size: 0.95em;
}

.detail-icon {
    font-size: 1.2em;
}

.menu-prep-badge {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 4px;
    font-size: 0.9em;
    color: #92400e;
    font-weight: 600;
}

.menu-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: var(--primary-color);
    color: white;
    padding: 28px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.stat-icon {
    font-size: 2.25em;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 0.875em;
    opacity: 0.9;
}

.close-menu {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    color: white;
    font-size: 1.75rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 100;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    line-height: 1;
}

.close-menu:hover {
    transform: scale(1.05) rotate(90deg);
    background: rgba(255, 255, 255, 0.2);
}

.close-menu:active {
    transform: scale(0.95);
}

/* Print Styles - Optimized for Landscape 8.5x11" */
@media print {
    @page {
        size: letter landscape;
        margin: 0.5in;
    }
    
    body * {
        visibility: hidden;
    }
    
    #weekly-menu-modal, #weekly-menu-modal * {
        visibility: visible;
    }
    
    #weekly-menu-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: white;
        display: block !important;
    }
    
    .modal-menu {
        box-shadow: none;
        max-height: none;
        background: white;
        width: 100%;
        height: auto;
        overflow: visible;
        padding: 0;
    }
    
    .close-menu, .menu-actions {
        display: none !important;
    }
    
    /* Menu Header */
    .menu-hero {
        background: linear-gradient(135deg, var(--primary-color), var(--primary-light)) !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        padding: 15px 20px;
        margin: 0;
        page-break-after: avoid;
    }
    
    .menu-hero-content {
        display: flex;
        align-items: center;
        gap: 15px;
        justify-content: center;
    }
    
    .menu-icon {
        font-size: 2em;
    }
    
    .menu-title {
        font-size: 1.8em;
        margin: 0;
        color: white;
    }
    
    .menu-subtitle {
        display: none;
    }
    
    /* Menu Calendar - 2 columns for landscape */
    .weekly-menu-calendar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin: 15px 0;
        page-break-inside: avoid;
    }
    
    .weekly-menu-content {
        width: 100%;
    }
    
    /* Menu Day Cards */
    .menu-day-card {
        page-break-inside: avoid;
        break-inside: avoid;
        background: white;
        border: 2px solid #e5e7eb;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: none;
        margin: 0;
        height: auto;
    }
    
    .menu-day-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .animate-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .menu-day-badge {
        background: var(--accent-color) !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        color: var(--dark-bg);
        padding: 8px 12px;
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: bold;
        font-size: 0.9em;
    }
    
    .day-emoji {
        font-size: 1.2em;
    }
    
    .day-name {
        font-size: 0.85em;
    }
    
    .menu-card-content {
        padding: 12px;
    }
    
    .menu-dish-name {
        font-size: 1em;
        margin-bottom: 6px;
        line-height: 1.3;
        color: #1f2937;
    }
    
    .menu-cuisine-tag {
        background: var(--primary-color) !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        color: white;
        padding: 3px 10px;
        border-radius: 6px;
        font-size: 0.75em;
        margin-bottom: 8px;
        display: inline-block;
    }
    
    .menu-details {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.8em;
    }
    
    .menu-detail-item {
        display: flex;
        align-items: center;
        gap: 4px;
        color: #4b5563;
        font-size: 0.85em;
    }
    
    .detail-icon {
        font-size: 1em;
    }
    
    .menu-prep-badge {
        margin-top: 6px;
        padding: 4px 8px;
        background: #fef3c7 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        border-left: 3px solid #f59e0b;
        border-radius: 3px;
        font-size: 0.75em;
        color: #92400e;
    }
    
    /* Menu Stats - Compact for printing */
    .menu-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        margin-top: 15px;
        page-break-inside: avoid;
    }
    
    .stat-card {
        background: var(--primary-color) !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        color: white;
        padding: 12px;
        border-radius: 8px;
        text-align: center;
        box-shadow: none;
    }
    
    .stat-icon {
        font-size: 1.5em;
        margin-bottom: 4px;
    }
    
    .stat-value {
        font-size: 1.3em;
        font-weight: bold;
        margin-bottom: 2px;
    }
    
    .stat-label {
        font-size: 0.75em;
    }
}

/* Meal Plan Management Styles */
.btn-finalize {
    background: var(--herb-green);
    color: var(--text-white);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn-finalize::before {
    content: '✅ ';
    margin-right: 0.25rem;
}

.btn-finalize:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: var(--success-color);
}

.btn-approve-all {
    background: var(--accent-color);
    color: var(--text-white);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn-approve-all::before {
    content: '⭐ ';
    margin-right: 0.25rem;
}

.btn-approve-all:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-unapprove-all {
    background: #64748b;
    color: var(--text-white);
    border: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn-unapprove-all:hover {
    background: #475569;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-view-plans {
    background: var(--white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn-view-plans::before {
    content: '📝 ';
    margin-right: 0.25rem;
}

.btn-view-plans:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-cancel {
    background: #64748b;
    color: var(--text-white);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
}

.btn-cancel:hover {
    background: #475569;
}

.close-finalize, .close-saved-plans {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    z-index: 10;
    line-height: 1;
}

.close-finalize:hover, .close-saved-plans:hover {
    color: var(--text-dark);
    background: var(--light-bg);
    transform: scale(1.05);
}

.close-finalize:active, .close-saved-plans:active {
    transform: scale(0.95);
}

.modal-description {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 1.1em;
}

.finalize-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.9em;
}

.finalize-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.finalize-actions button {
    flex: 1;
}

/* Calendar View */
.calendar-view {
    margin-bottom: 30px;
}

.calendar-month-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
}

.calendar-month-nav button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.calendar-month-nav button:hover {
    background: #e74c3c;
}

.calendar-month-title {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-dark);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 700;
    color: var(--text-dark);
    padding: 10px;
    background: var(--light-bg);
    border-radius: 6px;
}

.calendar-day {
    min-height: 80px;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.calendar-day:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.calendar-day.other-month {
    opacity: 0.3;
    background: #f9fafb;
}

.calendar-day.has-plan {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: #10b981;
}

.calendar-day.has-plan:hover {
    border-color: #059669;
}

.calendar-day-number {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.calendar-day-plan {
    font-size: 0.85em;
    color: #059669;
    font-weight: 600;
    margin-top: 5px;
}

/* Saved Plans List */
.saved-plans-list {
    margin-top: 20px;
}

.saved-plan-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.saved-plan-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.saved-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.saved-plan-title {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-dark);
}

.saved-plan-date {
    color: var(--text-light);
    font-size: 0.95em;
}

.saved-plan-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-view-plan,
.btn-view-menu-plan,
.btn-edit-plan,
.btn-delete-plan {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s;
}

.btn-view-menu-plan {
    background: #10b981;
    color: white;
}

.btn-view-menu-plan:hover {
    background: #059669;
}

.btn-view-plan {
    background: #3b82f6;
    color: white;
}

.btn-view-plan:hover {
    background: #2563eb;
}

.btn-edit-plan {
    background: #f59e0b;
    color: white;
}

.btn-edit-plan:hover {
    background: #d97706;
}

.btn-delete-plan {
    background: #ef4444;
    color: white;
}

.btn-delete-plan:hover {
    background: #dc2626;
}

.saved-plan-meals {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.saved-meal-item {
    padding: 10px;
    background: var(--light-bg);
    border-radius: 6px;
    font-size: 0.9em;
}

.saved-meal-day {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.saved-meal-name {
    color: var(--text-dark);
}

.no-plans-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-plans-message .big-emoji {
    font-size: 4em;
    margin-bottom: 20px;
}

.no-plans-message p {
    font-size: 1.2em;
}

/* Optimization Modal Styles */
.modal-optimization {
    max-width: 700px;
}

.optimization-loading {
    text-align: center;
    padding: 60px 20px;
}

.optimization-loading .spinner {
    border: 4px solid var(--light-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.optimization-loading p {
    color: var(--text-light);
    font-size: 1.1em;
}

.optimization-summary-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.optimization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.optimization-header h3 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.4em;
}

.optimization-score {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1em;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.optimization-score.score-high {
    background: var(--success-color);
}

.optimization-score.score-medium {
    background: var(--warning-color);
}

.optimization-score.score-low {
    background: #ef4444;
}

.optimization-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.opt-stat {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    text-align: center;
}

.opt-stat-label {
    font-size: 0.85em;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 600;
}

.opt-stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
}

.optimization-potential {
    background: var(--primary-color);
    color: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9375em;
}

.optimization-potential strong {
    font-size: 1.125em;
}

.optimization-suggestions h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    background: white;
    border-left: 4px solid var(--border-color);
}

.suggestion-item.warning {
    border-left-color: #f39c12;
    background: #fff9f0;
}

.suggestion-item.tip {
    border-left-color: #00b894;
    background: #f0fdf8;
}

.suggestion-item.info {
    border-left-color: #0984e3;
    background: #f0f8ff;
}

.suggestion-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.suggestion-content {
    flex: 1;
}

.suggestion-title {
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 5px;
    font-size: 1em;
}

.suggestion-description {
    color: var(--text-light);
    font-size: 0.9em;
    line-height: 1.5;
}

.suggestion-impact {
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    font-size: 0.85em;
    color: var(--text-dark);
    font-weight: 600;
}

.no-suggestions {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 1.1em;
}

.optimization-error {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.optimization-error p {
    margin: 0;
    color: #856404;
    font-size: 1.05em;
}

.optimization-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    justify-content: flex-end;
}

.optimization-actions .btn-primary,
.optimization-actions .btn-secondary {
    padding: 12px 24px;
    font-size: 1em;
}

/* ============================================
   RECIPE DETAIL MODAL WITH TIMERS
   ============================================ */

.recipe-modal {
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-recipe-detail {
    max-width: 1400px;
    width: 92%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 0;
    background: var(--light-bg);
    margin: auto;
}

.recipe-detail-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.recipe-detail-title {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.recipe-detail-day {
    font-size: 1.125em;
    opacity: 0.9;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.recipe-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    gap: 12px;
    align-items: center;
}

.meta-icon {
    font-size: 1.75em;
    flex-shrink: 0;
}

.meta-text {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75em;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 1em;
    font-weight: 700;
    color: var(--text-dark);
}

.recipe-detail-prep-notice {
    display: flex;
    gap: 16px;
    background: #fff3e0;
    border-left: 4px solid var(--warning-color);
    padding: 20px 32px;
    margin: 0;
    align-items: flex-start;
}

.prep-notice-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.prep-notice-content strong {
    display: block;
    color: #92400e;
    margin-bottom: 8px;
    font-size: 1.05em;
}

.prep-notice-content p {
    margin: 0;
    color: #78350f;
    line-height: 1.6;
}

.recipe-detail-progress {
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.progress-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
    border-radius: 8px;
}

.progress-text {
    font-size: 0.875em;
    color: var(--text-light);
    font-weight: 500;
}

.recipe-detail-section {
    padding: 32px;
    background: white;
    margin: 16px 0;
}

.recipe-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    color: var(--text-dark);
    font-size: 1.5em;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.section-icon {
    margin-right: 12px;
    font-size: 1.2em;
}

.btn-collapse-all {
    padding: 8px 16px;
    font-size: 0.75em;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-dark);
    transition: all 0.2s;
}

.btn-collapse-all:hover {
    background: var(--border-color);
}

.ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

/* Optimize for larger screens */
@media (min-width: 1200px) {
    .ingredients-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
}

@media (min-width: 1600px) {
    .ingredients-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.ingredient-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--light-bg);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    transition: all 0.2s;
}

.ingredient-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ingredient-amount {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05em;
}

.ingredient-name {
    color: var(--text-dark);
    font-size: 0.95em;
}

.ingredient-cost {
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.875em;
}

.cooking-tip {
    background: #f0f9ff;
    border-left: 3px solid #0284c7;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 0.9em;
    color: #075985;
    font-weight: 500;
}

.steps-detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-detail-item {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.step-detail-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.step-detail-item.step-expanded {
    border-color: var(--primary-color);
}

.step-detail-item.step-expanded .step-expand-icon {
    transform: rotate(180deg);
}

.step-detail-item.step-expanded .step-content {
    max-height: 2000px;
    padding: 20px 24px;
    opacity: 1;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    background: var(--light-bg);
    transition: all 0.2s;
}

.step-header:hover {
    background: #e8ecef;
}

.step-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.step-checkbox {
    cursor: pointer;
    width: 24px;
    height: 24px;
    accent-color: var(--success-color);
}

.step-checkbox:checked + .step-number {
    background: var(--success-color);
    color: white;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.125em;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.step-summary {
    flex: 1;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.95em;
}

.step-expand-icon {
    font-size: 0.875em;
    color: var(--text-light);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.step-content {
    max-height: 0;
    padding: 0 24px;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-full-text {
    font-size: 1.05em;
    line-height: 1.8;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.step-timer-section {
    margin-top: 20px;
    padding: 20px;
    background: var(--light-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.timer-controls {
    display: flex;
    justify-content: center;
}

.btn-start-timer {
    padding: 14px 32px;
    font-size: 1.05em;
    font-weight: 600;
    background: var(--accent-color);
    color: var(--dark-bg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-start-timer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.35);
    background: var(--accent-hover);
}

.timer-icon {
    font-size: 1.3em;
}

.timer-display {
    text-align: center;
}

.timer-time {
    font-size: 3.5em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    transition: all 0.3s;
}

.timer-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-timer-action {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-timer-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-timer-stop {
    background: #e74c3c;
}

.btn-timer-stop:hover {
    background: #c0392b;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.recipe-detail-footer {
    padding: 24px 32px;
    background: white;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
    position: sticky;
    bottom: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.btn-recipe-done {
    padding: 16px 48px;
    font-size: 1.125em;
    font-weight: 700;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-recipe-done:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
    background: #047857;
}

/* Responsive design for recipe detail */
@media (max-width: 767px) {
    .modal-recipe-detail {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .recipe-detail-header,
    .recipe-detail-progress,
    .recipe-detail-section,
    .recipe-detail-footer {
        padding: 20px;
    }
    
    .recipe-detail-prep-notice {
        padding: 16px 20px;
    }
    
    .recipe-detail-title {
        font-size: 1.5em;
    }
    
    .recipe-detail-meta {
        grid-template-columns: repeat(2, 1fr);
        padding: 20px;
        gap: 12px;
    }
    
    .meta-icon {
        font-size: 1.5em;
    }
    
    .ingredients-grid {
        grid-template-columns: 1fr;
    }
    
    .recipe-section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .btn-collapse-all {
        width: 100%;
    }
    
    .step-header {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 1em;
    }
    
    .step-checkbox {
        width: 20px;
        height: 20px;
    }
    
    .step-summary {
        font-size: 0.875em;
    }
    
    .step-full-text {
        font-size: 0.95em;
    }
    
    .timer-time {
        font-size: 2.5em;
    }
    
    .btn-recipe-done {
        width: 100%;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .ingredients-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
