:root {
    --color-cream: #FDF8F3;
    --color-warm-white: #FEFCFA;
    --color-terracotta: #C4704B;
    --color-terracotta-dark: #A85A38;
    --color-sage: #7A8B6E;
    --color-sage-light: #E8EDE5;
    --color-charcoal: #2D2926;
    --color-brown: #5C4A3D;
    --color-gold: #D4A853;
    --color-gold-light: #F5E6C8;
    --color-error: #C25B56;
    --color-success: #6B8E6B;
    --shadow-sm: 0 1px 3px rgba(45, 41, 38, 0.08);
    --shadow-md: 0 4px 12px rgba(45, 41, 38, 0.1);
    --shadow-lg: 0 8px 30px rgba(45, 41, 38, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--color-cream);
    color: var(--color-charcoal);
    min-height: 100vh;
    line-height: 1.6;
}
.header {
    background: linear-gradient(135deg, var(--color-terracotta) 0%, var(--color-terracotta-dark) 100%);
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: visible;
}
.header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}
.header h1 {
    font-family: 'Fraunces', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    position: relative;
    letter-spacing: -0.02em;
}
.header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-top: 0.5rem;
    position: relative;
    font-weight: 300;
}
.container { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.stepper-container {
    background: var(--color-warm-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}
.stepper-nav {
    display: flex;
    background: var(--color-sage-light);
    padding: 1rem 1.5rem;
    gap: 1rem;
}
.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}
.step-indicator .step-number {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--color-sage);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}
.step-indicator.active { background: white; box-shadow: var(--shadow-sm); }
.step-indicator.active .step-number { background: var(--color-terracotta); }
.step-indicator.completed .step-number { background: var(--color-success); }
.step-indicator.completed .step-number span { display: none; }
.step-indicator.completed .step-number::after { content: '✓'; }
.step-indicator.disabled { opacity: 0.5; cursor: not-allowed; }
.stepper-content { padding: 2rem; }
.step-panel { display: none; animation: fadeIn 0.4s ease; }
.step-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.form-section { margin-bottom: 2rem; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-brown);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-section-title .icon { font-size: 1.5rem; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-weight: 500; color: var(--color-brown); font-size: 0.925rem; }
.form-group .optional { color: var(--color-sage); font-weight: 400; font-size: 0.85rem; }
input[type="number"], input[type="date"], input[type="text"], select {
    padding: 0.875rem 1rem;
    border: 2px solid #E5DDD5;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--color-terracotta);
    box-shadow: 0 0 0 3px rgba(196, 112, 75, 0.15);
}
input.error { border-color: var(--color-error); }
.error-message { color: var(--color-error); font-size: 0.85rem; margin-top: 0.25rem; }
.pill-toggle-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.pill-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: white;
    border: 2px solid #E5DDD5;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-brown);
    user-select: none;
}
.pill-toggle:hover { border-color: var(--color-sage); background: var(--color-cream); }
.pill-toggle.active { background: var(--color-sage); border-color: var(--color-sage); color: white; }
.pill-toggle .pill-icon { font-size: 1.1rem; }
.toggle-container { display: flex; align-items: center; gap: 1rem; }
.toggle-switch {
    position: relative;
    width: 56px; height: 30px;
    background: #D1D5DB;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s ease;
}
.toggle-switch.active { background: var(--color-sage); }
.toggle-switch .toggle-knob {
    position: absolute;
    top: 3px; left: 3px;
    width: 24px; height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}
.toggle-switch.active .toggle-knob { transform: translateX(26px); }
.toggle-label { font-weight: 500; }
.days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.day-card {
    background: var(--color-cream);
    border: 2px solid #E5DDD5;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all 0.2s ease;
}
.day-card.skipped { opacity: 0.5; background: #F5F3F0; }
.day-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #E5DDD5;
}
.day-card-title { font-family: 'Fraunces', serif; font-weight: 600; color: var(--color-brown); }
.day-card-date { font-size: 0.85rem; color: var(--color-sage); }
.day-card-options { display: flex; flex-direction: column; gap: 0.75rem; }
.day-option { display: flex; align-items: center; gap: 0.75rem; }
.day-option label { font-size: 0.9rem; color: var(--color-charcoal); }
.day-option select { padding: 0.5rem 0.75rem; font-size: 0.9rem; }
.small-checkbox { width: 18px; height: 18px; accent-color: var(--color-terracotta); }
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-primary {
    background: linear-gradient(135deg, var(--color-terracotta) 0%, var(--color-terracotta-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:disabled { background: #CCC; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: white; color: var(--color-brown); border: 2px solid #E5DDD5; }
.btn-secondary:hover { border-color: var(--color-terracotta); color: var(--color-terracotta); }
.btn-secondary:disabled { background: #F5F5F5; color: #AAA; border-color: #DDD; cursor: not-allowed; }
.btn-success {
    background: linear-gradient(135deg, var(--color-sage) 0%, #5F7353 100%);
    color: white;
    box-shadow: var(--shadow-md);
    min-width: 160px;
}
.btn-success:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-success:disabled { background: #CCC; cursor: not-allowed; transform: none; }
.btn-success.loading { pointer-events: none; }
.btn-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.button-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E5DDD5;
}
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.results-title { font-family: 'Fraunces', serif; font-size: 1.5rem; font-weight: 600; color: var(--color-brown); }
.meal-results { display: flex; flex-direction: column; gap: 1rem; }
.meal-day-card {
    background: var(--color-cream);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 2px solid #E5DDD5;
    animation: slideIn 0.4s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.meal-day-card.has-selection { border-color: var(--color-sage); background: var(--color-sage-light); }
.meal-day-header {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-brown);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.meal-day-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.refresh-btn {
    background: none;
    border: none;
    color: var(--color-sage);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.refresh-btn:hover {
    background: var(--color-sage-light);
    color: var(--color-brown);
}
.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.refresh-btn svg {
    width: 18px;
    height: 18px;
}
.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.meal-day-card.refreshing .meal-options-grid {
    opacity: 0.5;
    pointer-events: none;
}
.day-weather {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-sage);
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}
.meal-day-skipped { color: var(--color-sage); font-style: italic; padding: 1rem 0; }
.meal-options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 600px) { .meal-options-grid { grid-template-columns: 1fr; } }
.meal-option-card {
    background: white;
    border: 2px solid #E5DDD5;
    border-radius: var(--radius-sm);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.meal-option-card:hover { border-color: var(--color-terracotta); }
.meal-option-card.selected {
    border-color: var(--color-terracotta);
    background: var(--color-gold-light);
    box-shadow: 0 0 0 3px rgba(196, 112, 75, 0.2);
}
.meal-option-card.dragging { opacity: 0.5; transform: scale(0.98); }
.meal-option-card.drag-over { border-color: var(--color-gold); border-style: dashed; background: var(--color-gold-light); }
.meal-option-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.5rem; }
.meal-radio {
    width: 20px; height: 20px;
    border: 2px solid #CCC;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.meal-option-card.selected .meal-radio { border-color: var(--color-terracotta); background: var(--color-terracotta); }
.meal-option-card.selected .meal-radio::after { content: ''; width: 8px; height: 8px; background: white; border-radius: 50%; }
.meal-name { font-weight: 600; color: var(--color-charcoal); line-height: 1.4; }
.meal-side { color: var(--color-sage); font-size: 0.9rem; margin-top: 0.25rem; padding-left: 32px; }
.meal-meta { font-size: 0.85rem; color: var(--color-brown); margin-top: 0.5rem; padding-left: 32px; }
.meal-meta .quick-badge {
    background: var(--color-gold-light);
    color: var(--color-brown);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    margin-left: 0.5rem;
}
.drag-handle {
    position: absolute;
    top: 0.5rem; right: 0.5rem;
    color: #CCC;
    font-size: 1rem;
    cursor: grab;
    padding: 0.25rem;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle:hover { color: var(--color-brown); }
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--color-cream);
    border-top-color: var(--color-terracotta);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-text { color: var(--color-brown); font-weight: 500; font-size: 0.95rem; }
.download-icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }
.share-icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }
.footer { text-align: center; padding: 2rem; color: var(--color-sage); font-size: 0.9rem; }

/* Modal styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: white;
    border-radius: var(--radius-md);
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}
.modal-title {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-brown);
    margin-bottom: 1rem;
}
.modal-body {
    color: var(--color-charcoal);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}
.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Finalized view styles */
.finalized-container {
    display: none;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.finalized-container.active { display: block; }
.finalized-header {
    background: linear-gradient(135deg, var(--color-sage) 0%, #5F7353 100%);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}
.finalized-header h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.finalized-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}
.finalized-content { padding: 2rem; }
.finalized-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #E5DDD5;
}
.finalized-actions-right { display: flex; gap: 0.75rem; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-sage);
    background: white;
    color: var(--color-sage);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.btn-icon:hover {
    background: var(--color-sage-light);
}
.copy-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-charcoal);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 0.5rem;
}
.copy-tooltip.show {
    opacity: 1;
}
.copy-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-charcoal);
}
.helper-message {
    background: var(--color-sage-light);
    border: 1px solid var(--color-sage);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    color: var(--color-brown);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.helper-message .helper-icon {
    font-size: 1.1rem;
}
.finalized-meal-card {
    background: var(--color-cream);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 2px solid var(--color-sage);
    margin-bottom: 1rem;
}
.finalized-meal-card.skipped {
    border-color: #E5DDD5;
    opacity: 0.7;
}
.finalized-meal-header {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-brown);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.finalized-meal-name {
    font-weight: 600;
    color: var(--color-charcoal);
    margin-bottom: 0.25rem;
}
.finalized-meal-side {
    color: var(--color-sage);
    font-size: 0.9rem;
}
.finalized-meal-meta {
    font-size: 0.85rem;
    color: var(--color-brown);
    margin-top: 0.5rem;
}
.finalized-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E5DDD5;
    text-align: center;
}

@media (max-width: 768px) {
    .header h1 { font-size: 1.75rem; }
    .container { padding: 1rem; }
    .stepper-nav { flex-direction: column; gap: 0.5rem; }
    .stepper-content { padding: 1.5rem; }
    .days-grid { grid-template-columns: 1fr; }
    .button-row { flex-direction: column; gap: 1rem; }
    .button-row .btn { width: 100%; justify-content: center; }
    .results-header { flex-direction: column; gap: 1rem; align-items: stretch; }
    .finalized-actions { flex-direction: column; gap: 1rem; align-items: stretch; }
    .finalized-actions-right { justify-content: center; }
}
