:root {
    --primary: #e85d26;
    --primary-light: #fef0eb;
    --bg: #fafafa;
    --card-bg: #ffffff;
    --text: #333333;
    --text-muted: #888888;
    --border: #e0e0e0;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
}

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

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

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 24px;
}

.top-bar h1 {
    font-size: 1.4rem;
    color: var(--primary);
}

.top-bar nav {
    display: flex;
    gap: 16px;
}

.top-bar nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.top-bar nav a:hover {
    color: var(--primary);
}

.content {
    padding-bottom: 40px;
}

/* Day View */
.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.day-header h2 {
    font-size: 1.2rem;
}

.day-nav {
    display: flex;
    gap: 8px;
}

.day-nav button {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85rem;
}

.day-nav button:hover {
    background: var(--primary-light);
}

/* Meal Cards */
.meal-slot {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

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

.meal-type-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 12px;
}

.meal-type-breakfast { background: #fff3e0; color: #e65100; }
.meal-type-lunch { background: #e8f5e9; color: #2e7d32; }
.meal-type-dinner { background: #e3f2fd; color: #1565c0; }
.meal-type-snack { background: #f3e5f5; color: #7b1fa2; }

.meal-name {
    font-size: 1.05rem;
    font-weight: 600;
}

.meal-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.empty-meal {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    padding: 12px;
}

/* Log Meal Button */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

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

.btn-primary:hover {
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

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

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Pantry */
.storage-section {
    margin-bottom: 24px;
}

.storage-section h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.pantry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.pantry-quantity {
    font-weight: 600;
    color: var(--primary);
    min-width: 80px;
    text-align: right;
}

.expiring-soon {
    color: var(--warning);
    font-weight: 600;
}

.expired {
    color: var(--danger);
    font-weight: 600;
}

/* Family */
.member-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

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

.member-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin: 2px 2px;
}

.tag-like { background: #e8f5e9; color: #2e7d32; }
.tag-dislike { background: #ffebee; color: #c62828; }
.tag-restriction { background: #fff3e0; color: #e65100; }

/* Week View */
.week-grid {
    display: grid;
    gap: 12px;
}

.week-day {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}

.week-day-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--primary);
}

.week-day-today {
    border-color: var(--primary);
    border-width: 2px;
}

.week-meal-item {
    font-size: 0.85rem;
    padding: 2px 0;
}

/* Recipe cards */
.recipe-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.recipe-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Log Meal Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
}

.modal h3 {
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Blazor unhandled-error bar: hidden until Blazor's JS reveals it on a real
   error. Without this rule the div renders as a normal block and shows
   permanently. */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
