/* Meal of Life - Modern Styles */

:root {
    /* Safe area insets for mobile devices (notches, home indicators) */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);

    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --accent-blue: #3b82f6;
    --accent-orange: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --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);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Top Navigation Bar */
.top-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.top-bar-content {
    padding: 12px 20px;
    padding-top: calc(12px + var(--safe-area-top));
    padding-left: calc(20px + var(--safe-area-left));
    padding-right: calc(20px + var(--safe-area-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

/* Hamburger Menu */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.hamburger-menu:hover {
    background: var(--background);
}

.hamburger-menu span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all 0.2s ease;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 200;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
}

.menu-item:hover {
    background: var(--background);
}

.menu-item:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.menu-item:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.menu-item:only-child {
    border-radius: var(--radius);
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 3% 40px;
}

/* Main Layout - Two Column */
.main-layout {
    display: flex;
    gap: 24px;
    align-items: stretch;
    min-height: calc(100vh - 120px);
}

.meal-planning {
    flex: 0 0 70%;
    max-width: 70%;
    overflow-y: auto;
}

/* Week Calendar Sidebar */
.week-calendar {
    flex: 0 0 calc(30% - 24px);
    width: calc(30% - 24px);
    position: sticky;
    top: 80px;
    height: calc(100vh - 120px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.week-calendar h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.btn-clear-all {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    opacity: 0.6;
}

.btn-clear-all:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.day-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.day-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    background: var(--background);
    border-radius: var(--radius);
    transition: all 0.15s ease;
    border: 2px solid transparent;
    flex: 1;
    min-height: 50px;
    gap: 12px;
}

.day-item-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 0 55px;
    width: 55px;
}

.day-meal-slot {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.day-item:hover {
    background: rgba(99, 102, 241, 0.03);
}

/* When touch dragging, show all valid drop targets with dotted outline */
body.touch-dragging .day-item:not(.past) {
    border: 2px dashed var(--primary-color);
    background: rgba(99, 102, 241, 0.03);
}

/* When hovering over a specific day, make it solid and thicker */
.day-item.drag-over:not(.past) {
    border: 3px solid var(--primary-color) !important;
    background: rgba(99, 102, 241, 0.12) !important;
}

.day-item.today {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary-light);
}

.day-item.today .day-name {
    color: var(--primary-color);
    font-weight: 600;
}

.day-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.day-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* Assigned meal in day slot */
.day-meal {
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--surface);
    padding: 6px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    width: 100%;
    cursor: grab;
    transition: all 0.15s ease;
}

.day-meal:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.day-meal:active {
    cursor: grabbing;
}

.day-meal.dragging {
    opacity: 0.5;
}

.day-meal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.day-meal-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-meal-details {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-meal-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    font-size: 0.75rem;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.day-meal-remove:hover {
    opacity: 1;
    color: #ef4444;
}

.day-empty {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.6;
}

/* Draggable meal cards */
.meal-card.draggable,
.base-meal-card.draggable {
    cursor: grab;
}

.meal-card.draggable:active,
.base-meal-card.draggable:active {
    cursor: grabbing;
}

.meal-card.dragging,
.base-meal-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

/* Touch hold visual feedback - shows drag mode is active */
.meal-card.touch-hold,
.base-meal-card.touch-hold,
.day-meal.touch-hold {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.btn-text:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Week Plan Section */
.week-plan {
    margin-bottom: 24px;
}

.week-plan > .section-header {
    margin-bottom: 20px;
}

.week-plan > .section-header h2 {
    font-size: 1.25rem;
}

/* Meal Cards */
.meal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s ease;
}

.meal-card:hover {
    box-shadow: var(--shadow-md);
}

/* Meal card assigned to a day in the week calendar - muted appearance */
.meal-card.assigned-to-day {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.meal-card.assigned-to-day .searchable-select-input {
    background: #e2e8f0;
}

.meal-card.assigned-to-day .meal-item-text,
.meal-card.assigned-to-day .meal-card-title {
    color: var(--text-secondary);
}

.meal-card.required {
    border-left: 3px solid var(--primary-color);
}

.meal-card.extra {
    border-left: 3px solid var(--secondary-color);
    padding: 16px;
}

.meal-card.extra .meal-options {
    max-width: 100%;
}

.meal-card.extra .meal-select {
    max-width: 100%;
    box-sizing: border-box;
}

.meal-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.meal-card-title h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.meal-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.meal-card h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.meal-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--background);
    border-radius: var(--radius);
}

.meal-item .label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 80px;
}

/* Dropdown Selects */
.meal-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 0;
}

.meal-select:hover {
    border-color: var(--primary-light);
}

.meal-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.category-select {
    padding: 6px 10px;
    border: 1px solid var(--secondary-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

.category-select:hover {
    background: rgba(16, 185, 129, 0.05);
}

.category-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

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

.meal-card-header .btn-shuffle-small {
    position: static;
}

.meal-card-header h4 {
    margin: 0;
}

.meal-card-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.btn-remove-small {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    opacity: 0.4;
    transition: all 0.15s ease;
    color: #ef4444;
}

.btn-remove-small:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* Base Meal Cards (multiple base meals) */
.base-meal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    transition: box-shadow 0.2s ease;
}

.base-meal-card:hover {
    box-shadow: var(--shadow-md);
}

.base-meal-card.assigned-to-day {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.base-meal-card.assigned-to-day .searchable-select-input {
    background: #e2e8f0;
}

.base-meal-card.assigned-to-day .base-meal-title {
    color: var(--text-secondary);
}

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

.base-meal-header h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.base-meal-content {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.base-meal-card .meal-item {
    flex: 1;
    min-width: 120px;
    padding: 8px 10px;
    margin: 0;
    gap: 8px;
}

.base-meal-card .meal-item .label {
    min-width: auto;
    font-size: 0.875rem;
}

.base-meal-card .meal-select {
    padding: 6px 10px;
    font-size: 0.875rem;
}

/* Add Base Meal Card */
.add-base-meal-card {
    background: var(--surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 12px;
}

.add-base-meal-card:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.02);
}

.add-base-meal-card .add-meal-icon {
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* Add Meal Card */
.add-meal-card {
    background: var(--surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 80px;
}

.add-meal-card:hover {
    border-color: var(--secondary-color);
    background: rgba(16, 185, 129, 0.02);
}

.add-meal-icon {
    font-size: 1.5rem;
    color: var(--secondary-color);
    font-weight: 300;
    line-height: 1;
}

.add-meal-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.meal-options {
    margin-top: 8px;
}

.stir-fry-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.with-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.meal-detail {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Shuffle Buttons */
.btn-shuffle {
    background: var(--primary-color);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: white;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.btn-shuffle:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-shuffle-small {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    opacity: 0.5;
    transition: all 0.15s ease;
}

.btn-shuffle-small:hover {
    opacity: 1;
    background: var(--background);
}

/* Extra Meals Container */
.extra-meals {
    margin-top: 24px;
}

.extra-meals > .section-header {
    margin-bottom: 12px;
}

#extraMealsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

/* Collapsible Sections */
.collapsible {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-bottom: 0;
    transition: all 0.15s ease;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* When expanded, remove bottom radius from header */
.mix-it-up:not(.collapsed) .collapsible,
.bulk-cook:not(.collapsed) .collapsible {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    box-shadow: none;
}

.collapsible:hover {
    background: var(--background);
}

.toggle-icon {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 300;
    transition: transform 0.2s ease;
}

.collapsed .toggle-icon {
    transform: rotate(0deg);
}

.mix-it-up:not(.collapsed) .toggle-icon,
.bulk-cook:not(.collapsed) .toggle-icon {
    transform: rotate(45deg);
}

.collapsed .mix-it-up-content,
.collapsed .bulk-cook-content {
    display: none;
}

/* Mix It Up Section */
.mix-it-up,
.bulk-cook {
    margin-bottom: 12px;
}

.mix-it-up-content,
.bulk-cook-content {
    background: var(--surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    border-top: none;
}

/* Mix It Up Search */
.mix-it-up-search,
.bulk-search {
    margin-bottom: 16px;
}

.mix-it-up-search input,
.bulk-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.15s ease;
    background: var(--background);
}

.mix-it-up-search input:focus,
.bulk-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--surface);
}

.mix-it-up-search input::placeholder,
.bulk-search input::placeholder {
    color: var(--text-muted);
}

/* Idea Grid */
.idea-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.idea-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--background);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 12px;
    border: 1px solid transparent;
}

.idea-item span {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
}

.idea-item:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary-light);
}

.idea-item:active {
    transform: scale(0.99);
}

.idea-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.btn-add {
    background: var(--secondary-color);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-add:hover {
    background: var(--secondary-dark);
    transform: scale(1.1);
}

/* Bulk Cook Grid */
.bulk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 8px;
}

.bulk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--background);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 12px;
    border: 1px solid transparent;
}

.bulk-item:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--accent-blue);
}

.bulk-item:active {
    transform: scale(0.99);
}

.bulk-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.bulk-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.bulk-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-add-bulk {
    background: var(--accent-blue);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-add-bulk:hover {
    background: #2563eb;
    transform: scale(1.1);
}

/* Freezer Inventory */
.freezer-inventory {
    margin-bottom: 12px;
}

.freezer-inventory:not(.collapsed) .collapsible {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    box-shadow: none;
}

.freezer-inventory:not(.collapsed) .toggle-icon {
    transform: rotate(45deg);
}

.collapsed .freezer-inventory-content {
    display: none;
}

.freezer-inventory-content {
    background: var(--surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    border-top: none;
}

.freezer-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.freezer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}

.freezer-item:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--accent-blue);
}

.freezer-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.freezer-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.freezer-item-qty {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.freezer-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-freezer-use {
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-freezer-use:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

.btn-freezer-use:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-freezer-add {
    width: 28px;
    height: 28px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-freezer-add:hover {
    background: var(--border);
    transform: scale(1.05);
}

.freezer-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

.freezer-hint {
    font-size: 0.85rem;
    margin-top: 8px;
}

.bulk-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.btn-add-freezer {
    background: var(--accent-cyan);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-add-freezer:hover {
    background: #0891b2;
    transform: scale(1.02);
}

/* Staple Tracker */
.staple-tracker {
    margin-bottom: 12px;
}

.staple-tracker:not(.collapsed) .collapsible {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    box-shadow: none;
}

.staple-tracker:not(.collapsed) .toggle-icon {
    transform: rotate(45deg);
}

.collapsed .staple-tracker-content {
    display: none;
}

.staple-tracker-content {
    background: var(--surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    border-top: none;
}

.staple-alert {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.alert-icon {
    font-size: 1.1rem;
}

.staple-category {
    margin-bottom: 16px;
}

.staple-category-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.staple-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.staple-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}

.staple-item:hover {
    border-color: var(--primary-color);
}

.staple-item.low {
    border-color: #f59e0b;
    background: #fffbeb;
}

.staple-name {
    font-weight: 500;
    font-size: 0.875rem;
    flex: 1;
}

.staple-quantity {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-qty {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-qty:hover {
    background: var(--border);
}

.staple-qty-input {
    width: 50px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px;
    font-size: 0.875rem;
}

.staple-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 50px;
}

.low-badge {
    background: #f59e0b;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 500;
}

.staple-actions {
    margin-top: 16px;
    text-align: center;
}

/* Grocery List */
.grocery-list {
    margin-bottom: 12px;
}

.grocery-list:not(.collapsed) .collapsible {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    box-shadow: none;
}

.grocery-list:not(.collapsed) .toggle-icon {
    transform: rotate(45deg);
}

.collapsed .grocery-list-content {
    display: none;
}

.grocery-list-content {
    background: var(--surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    border-top: none;
}

.grocery-date-range {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.grocery-date-range label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.grocery-date-range input[type="date"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}

.grocery-list-items {
    margin-bottom: 16px;
}

.grocery-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

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

.grocery-item:hover {
    background: var(--background);
}

.grocery-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.grocery-item.checked .grocery-item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.grocery-item-name {
    flex: 1;
    font-size: 0.9rem;
}

.grocery-item-source {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--background);
    padding: 2px 8px;
    border-radius: 4px;
}

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

.grocery-category-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grocery-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.grocery-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grocery-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

.grocery-empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.grocery-teaser-blur {
    position: relative;
}

.grocery-teaser-blur::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--surface));
    pointer-events: none;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Searchable Select within Cards */
.searchable-select-container {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--background);
    cursor: text;
    transition: all 0.15s ease;
}

.searchable-select-input:hover {
    border-color: var(--secondary-color);
}

.searchable-select-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.searchable-select-input.bulk {
    border-color: var(--border-color);
}

.searchable-select-input.bulk:hover {
    border-color: var(--accent-blue);
}

.searchable-select-input.bulk:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.searchable-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.searchable-dropdown.open {
    display: block;
}

/* When a dropdown is open, elevate the entire card above others */
.extra-meal-card:has(.searchable-dropdown.open),
.base-meal-card:has(.searchable-dropdown.open),
.meal-card:has(.searchable-dropdown.open) {
    z-index: 200;
    position: relative;
}

.searchable-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s ease;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.searchable-option:last-child {
    border-bottom: none;
}

.searchable-option:hover {
    background: rgba(16, 185, 129, 0.05);
}

.searchable-option.selected {
    background: rgba(16, 185, 129, 0.1);
    font-weight: 500;
}

.searchable-option .option-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
}

.searchable-option .option-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.searchable-option.no-results {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.searchable-option.no-results:hover {
    background: transparent;
}

/* Category searchable select in header */
.category-container {
    flex: 1;
    min-width: 0;
}

.category-input {
    font-weight: 600;
    padding: 8px 12px;
}

/* Base meal searchable selects - compact styling */
.base-meal-content .searchable-select-container {
    flex: 1;
}

.base-meal-content .searchable-select-input {
    padding: 8px 10px;
}

.base-meal-content .searchable-dropdown {
    max-height: 180px;
}

/* Stir fry options layout */
.stir-fry-options .searchable-select-container {
    flex: 1;
}

/* Bulk Cook card description */
.bulk-description {
    margin-top: 8px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Card type styling */
.mix-it-up-card {
    border-left: 3px solid var(--accent-orange);
}

.mix-it-up-card h4 {
    color: var(--accent-orange);
}

.bulk-cook-card {
    border-left: 3px solid var(--accent-blue);
}

.bulk-cook-card h4 {
    color: var(--accent-blue);
}

.bulk-cook-card .searchable-option:hover {
    background: rgba(59, 130, 246, 0.05);
}

.bulk-cook-card .searchable-option.selected {
    background: rgba(59, 130, 246, 0.1);
}

/* Responsive */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }

    .meal-planning {
        flex: 1;
        max-width: 100%;
    }

    .week-calendar {
        flex: 1;
        width: 100%;
        position: static;
        order: -1;
        margin-bottom: 24px;
    }

    .day-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .day-item {
        flex: 1;
        min-width: calc(25% - 8px);
        flex-direction: column;
        gap: 4px;
        text-align: center;
        padding: 10px 8px;
    }
}

@media (max-width: 600px) {
    .top-bar-content {
        padding: 10px 16px;
    }

    .top-bar h1 {
        font-size: 1.125rem;
    }

    .container {
        padding: 16px;
    }

    .meal-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .meal-item .label {
        min-width: auto;
    }

    /* Base meal card mobile - keep items horizontal but narrower */
    .base-meal-card .meal-item {
        flex-direction: row;
        align-items: center;
        min-width: 100%;
    }

    /* Shrink base meal content to make room for assign button */
    .base-meal-card .base-meal-content {
        padding-right: 40px;
    }

    /* Shrink searchable selects to avoid assign button */
    .meal-card .searchable-select-container {
        width: calc(100% - 44px);
    }

    .idea-grid,
    .bulk-grid,
    #extraMealsContainer {
        grid-template-columns: 1fr;
    }

    .day-item {
        min-width: calc(33.33% - 8px);
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Help Wizard Overlay */
.wizard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.wizard-overlay.open {
    opacity: 1;
    visibility: visible;
}

.wizard-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: wizardSlideUp 0.3s ease;
}

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

.wizard-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    z-index: 10;
}

.wizard-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.wizard-progress {
    height: 4px;
    background: var(--background);
    flex-shrink: 0;
}

.wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

.wizard-content {
    padding: 40px 32px 24px;
    flex: 1;
    overflow-y: auto;
    text-align: center;
}

.wizard-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: wizardIconBounce 0.5s ease;
}

@keyframes wizardIconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.wizard-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.025em;
}

.wizard-body {
    text-align: left;
    color: var(--text-secondary);
    line-height: 1.7;
}

.wizard-body p {
    margin-bottom: 16px;
}

.wizard-body p:last-child {
    margin-bottom: 0;
}

.wizard-body strong {
    color: var(--text-primary);
}

/* Wizard List */
.wizard-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.wizard-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--background);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.wizard-list-item .item-icon {
    flex-shrink: 0;
}

/* Wizard Note */
.wizard-note {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary-color);
    padding: 12px 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-top: 16px;
}

/* Wizard Example */
.wizard-example {
    background: var(--background);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.example-meal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    font-weight: 500;
    color: var(--text-primary);
}

.example-meal span:nth-child(2),
.example-meal span:nth-child(4) {
    color: var(--text-muted);
    font-weight: 400;
}

/* Wizard Pairings */
.wizard-pairings {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.pairing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--background);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.pairing .veg {
    font-weight: 600;
    color: var(--secondary-color);
    min-width: 80px;
}

.pairing .arrow {
    color: var(--text-muted);
}

.pairing .meals {
    color: var(--text-primary);
}

/* Wizard Tip */
.wizard-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-top: 16px;
}

.wizard-tip .tip-icon {
    flex-shrink: 0;
    font-size: 1.125rem;
}

.wizard-tip span:last-child {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Wizard Demo */
.wizard-demo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.demo-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--secondary-color);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-weight: 500;
    box-shadow: var(--shadow);
}

.demo-arrow {
    font-size: 1.25rem;
    color: var(--primary-color);
    animation: arrowPulse 1.5s ease infinite;
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.5; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(4px); }
}

.demo-day {
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-weight: 500;
    color: var(--primary-color);
}

/* Wizard Summary Steps */
.wizard-steps-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.summary-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--background);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Wizard Navigation */
.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--background);
}

.wizard-dots {
    display: flex;
    gap: 8px;
}

.wizard-dot {
    width: 8px;
    height: 8px;
    background: var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wizard-dot:hover {
    background: var(--text-muted);
}

.wizard-dot.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

.wizard-btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wizard-btn-primary {
    background: var(--primary-color);
    color: white;
}

.wizard-btn-primary:hover {
    background: var(--primary-dark);
}

.wizard-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
}

.wizard-btn-secondary:hover {
    background: var(--surface);
    color: var(--text-primary);
}

/* Wizard Highlight Effect */
.wizard-highlight {
    position: relative;
    z-index: 999;
    box-shadow: 0 0 0 4px var(--primary-color), 0 0 20px rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
}

/* Responsive Wizard */
@media (max-width: 600px) {
    .wizard-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: max(20px, env(safe-area-inset-top));
    }

    .wizard-container {
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px);
    }

    .wizard-content {
        padding: 28px 16px 16px;
    }

    .wizard-icon {
        font-size: 2.5rem;
        margin-bottom: 12px;
    }

    .wizard-title {
        font-size: 1.125rem;
        margin-bottom: 14px;
    }

    .wizard-body {
        font-size: 0.875rem;
        line-height: 1.6;
    }

    .wizard-body p {
        margin-bottom: 12px;
    }

    .wizard-list {
        grid-template-columns: 1fr;
        gap: 6px;
        margin: 12px 0;
    }

    .wizard-list-item {
        padding: 8px 10px;
        font-size: 0.8125rem;
    }

    .wizard-note {
        padding: 10px 12px;
        font-size: 0.8125rem;
        margin-top: 12px;
    }

    .wizard-example {
        padding: 14px;
        margin: 12px 0;
    }

    .example-meal {
        gap: 6px;
        font-size: 0.875rem;
    }

    .example-meal span {
        white-space: nowrap;
    }

    .wizard-pairings {
        gap: 6px;
        margin: 12px 0;
    }

    .pairing {
        padding: 8px 10px;
        font-size: 0.8125rem;
        gap: 8px;
    }

    .pairing .veg {
        min-width: 65px;
        font-size: 0.75rem;
    }

    .wizard-tip {
        padding: 10px 12px;
        margin-top: 12px;
        gap: 8px;
    }

    .wizard-tip .tip-icon {
        font-size: 1rem;
    }

    .wizard-tip span:last-child {
        font-size: 0.8125rem;
    }

    .wizard-demo {
        gap: 10px;
        margin: 14px 0;
    }

    .demo-card {
        padding: 10px 12px;
        font-size: 0.8125rem;
    }

    .demo-day {
        padding: 10px 14px;
        font-size: 0.8125rem;
    }

    .demo-arrow {
        font-size: 1rem;
    }

    .wizard-steps-summary {
        gap: 8px;
        margin: 14px 0;
    }

    .summary-step {
        padding: 10px 12px;
        font-size: 0.8125rem;
        gap: 10px;
    }

    .step-num {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .wizard-nav {
        padding: 12px 16px 20px;
        gap: 8px;
    }

    .wizard-dots {
        gap: 6px;
    }

    .wizard-dot {
        width: 8px;
        height: 8px;
        padding: 6px;
    }

    .wizard-btn {
        padding: 10px 16px;
        font-size: 0.875rem;
    }

    .wizard-close {
        top: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
}

/* =====================================================
   MOBILE ENHANCEMENTS
   ===================================================== */

/* Increase touch target sizes */
.btn-shuffle-small,
.btn-remove-small {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-meal-remove {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-all {
    width: 44px;
    height: 44px;
}

/* Wizard touch targets - only on larger screens where the 44px rule doesn't conflict */
@media (min-width: 601px) {
    .wizard-close {
        width: 44px;
        height: 44px;
    }

    .wizard-dot {
        width: 12px;
        height: 12px;
        padding: 8px;
        box-sizing: content-box;
    }
}

/* Safe area support for notched phones */
@supports (padding: env(safe-area-inset-top)) {
    .top-bar {
        padding-top: env(safe-area-inset-top);
    }

    .container {
        padding-bottom: max(40px, env(safe-area-inset-bottom));
        padding-left: max(3%, env(safe-area-inset-left));
        padding-right: max(3%, env(safe-area-inset-right));
    }

    /* Adjust sticky calendar position for notched phones */
    @media (max-width: 600px) {
        .week-calendar {
            top: calc(53px + env(safe-area-inset-top));
        }
    }
}

/* Old mobile week calendar styles removed - now using collapsible bottom sheet */

/* Touch drag clone styling */
.touch-drag-clone {
    background: var(--surface);
    border: 2px solid var(--primary-color);
    color: var(--text-primary);
}

/* =====================================================
   MOBILE DRAG HANDLE
   ===================================================== */

/* Drag handle button - hidden on desktop, shown on mobile */
.btn-drag-handle {
    display: none;
}

@media (max-width: 600px) {
    .btn-drag-handle {
        display: flex;
        flex-direction: column;
        position: absolute;
        bottom: 8px;
        right: 8px;
        width: 48px;
        height: 48px;
        align-items: center;
        justify-content: center;
        gap: 2px;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 50%;
        cursor: grab;
        /* Allow scrolling - drag only activates after hold */
        touch-action: auto;
        transition: all 0.15s ease;
        z-index: 5;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .btn-drag-handle .drag-calendar {
        font-size: 1rem;
        line-height: 1;
    }

    .btn-drag-handle .drag-grip {
        font-size: 0.6rem;
        letter-spacing: 1px;
        opacity: 0.9;
    }

    .btn-drag-handle:active,
    .btn-drag-handle.touch-active {
        transform: scale(1.1);
        background: var(--primary-dark);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    }

    /* Need relative positioning on cards for absolute button */
    .meal-card {
        position: relative;
        padding-bottom: 56px;
    }

    /* Base meal card - button sits inline with content, less padding needed */
    .base-meal-card {
        position: relative;
        padding-bottom: 12px;
    }

    .base-meal-card .btn-drag-handle {
        bottom: 12px;
    }
}

/* =====================================================
   MEAL PLACEMENT MODE - Week Calendar
   ===================================================== */

/* Floating meal preview (appended to body) */
.placement-meal-preview {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    background: var(--surface);
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    border: 2px solid var(--primary-color);
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.placement-meal-preview .preview-emoji {
    font-size: 1.5rem;
}

.placement-meal-preview .preview-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.placement-meal-preview .preview-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Placement mode - dotted outlines on valid days */
body.placement-mode .day-item:not(.past) {
    border: 2px dashed var(--primary-color);
    cursor: pointer;
}

body.placement-mode .day-item:not(.past):hover,
body.placement-mode .day-item:not(.past):active {
    border: 3px solid var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

/* =====================================================
   MOBILE WEEK CALENDAR - COLLAPSIBLE
   ===================================================== */

.week-calendar-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

/* Desktop: controls row below title */
.week-calendar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Week navigation controls */
.week-nav-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-week-nav:hover {
    background: var(--surface);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-week-nav:active {
    transform: scale(0.95);
}

.btn-week-today {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-week-today:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-week-today:active {
    transform: scale(0.95);
}

/* Date picker button for jumping to specific dates */
.btn-date-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-date-picker:hover {
    background: var(--surface);
    border-color: var(--primary-color);
}

.btn-date-picker:active {
    transform: scale(0.95);
}

/* Hidden date input - only used to trigger native picker */
.week-date-picker-hidden {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* View mode toggle */
.view-mode-toggle {
    display: flex;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

.view-mode-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.view-mode-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.view-mode-btn.active {
    background: var(--primary-color);
    color: white;
}

.view-mode-btn:not(.active):hover {
    background: var(--surface);
    color: var(--primary-color);
}

/* Past day styling */
.day-item.past {
    opacity: 0.5;
    pointer-events: none;
}

.day-item.past .day-meal {
    cursor: default;
}

/* Hide mobile-specific elements on desktop */
.week-calendar-label .collapse-icon,
.week-calendar-label .calendar-icon {
    display: none;
}

/* Desktop: show label with h3 inline */
.week-calendar-label {
    display: flex;
    align-items: center;
}

.btn-collapse-calendar {
    display: none;
}

@media (max-width: 600px) {
    /* Mobile week calendar - collapsible bottom sheet */
    .week-calendar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        z-index: 100;
        margin: 0;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        transform: translateY(calc(100% - 48px));
        transition: transform 0.3s ease;
        max-height: 85vh;
        overflow: hidden;
        padding: 12px 16px;
        padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    }

    /* Hide clear all button on mobile */
    .week-calendar .btn-clear-all {
        display: none !important;
    }

    .week-calendar.expanded {
        transform: translateY(0);
    }

    .week-calendar-header {
        flex-direction: row;
        align-items: center;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 8px;
        cursor: pointer;
        gap: 8px;
        min-height: 36px;
    }

    .week-calendar.expanded .week-calendar-header {
        cursor: default;
    }

    /* Hide label when expanded to make room for controls */
    .week-calendar.expanded .week-calendar-label {
        display: none;
    }

    /* Hide controls when collapsed, show when expanded */
    .week-calendar-controls {
        display: none;
    }

    .week-calendar.expanded .week-calendar-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        flex: 1;
    }

    /* Mobile view mode toggle - good touch targets */
    .view-mode-btn {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }

    /* Mobile week nav - good touch targets */
    .btn-week-nav {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .btn-week-today {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }

    .btn-date-picker {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }

    .week-calendar-label {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    .week-calendar-label .calendar-icon {
        display: inline;
        font-size: 0.875rem;
    }

    .week-calendar-label .collapse-icon {
        display: inline;
        font-size: 0.75rem;
        color: var(--text-muted);
        transition: transform 0.3s ease;
    }

    .week-calendar.expanded .week-calendar-label .collapse-icon {
        transform: rotate(180deg);
    }

    .week-calendar h3 {
        display: block;
        font-size: 0.875rem;
        margin: 0;
    }

    /* Hide close button when collapsed, show when expanded */
    .btn-collapse-calendar {
        display: none;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        color: var(--text-muted);
        font-size: 1.25rem;
    }

    .week-calendar.expanded .btn-collapse-calendar {
        display: flex;
    }

    .week-calendar .day-list {
        flex-direction: column;
        gap: 6px;
        overflow-y: auto;
        max-height: calc(85vh - 80px);
        padding-right: 4px;
    }

    .week-calendar .day-item {
        flex-direction: row;
        text-align: left;
        padding: 10px 12px;
        min-height: auto;
    }

    .week-calendar .day-item-header {
        flex-direction: row;
        gap: 8px;
        min-width: 70px;
    }

    .week-calendar .day-name {
        font-size: 0.875rem;
    }

    .week-calendar .day-date {
        font-size: 0.75rem;
    }

    .week-calendar .day-meal-slot {
        flex: 1;
    }

    .week-calendar .day-meal {
        flex-direction: row;
        justify-content: space-between;
        padding: 4px 8px;
    }

    .week-calendar .day-meal-name {
        font-size: 0.8125rem;
    }

    .week-calendar .day-meal-details {
        display: none;
    }

    .week-calendar .day-empty {
        display: none;
    }

    .week-calendar .day-meal-remove {
        min-width: 32px;
        min-height: 32px;
        font-size: 0.75rem;
    }

    /* Add padding to main content to account for fixed calendar */
    .container {
        padding-bottom: 60px;
    }
}

/* =====================================================
   AUTH MODAL STYLES
   ===================================================== */

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.auth-overlay.open {
    opacity: 1;
    visibility: visible;
}

.auth-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    padding: 32px;
    position: relative;
    animation: authSlideUp 0.3s ease;
}

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

.auth-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.auth-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Auth Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.auth-form-group input {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--background);
    transition: all 0.15s ease;
}

.auth-form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--surface);
}

.auth-form-group input::placeholder {
    color: var(--text-muted);
}

.auth-submit {
    margin-top: 8px;
    padding: 12px 20px;
    font-size: 0.9375rem;
    width: 100%;
}

.auth-error {
    color: #ef4444;
    font-size: 0.875rem;
    min-height: 20px;
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* OAuth Buttons */
.auth-oauth {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-oauth:hover {
    background: var(--background);
    border-color: var(--text-muted);
}

.btn-oauth svg {
    flex-shrink: 0;
}

/* =====================================================
   UPGRADE MODAL STYLES
   ===================================================== */

/* Freezer Quantity Dialog */
.freezer-dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.freezer-dialog-overlay.open {
    display: flex;
}

.freezer-dialog {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 320px;
    width: 100%;
    text-align: center;
}

.freezer-dialog h3 {
    margin: 0 0 8px;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.freezer-dialog p {
    margin: 0 0 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.freezer-dialog-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.freezer-dialog-qty input {
    width: 60px;
    height: 42px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text-primary);
}

.freezer-dialog-qty .btn-qty {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--background);
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.freezer-dialog-qty .btn-qty:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.freezer-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.freezer-dialog-actions button {
    flex: 1;
    padding: 10px 16px;
}

/* ============ ADD-TO-STAPLES DIALOG ============ */
.staple-dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.staple-dialog-overlay.open {
    display: flex;
}

.staple-dialog {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 320px;
    width: 100%;
}

.staple-dialog h3 {
    margin: 0 0 8px;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.staple-dialog p {
    margin: 0 0 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.staple-dialog .form-group {
    margin-bottom: 20px;
}

.staple-dialog .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.staple-dialog .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.staple-dialog-actions {
    display: flex;
    gap: 12px;
}

.staple-dialog-actions button {
    flex: 1;
    padding: 10px 16px;
}

.upgrade-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.upgrade-overlay.open {
    display: flex;
}

.upgrade-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 360px;
    width: 100%;
    position: relative;
    text-align: center;
    animation: authSlideUp 0.3s ease;
}

.upgrade-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.upgrade-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.upgrade-content h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.upgrade-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 4px 0 20px;
}

.upgrade-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    text-align: left;
}

.upgrade-features li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.upgrade-features li:last-child {
    border-bottom: none;
}

.upgrade-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

/* Premium badge for UI elements */
.premium-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Locked feature overlay */
.feature-locked {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.feature-locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
}

.feature-locked-clickable {
    cursor: pointer;
    opacity: 0.7;
}

.feature-locked-clickable:hover {
    opacity: 0.9;
}

.feature-teaser-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin-top: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px dashed var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
    transition: all 0.2s ease;
}

.feature-teaser-prompt:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    transform: translateY(-1px);
}

/* Premium lock badge on section headers */
.premium-lock {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.55rem;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: uppercase;
    font-weight: 600;
    vertical-align: middle;
}

/* Menu User Section */
.menu-user-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
}

.menu-user-info .user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

/* =====================================================
   CUSTOM MEAL MODAL
   ===================================================== */

.custom-meal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.custom-meal-overlay.open {
    display: flex;
}

.custom-meal-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 420px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: authSlideUp 0.3s ease;
}

.custom-meal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.custom-meal-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.custom-meal-container h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.custom-meal-form-group {
    margin-bottom: 16px;
}

.custom-meal-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.custom-meal-form-group input,
.custom-meal-form-group select,
.custom-meal-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.custom-meal-form-group input:focus,
.custom-meal-form-group select:focus,
.custom-meal-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.custom-meal-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

#customMealForm .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 8px;
}

/* Add Custom Button */
.btn-add-custom {
    padding: 8px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-add-custom:hover {
    background: var(--primary-dark);
}

/* Custom Item Styling */
.idea-item.custom,
.bulk-item.custom {
    border-left: 3px solid var(--primary-color);
}

.btn-delete-custom {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
    font-size: 0.875rem;
    transition: opacity 0.15s ease;
}

.btn-delete-custom:hover {
    opacity: 1;
}

/* Mix It Up search with custom button */
.mix-it-up-search {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.mix-it-up-search input {
    flex: 1;
}

/* Bulk Cook header with custom button */
.bulk-cook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* =====================================================
   OFFLINE INDICATOR
   ===================================================== */

.offline-indicator {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-orange);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
    z-index: 99;
    box-shadow: var(--shadow-md);
    gap: 8px;
    align-items: center;
}

.offline-indicator.visible {
    display: flex;
}

.offline-icon {
    font-size: 1rem;
}

/* =====================================================
   MIGRATION PROMPT
   ===================================================== */

.migration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.migration-overlay.open {
    opacity: 1;
    visibility: visible;
}

.migration-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    padding: 32px;
    text-align: center;
}

.migration-container h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.migration-container p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.migration-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.migration-btn-secondary {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.migration-btn-secondary:hover {
    background: var(--background);
    color: var(--text-primary);
}

.migration-btn-primary {
    padding: 10px 20px;
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
}

.migration-btn-primary:hover {
    background: var(--primary-dark);
}

/* Responsive Auth */
@media (max-width: 600px) {
    .auth-container {
        padding: 24px 20px;
        margin: 10px;
    }

    .auth-tabs {
        margin-bottom: 20px;
    }

    .auth-tab {
        padding: 10px 12px;
        font-size: 0.875rem;
    }

    .auth-form-group input {
        padding: 10px 12px;
        font-size: 1rem; /* Prevent iOS zoom */
    }

    .offline-indicator {
        top: auto;
        bottom: 60px;
        left: 16px;
        right: 16px;
        transform: none;
        justify-content: center;
    }
}

/* =====================================================
   CUSTOMIZE SCREEN
   ===================================================== */

.customize-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.customize-overlay.open {
    display: flex;
}

.customize-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
}

.customize-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-left: calc(20px + var(--safe-area-left, 0px));
    padding-right: calc(20px + var(--safe-area-right, 0px));
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.customize-header .btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    color: var(--text-primary);
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.customize-header .btn-back:hover {
    background: var(--background);
}

.customize-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

/* Tab navigation */
.customize-tabs {
    display: flex;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.customize-tabs::-webkit-scrollbar {
    display: none;
}

.customize-tab {
    flex: 0 0 auto;
    padding: 14px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.customize-tab:hover {
    color: var(--text-primary);
    background: var(--background);
}

.customize-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Content panels */
.customize-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.customize-panel {
    display: none;
}

.customize-panel.active {
    display: block;
}

.customize-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.customize-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.customize-section h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.section-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--background);
    color: var(--text-primary);
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.form-row-category {
    display: flex;
    gap: 12px;
    align-items: center;
}

.form-row-category .cat-name-input {
    flex: 1;
    height: 42px;
    box-sizing: border-box;
    padding: 0 12px;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background);
}

.form-row-category .cat-emoji-input {
    width: 60px;
    height: 42px;
    box-sizing: border-box;
    padding: 0;
    font-size: 1.125rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background);
}

.form-row-category .cat-name-input:focus,
.form-row-category .cat-emoji-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.form-group-grow {
    flex: 1;
}

.form-group-emoji {
    width: 80px;
    flex-shrink: 0;
}

.form-group-emoji input {
    text-align: center;
}

/* Custom items list */
.custom-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.custom-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--background);
    border-radius: var(--radius);
    gap: 12px;
    min-height: 44px;
}

.custom-item-detailed {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.custom-item-detailed .custom-item-info {
    flex: 1;
    min-width: 0;
}

.custom-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.custom-item-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.custom-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.custom-item-ingredients {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.btn-delete-item {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 1.125rem;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.btn-delete-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    opacity: 1;
}

.custom-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
}

.btn-edit-item {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 1rem;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.btn-edit-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    opacity: 1;
}

/* Edit mode for custom items */
.custom-item-editing {
    border: 2px solid var(--primary-color);
    background: var(--surface);
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
}

.custom-item-editing .form-group {
    margin-bottom: 0;
}

.custom-item-editing .form-group + .form-group {
    margin-top: 12px;
}

.custom-item-editing .form-row {
    margin-bottom: 0;
    width: 100%;
}

.custom-item-editing .custom-item-info {
    width: 100%;
}

.edit-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    background: var(--background);
    color: var(--text-primary);
    box-sizing: border-box;
}

.edit-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.btn-save-edit {
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    cursor: pointer;
    font-weight: 500;
}

.btn-save-edit:hover {
    opacity: 0.9;
}

.btn-cancel-edit {
    padding: 8px 20px;
    background: var(--background);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    cursor: pointer;
}

.btn-cancel-edit:hover {
    background: var(--border-color);
}

/* Chip editing inline */
.chip-editing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chip-edit-input {
    width: 120px;
    padding: 4px 8px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.8125rem;
    background: var(--background);
    color: var(--text-primary);
}

.chip-edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0 3px;
    opacity: 0.6;
}

.chip-edit-btn:hover {
    color: var(--primary-color);
    opacity: 1;
}

.chip-edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0 2px;
    opacity: 0.6;
}

.chip-edit-btn:hover {
    color: var(--primary-color);
    opacity: 1;
}

.customize-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    margin-top: 16px;
}

.btn-reset-default {
    background: none;
    color: #dc2626;
    border: 1px solid #dc2626;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-reset-default:hover {
    background: #dc2626;
    color: white;
}

.staple-item-editing {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
}

.staple-item-editing .edit-input {
    flex: 1;
    min-width: 120px;
}

.staple-item-editing .edit-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.empty-list-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 12px;
}

.add-item-form {
    display: flex;
    gap: 8px;
}

.add-item-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--background);
}

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

.btn-add-item {
    padding: 10px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-add-item:hover {
    background: var(--primary-dark);
}

/* Chip Input Component */
.chip-input-container {
    position: relative;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px;
    min-height: 44px;
    transition: all 0.15s ease;
}

.chip-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chip-input-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.chip-input-chips:empty {
    margin-bottom: 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.chip-actions {
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
    gap: 1px;
}

.chip-add-staple,
.chip-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 6px;
    opacity: 0.85;
    transition: all 0.15s ease;
}

.chip-add-staple {
    border-radius: 10px 0 0 10px;
}

.chip-add-staple:hover,
.chip-remove:hover {
    background: rgba(255, 255, 255, 0.35);
    opacity: 1;
}

.chip-remove {
    border-radius: 0 10px 10px 0;
}

.chip-remove:only-child {
    border-radius: 10px;
}

.chip-readonly {
    background: var(--text-muted);
    color: white;
    opacity: 0.8;
}

/* ============ ACCORDION (Extra Meals Tab) ============ */

.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
    background: var(--surface);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.accordion-header:hover {
    background: rgba(99, 102, 241, 0.05);
}

.accordion-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.accordion-header-left .accordion-emoji {
    font-size: 1.25rem;
}

.accordion-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.accordion-header-actions .btn-edit-item,
.accordion-header-actions .btn-delete-item {
    padding: 4px;
    font-size: 0.875rem;
}

.accordion-chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.accordion-item.expanded .accordion-chevron {
    transform: rotate(90deg);
}

.accordion-content {
    display: none;
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-color);
}

.accordion-item.expanded .accordion-content {
    display: block;
}

.accordion-subsection {
    margin-top: 16px;
}

.accordion-subsection:first-child {
    margin-top: 12px;
}

.accordion-subsection-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* ============ PAIRING CHIPS ============ */

.pairing-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.pairing-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 4px;
    white-space: nowrap;
}

.pairing-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1.5px solid var(--primary-color);
    user-select: none;
}

.pairing-chip.active {
    background: var(--primary-color);
    color: white;
}

.pairing-chip.inactive {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.pairing-chip.inactive:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Option protein override indicator */
.option-protein-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Accordion option items */
.accordion-option-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.accordion-option-item:last-child {
    border-bottom: none;
}

.accordion-option-info {
    flex: 1;
    min-width: 0;
}

.accordion-option-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.accordion-option-ingredients {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.accordion-option-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Create category section */
.create-category-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Pairing picker (used in Base Meals tab when adding items) */
.pairing-picker {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 12px;
}

.pairing-picker-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.pairing-picker-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

.pairing-picker-row:last-child {
    border-bottom: none;
}

.pairing-picker-check {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.pairing-picker-label {
    font-size: 0.8125rem;
    flex: 1;
}

.pairing-picker-emoji {
    font-size: 1rem;
}

.pairing-picker-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Base Meals Pairing Accordion (inside edit mode) */
.base-pairing-accordion {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 12px;
}

.base-pairing-category {
    border-bottom: 1px solid var(--border-color);
}

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

.base-pairing-category-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 0.8125rem;
    gap: 8px;
    user-select: none;
}

.base-pairing-category-label {
    flex: 1;
    cursor: pointer;
}

.base-pairing-category-header:hover {
    background: rgba(99, 102, 241, 0.05);
}

.base-pairing-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 4px;
}

.base-pairing-category .accordion-chevron {
    font-size: 0.625rem;
    transition: transform 0.2s;
}

.base-pairing-category.expanded .accordion-chevron {
    transform: rotate(90deg);
}

.base-pairing-category-options {
    display: none;
    padding: 4px 12px 8px 24px;
}

.base-pairing-category.expanded .base-pairing-category-options {
    display: block;
}

.base-pairing-option-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.base-pairing-option-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.base-pairing-option-name {
    font-size: 0.8125rem;
}

.category-ingredients-list {
    margin-bottom: 16px;
}

.ingredients-group {
    margin-bottom: 12px;
}

.ingredients-group-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ingredients-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-input-field {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 4px 0;
    outline: none;
    color: var(--text-primary);
}

.chip-input-field::placeholder {
    color: var(--text-muted);
}

.chip-autocomplete {
    display: none;
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 160px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.chip-autocomplete.open {
    display: block;
}

.chip-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background 0.1s ease;
}

.chip-suggestion:hover {
    background: var(--background);
}

.chip-suggestion-disabled {
    cursor: not-allowed;
    color: var(--text-muted);
    background: var(--background);
    opacity: 0.7;
}

.chip-suggestion-disabled:hover {
    background: var(--background);
}

.staple-badge {
    font-size: 0.625rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chip-warning {
    display: none;
    padding: 8px 10px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: #b45309;
    margin-top: 8px;
    align-items: center;
    gap: 6px;
}

.chip-warning.visible {
    display: flex;
}

.chip-warning .warning-icon {
    font-weight: bold;
    color: #f59e0b;
}

/* Staples categories */
.staples-categories {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.staple-category h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.staple-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.staple-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--background);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.staple-item-custom .custom-item-actions {
    gap: 2px;
    margin-left: 4px;
}

.staple-item-custom .btn-edit-item,
.staple-item-custom .btn-delete-staple {
    padding: 4px;
    font-size: 0.8125rem;
}

.btn-delete-staple {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
    opacity: 0.6;
    display: flex;
    align-items: center;
}

.btn-delete-staple:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    opacity: 1;
}

/* Extra Ingredients on Meal Cards */
.meal-extra-ingredients {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.meal-extra-ingredients .ingredients-label {
    flex-shrink: 0;
}

.meal-extra-ingredients .ingredients-list {
    line-height: 1.4;
}

/* Responsive Customize Screen */
@media (max-width: 600px) {
    .customize-header {
        padding: 10px 16px;
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
    }

    .customize-header h2 {
        font-size: 1.125rem;
    }

    .customize-tab {
        padding: 12px 14px;
        font-size: 0.8125rem;
    }

    .customize-content {
        padding: 16px;
    }

    .customize-section {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group-emoji {
        width: 100%;
    }
}

/* Desktop enhancements */
@media (min-width: 601px) {
    .customize-header {
        padding: 12px 24px;
    }

    .customize-header h2 {
        font-size: 1.25rem;
    }

    .customize-content {
        padding: 24px;
    }

    .customize-section {
        padding: 24px;
    }

    .custom-item {
        padding: 12px 16px;
    }

    .custom-item-detailed:not(.custom-item-editing) .custom-item-info {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

}

/* =====================================================
   PREMIUM WELCOME TOAST
   ===================================================== */

.premium-welcome-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, var(--secondary-color), #059669);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 90%;
}

.premium-welcome-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =====================================================
   LOCKED FEATURE STYLES (PREMIUM GATING)
   ===================================================== */

.feature-locked-overlay {
    position: relative;
}

.feature-locked-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.7);
    backdrop-filter: blur(2px);
    border-radius: var(--radius-lg);
    z-index: 1;
    pointer-events: none;
}

.feature-locked-overlay .locked-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.locked-label-icon {
    font-size: 1.5rem;
}

.locked-label-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.locked-label-link {
    font-size: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
    margin-top: 4px;
}

.locked-label-link:hover {
    text-decoration: underline;
}

/* Disabled add button for meal limits — still clickable to trigger upgrade dialog */
.btn-add-disabled {
    opacity: 0.5;
    cursor: pointer;
}

.btn-add-disabled .premium-badge {
    margin-left: 4px;
}
