/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: #faf9f6;
    color: #1a1a1a;
    -webkit-font-smoothing: antialiased;
}

/* ── Shell ── */
.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 90px;
    position: relative;
}

/* ── Page ── */
.page { padding: 24px 20px; }

/* ── Meal Plan Page ── */
.meal-page { text-align: center; }

.week-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3d7c4f;
    margin: 0 0 4px;
}

.page-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin: 0;
    color: #1a1a1a;
}

.page-subtitle {
    font-size: 0.95rem;
    color: #888;
    margin: 4px 0 0;
}

/* ── Day Selector ── */
.day-selector {
    display: flex;
    gap: 6px;
    margin: 24px 0 20px;
    justify-content: center;
}

.day-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border: 0;
    border-radius: 16px;
    padding: 8px 12px 10px;
    background: #f0eeeb;
    color: #444;
    cursor: pointer;
    min-width: 50px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.day-chip:hover { background: #e5e2de; }

.day-chip.active {
    background: #3d6b4f;
    color: #fff;
    box-shadow: 0 4px 12px rgba(61, 107, 79, 0.35);
}

.day-chip-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}

.day-chip-date {
    font-size: 1.05rem;
    font-weight: 700;
}

/* ── Selected Day ── */
.selected-day {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 8px 0 2px;
}

.selected-date {
    font-size: 0.9rem;
    color: #999;
    margin: 0 0 16px;
}

/* ── Recipe Card ── */
.recipe-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0,0,0,.06);
    text-align: center;
}

.recipe-image-container { position: relative; }

.recipe-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.recipe-tags-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
}

.recipe-tag {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
}

.recipe-info { padding: 16px 20px 20px; }

.recipe-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.recipe-subtitle {
    font-size: 0.9rem;
    color: #888;
    margin: 0 0 12px;
}

.recipe-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 16px;
}

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

/* ── Action Buttons ── */
.recipe-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-btn {
    border: 1.5px solid #ddd;
    border-radius: 12px;
    padding: 12px 8px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.action-btn:hover { background: #f7f7f4; }

.like-btn {
    border-color: #3d7c4f;
    color: #3d7c4f;
}

.like-btn:hover { background: #eef6f0; }

.swap-btn { color: #555; }

/* ── Empty State ── */
.empty-card { padding: 40px 20px; }
.empty-state p {
    color: #999;
    font-size: 0.95rem;
}

/* ── Generate Button ── */
.generate-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    border: 0;
    border-radius: 16px;
    background: #3d7c4f;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(61, 124, 79, 0.3);
}

.generate-btn:hover {
    background: #356d45;
    box-shadow: 0 6px 20px rgba(61, 124, 79, 0.4);
}

/* ── Shared ── */
.muted { color: #888; }
.card { background: #fff; border-radius: 16px; padding: 16px; margin-top: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.list { margin: 8px 0 0; padding-left: 0; list-style: none; }
.list li { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }

/* ── Recipes Page ── */
.recipes-page { text-align: center; }

.search-wrapper {
    position: relative;
    margin: 20px 0 16px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #aaa;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 14px 14px 14px 42px;
    border-radius: 14px;
    border: 1px solid #e8e6e3;
    background: #f5f4f1;
    font-size: 0.95rem;
    color: #333;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.search-input:focus {
    border-color: #3d7c4f;
    background: #fff;
}

.search-input::placeholder { color: #aaa; }

/* ── Filter Chips ── */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 20px;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
    flex-shrink: 0;
    border: 0;
    border-radius: 999px;
    padding: 8px 18px;
    background: #f0eeeb;
    color: #555;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.filter-chip:hover { background: #e5e2de; }

.filter-chip.active {
    background: #3d6b4f;
    color: #fff;
}

/* ── Recipe Grid ── */
.recipe-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    text-align: left;
}

.recipe-grid-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}

.grid-card-image-container {
    position: relative;
}

.grid-card-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.favorite-btn:hover { background: #fff; }

.favorite-btn svg {
    width: 16px;
    height: 16px;
    color: #666;
}

.grid-card-info {
    padding: 10px 12px 14px;
}

.grid-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: #1a1a1a;
}

.grid-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: #999;
}

/* ── Shopping Page ── */
.shopping-page { text-align: center; }

.promo-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f0eeeb;
    border-radius: 16px;
    padding: 14px 18px;
    margin: 20px 0 8px;
    text-align: left;
}

.promo-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #3d7c4f;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
    color: #666;
}

.promo-text strong {
    color: #1a1a1a;
    font-size: 0.95rem;
}

.category-header {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a08a6e;
    margin: 24px 0 10px;
}

.shopping-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,.04);
    text-align: left;
    transition: opacity 0.2s;
}

.shopping-item.checked {
    opacity: 0.45;
}

.shopping-item.checked .item-name {
    text-decoration: line-through;
}

.check-circle {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #d4d0cb;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.15s, background 0.15s;
}

.check-circle:hover {
    border-color: #3d7c4f;
}

.check-circle.checked {
    border-color: #3d7c4f;
    background: #3d7c4f;
}

.check-circle svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

.item-name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1a1a1a;
}

.item-qty {
    flex-shrink: 0;
    font-size: 0.9rem;
    color: #a08a6e;
    font-weight: 500;
}

/* ── Login Page ── */
.login-page {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 60px 24px 40px;
}

.login-logo {
    margin-bottom: 20px;
}

.login-logo-image {
    width: 160px;
    height: auto;
    max-width: 100%;
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 4px;
    color: #1a1a1a;
}

.login-subtitle {
    font-size: 0.95rem;
    color: #999;
    margin: 0 0 32px;
}

.login-form {
    width: 100%;
    max-width: 360px;
}

.login-field {
    text-align: left;
    margin-bottom: 16px;
}

.login-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid #e8e6e3;
    background: #f5f4f1;
    font-size: 0.95rem;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.login-input:focus {
    border-color: #3d7c4f;
    background: #fff;
}

.login-input::placeholder { color: #bbb; }

.login-error {
    color: #c0392b;
    font-size: 0.85rem;
    margin: 0 0 12px;
    text-align: left;
}

.login-btn {
    width: 100%;
    padding: 16px;
    border: 0;
    border-radius: 14px;
    background: #3d7c4f;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.2s;
    box-shadow: 0 4px 14px rgba(61, 124, 79, 0.3);
}

.login-btn:hover { background: #356d45; }

.login-forgot {
    font-size: 0.85rem;
    color: #3d7c4f;
    margin: 14px 0 0;
    cursor: pointer;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: #ccc;
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e8e6e3;
}

.login-social {
    width: 100%;
    padding: 14px;
    border: 1.5px solid #e8e6e3;
    border-radius: 14px;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s;
}

.login-social:hover { background: #faf9f6; }

.login-register {
    margin-top: 28px;
    font-size: 0.9rem;
    color: #999;
}

.login-register-link {
    border: 0;
    background: transparent;
    color: #3d7c4f;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* ── Profile Page ── */
.profile-page { text-align: center; }

.household-card {
    background: #fff;
    border-radius: 18px;
    padding: 18px 20px 22px;
    margin: 24px 0 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
    text-align: left;
}

.household-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.household-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.household-icon {
    width: 20px;
    height: 20px;
    color: #555;
}

.invite-btn {
    border: 0;
    background: transparent;
    color: #3d7c4f;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
}

.invite-btn:hover { text-decoration: underline; }

.household-members {
    display: flex;
    gap: 16px;
}

.member {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f0eeeb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.member-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a1a1a;
}

.member-role {
    font-size: 0.68rem;
    color: #999;
}

/* ── Settings List ── */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 0;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 1px 6px rgba(0,0,0,.04);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.15s;
}

.settings-row:hover { background: #faf9f6; }

.settings-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0eeeb;
}

.settings-icon svg {
    width: 18px;
    height: 18px;
    color: #3d7c4f;
}

.settings-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-text strong {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
}

.settings-text span {
    font-size: 0.8rem;
    color: #999;
}

.settings-arrow {
    flex-shrink: 0;
    font-size: 1.4rem;
    color: #ccc;
    font-weight: 300;
}

/* ── Logout Button ── */
.logout-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 16px;
    border: 0;
    border-radius: 16px;
    background: #fce8e8;
    color: #c0392b;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.logout-btn:hover { background: #f9d6d6; }

/* ── Bottom Nav ── */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 480px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: #fff;
    border-top: 1px solid #eee;
    padding: 6px 4px 10px;
    z-index: 100;
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 0;
    background: transparent;
    padding: 6px 4px;
    color: #bbb;
    cursor: pointer;
    transition: color 0.15s;
}

.tab:hover { color: #888; }

.tab.active {
    color: #3d7c4f;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: block;
    stroke-width: 1.6;
}

.tab.active .nav-icon {
    width: 26px;
    height: 26px;
    stroke-width: 2.2;
    filter: drop-shadow(0 1px 3px rgba(61, 107, 79, 0.3));
}

.nav-label {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: inherit;
}

.tab.active .nav-label {
    font-weight: 800;
    font-size: 0.72rem;
}
