/* ===== RESET & VARIABLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --sage: #4A6741;
    --sage-light: #6B8F62;
    --sage-50: rgba(74, 103, 65, 0.08);
    --sage-100: rgba(74, 103, 65, 0.15);
    --cream: #FDF8F0;
    --warm-white: #FFFBF5;
    --terracotta: #C4704B;
    --terracotta-light: #E8956E;
    --charcoal: #1A1A1A;
    --stone: #8A8578;
    --sand: #E8DFD0;
    --sand-light: #F2EDE4;
    --danger: #dc3545;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--charcoal);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 { font-family: 'Syne', sans-serif; letter-spacing: -0.02em; }
h1 { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
h2 { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
h3 { font-size: 1.2rem; font-weight: 700; }
.text-muted { color: var(--stone); font-size: 0.85rem; }
.text-danger { color: var(--danger) !important; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: 100px; font-weight: 600; font-size: 0.9rem;
    font-family: inherit; cursor: pointer; transition: all var(--transition);
    border: 2px solid transparent; text-decoration: none; line-height: 1.4;
}
.btn-primary {
    background: var(--sage); color: white; border-color: var(--sage);
}
.btn-primary:hover { background: var(--sage-light); border-color: var(--sage-light); transform: translateY(-1px); }
.btn-secondary {
    background: var(--terracotta); color: white; border-color: var(--terracotta);
}
.btn-secondary:hover { background: var(--terracotta-light); transform: translateY(-1px); }
.btn-outline {
    background: transparent; color: var(--charcoal); border-color: var(--sand);
}
.btn-outline:hover { border-color: var(--sage); color: var(--sage); }
.btn-ghost { background: transparent; color: var(--sage); border: none; padding: 8px 12px; }
.btn-ghost:hover { background: var(--sage-50); }
.btn-sm { padding: 6px 16px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===== NAVIGATION ===== */
.app-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 28px; gap: 24px;
    background: rgba(253,248,240,0.92);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.nav-logo {
    font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 800;
    color: var(--sage); text-decoration: none; flex-shrink: 0;
}
.nav-logo span { color: var(--terracotta); }
.nav-links { display: flex; gap: 8px; }
.nav-link {
    padding: 6px 14px; font-size: 0.88rem; font-weight: 500; color: var(--stone);
    text-decoration: none; border-radius: 100px; transition: all var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--charcoal); background: var(--sage-50); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.plan-badge {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    padding: 3px 10px; border-radius: 100px; background: var(--sand); color: var(--stone);
}
.plan-badge.premium { background: var(--sage); color: white; }
.nav-user-menu { position: relative; }
.nav-avatar {
    width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--sand);
    background: var(--sage-50); display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-weight: 700; font-size: 0.85rem; color: var(--sage);
    font-family: inherit; transition: all var(--transition);
}
.nav-avatar:hover { border-color: var(--sage); }
.nav-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
    background: var(--warm-white); border: 1px solid var(--sand); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 200;
}
.nav-dropdown.show { display: block; }
.dropdown-header { padding: 8px 12px; }
.dropdown-header span { display: block; }
.dropdown-header span:first-child { font-weight: 600; font-size: 0.9rem; }
.nav-dropdown hr { border: none; border-top: 1px solid var(--sand); margin: 4px 0; }
.dropdown-item {
    display: block; width: 100%; text-align: left; padding: 8px 12px; font-size: 0.88rem;
    color: var(--charcoal); text-decoration: none; border-radius: var(--radius-sm);
    font-family: inherit; background: none; border: none; cursor: pointer; transition: background var(--transition);
}
.dropdown-item:hover { background: var(--sage-50); }
.mobile-menu-btn {
    display: none; flex-direction: column; gap: 5px; background: none; border: none;
    cursor: pointer; padding: 8px;
}
.mobile-menu-btn span { display: block; width: 22px; height: 2px; background: var(--charcoal); border-radius: 2px; transition: all var(--transition); }
.mobile-menu {
    display: none; position: fixed; top: 60px; left: 0; right: 0; z-index: 99;
    background: var(--warm-white); border-bottom: 1px solid var(--sand);
    padding: 16px 24px; flex-direction: column; gap: 8px;
    box-shadow: var(--shadow-lg);
}
.mobile-menu.show { display: flex; }
.mobile-menu a, .mobile-menu button { display: block; padding: 12px 0; font-size: 1rem; color: var(--charcoal); text-decoration: none; font-weight: 500; }
.mobile-menu hr { border: none; border-top: 1px solid var(--sand); }

@media (max-width: 768px) {
    .nav-links, .nav-right { display: none; }
    .mobile-menu-btn { display: flex; }
}

/* ===== LAYOUT ===== */
.page-container {
    max-width: 1120px; margin: 0 auto; padding: 100px 24px 60px;
}
.page-header {
    text-align: center; margin-bottom: 48px;
}
.page-header p { color: var(--stone); font-size: 1.05rem; margin-top: 12px; max-width: 560px; margin-left: auto; margin-right: auto; }
.page-label {
    display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.12em; color: var(--sage); margin-bottom: 12px;
}

/* ===== RECIPE GRID ===== */
.recipe-filters {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; align-items: center;
}
.filter-chip {
    padding: 7px 16px; border-radius: 100px; font-size: 0.82rem; font-weight: 600;
    border: 1.5px solid var(--sand); background: transparent; color: var(--stone);
    cursor: pointer; transition: all var(--transition); font-family: inherit;
}
.filter-chip:hover { border-color: var(--sage-light); color: var(--sage); }
.filter-chip.active { background: var(--sage); color: white; border-color: var(--sage); }
.search-input {
    flex: 1; min-width: 200px; padding: 8px 16px; border-radius: 100px;
    border: 1.5px solid var(--sand); font-size: 0.88rem; font-family: inherit;
    background: var(--warm-white); color: var(--charcoal); transition: border var(--transition);
}
.search-input:focus { outline: none; border-color: var(--sage); }
.search-input::placeholder { color: var(--stone); }

.recipe-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px;
}

.recipe-card {
    background: var(--warm-white); border-radius: var(--radius-lg); overflow: hidden;
    border: 1px solid rgba(0,0,0,0.04); transition: all 0.3s ease; cursor: pointer;
    position: relative; text-decoration: none; color: inherit; display: block;
}
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.recipe-card.locked { opacity: 0.85; }
.recipe-card.locked::after {
    content: '🔒 Premium'; position: absolute; top: 12px; right: 12px;
    background: var(--sage); color: white; padding: 4px 12px; border-radius: 100px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
}
.recipe-card-visual {
    height: 160px; display: flex; align-items: center; justify-content: center;
    font-size: 4rem; position: relative; overflow: hidden;
}
.recipe-card-visual.early { background: linear-gradient(135deg, #e8f5e9, #f1f8e9); }
.recipe-card-visual.building { background: linear-gradient(135deg, #fff3e0, #fce4ec); }
.recipe-card-visual.momentum { background: linear-gradient(135deg, #e3f2fd, #e8eaf6); }
.recipe-card-visual.maintenance { background: linear-gradient(135deg, #fce4ec, #f3e5f5); }
.recipe-card-body { padding: 20px; }
.recipe-card-meta {
    display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}
.recipe-tag {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 3px 8px; border-radius: 4px;
}
.recipe-tag.stage { background: var(--sage-50); color: var(--sage); }
.recipe-tag.category { background: rgba(196,112,75,0.1); color: var(--terracotta); }
.recipe-card h3 { font-size: 1.05rem; margin-bottom: 6px; line-height: 1.3; }
.recipe-card p { font-size: 0.82rem; color: var(--stone); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-card-stats {
    display: flex; gap: 16px; margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--sand-light);
}
.recipe-stat { font-size: 0.75rem; color: var(--stone); }
.recipe-stat strong { color: var(--charcoal); font-weight: 700; }

/* ===== RECIPE DETAIL ===== */
.recipe-detail {
    max-width: 800px; margin: 0 auto; padding: 100px 24px 60px;
}
.recipe-detail-header {
    text-align: center; margin-bottom: 40px;
}
.recipe-detail-emoji { font-size: 5rem; margin-bottom: 16px; display: block; }
.recipe-detail-header h1 { margin-bottom: 12px; }
.recipe-detail-header p { color: var(--stone); font-size: 1.05rem; max-width: 600px; margin: 0 auto 24px; line-height: 1.7; }
.recipe-detail-stats {
    display: flex; justify-content: center; gap: 24px; flex-wrap: wrap;
}
.detail-stat {
    text-align: center; padding: 16px 20px; background: var(--warm-white);
    border-radius: var(--radius); border: 1px solid var(--sand-light); min-width: 100px;
}
.detail-stat-value { font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 800; color: var(--terracotta); }
.detail-stat-label { font-size: 0.72rem; color: var(--stone); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.recipe-content-grid {
    display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; margin-top: 40px;
}
@media (max-width: 768px) { .recipe-content-grid { grid-template-columns: 1fr; } }

.recipe-section { margin-bottom: 32px; }
.recipe-section h2 { font-size: 1.2rem; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--sage-50); }
.ingredient-list { list-style: none; }
.ingredient-list li {
    padding: 10px 0; border-bottom: 1px solid var(--sand-light); font-size: 0.92rem; display: flex; align-items: baseline; gap: 10px;
}
.ingredient-list li::before { content: '•'; color: var(--sage); font-weight: 700; flex-shrink: 0; }
.instruction-list { list-style: none; counter-reset: step; }
.instruction-list li {
    padding: 14px 0; border-bottom: 1px solid var(--sand-light); font-size: 0.92rem;
    display: flex; gap: 14px; line-height: 1.6;
}
.instruction-list li::before {
    counter-increment: step; content: counter(step);
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; min-width: 28px; border-radius: 50%;
    background: var(--sage); color: white; font-size: 0.78rem; font-weight: 700;
}
.recipe-tip {
    background: var(--sage-50); border-left: 4px solid var(--sage);
    padding: 16px 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem; line-height: 1.6; color: var(--charcoal);
}
.recipe-tip strong { color: var(--sage); }

/* ===== PREMIUM GATE ===== */
.premium-gate {
    text-align: center; padding: 80px 24px;
    background: linear-gradient(180deg, var(--cream), var(--warm-white));
    border-radius: var(--radius-lg); border: 2px dashed var(--sand);
    margin-top: 40px;
}
.premium-gate h2 { margin-bottom: 12px; }
.premium-gate p { color: var(--stone); margin-bottom: 24px; max-width: 420px; margin-left: auto; margin-right: auto; }
.premium-gate .price-highlight {
    font-family: 'Syne', sans-serif; font-size: 2.4rem; font-weight: 800; color: var(--sage); margin-bottom: 4px;
}
.premium-gate .price-sub { font-size: 0.85rem; color: var(--stone); margin-bottom: 24px; }

/* ===== PRICING PAGE ===== */
.pricing-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 800px; margin: 0 auto;
}
@media (max-width: 640px) { .pricing-grid { grid-template-columns: 1fr; } }

.pricing-card {
    background: var(--warm-white); border-radius: var(--radius-lg); padding: 40px 32px;
    border: 2px solid var(--sand-light); position: relative; transition: all 0.3s ease;
}
.pricing-card.featured {
    border-color: var(--sage); box-shadow: 0 8px 40px rgba(74,103,65,0.15);
    transform: scale(1.02);
}
.pricing-card.featured::before {
    content: 'Most Popular'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    background: var(--terracotta); color: white; padding: 4px 16px; border-radius: 100px;
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.pricing-card h3 { font-size: 1.3rem; margin-bottom: 8px; }
.pricing-card .price {
    font-family: 'Syne', sans-serif; font-size: 2.8rem; font-weight: 800; margin: 16px 0 4px;
}
.pricing-card .price-period { font-size: 0.85rem; color: var(--stone); margin-bottom: 24px; display: block; }
.pricing-card .price span { font-size: 1rem; font-weight: 500; color: var(--stone); }
.pricing-features { list-style: none; margin-bottom: 32px; }
.pricing-features li {
    padding: 8px 0; font-size: 0.9rem; display: flex; align-items: baseline; gap: 10px;
}
.pricing-features li::before { content: '✓'; color: var(--sage); font-weight: 700; }
.pricing-features li.disabled { opacity: 0.4; }
.pricing-features li.disabled::before { content: '—'; color: var(--stone); }

/* ===== AUTH PAGES ===== */
.auth-container {
    max-width: 420px; margin: 0 auto; padding: 120px 24px 60px;
}
.auth-card {
    background: var(--warm-white); border-radius: var(--radius-lg); padding: 40px 32px;
    border: 1px solid var(--sand-light); box-shadow: var(--shadow-md);
}
.auth-card h1 { font-size: 1.8rem; text-align: center; margin-bottom: 8px; }
.auth-card .auth-sub { text-align: center; color: var(--stone); margin-bottom: 28px; font-size: 0.92rem; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--charcoal); }
.form-input {
    width: 100%; padding: 11px 16px; border: 1.5px solid var(--sand); border-radius: var(--radius-sm);
    font-size: 0.92rem; font-family: inherit; background: var(--cream);
    transition: border var(--transition); color: var(--charcoal);
}
.form-input:focus { outline: none; border-color: var(--sage); background: white; }
.form-error { color: var(--danger); font-size: 0.82rem; margin-top: 4px; display: none; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.88rem; color: var(--stone); }
.auth-footer a { color: var(--sage); font-weight: 600; text-decoration: none; }

/* ===== MEAL PLANS ===== */
.meal-plan-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; flex-wrap: wrap; gap: 16px;
}
.stage-selector {
    display: flex; gap: 8px;
}
.meal-plan-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.meal-day-card {
    background: var(--warm-white); border-radius: var(--radius); padding: 24px;
    border: 1px solid var(--sand-light);
}
.meal-day-card h3 { font-size: 1rem; margin-bottom: 16px; color: var(--sage); }
.meal-slot { padding: 8px 0; border-bottom: 1px solid var(--sand-light); }
.meal-slot:last-child { border-bottom: none; }
.meal-slot-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--stone); }
.meal-slot-title { font-size: 0.88rem; font-weight: 600; margin-top: 2px; }
.meal-slot-title a { color: var(--charcoal); text-decoration: none; }
.meal-slot-title a:hover { color: var(--sage); }

/* ===== UPGRADE BANNER ===== */
.upgrade-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
    background: var(--charcoal); color: white; padding: 14px 24px;
}
.upgrade-banner-inner {
    max-width: 1120px; margin: 0 auto; display: flex; align-items: center;
    justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.upgrade-banner-inner span { font-size: 0.9rem; }

/* ===== PAYMENT CONFIRM BANNER ===== */
.payment-confirm-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 95;
    background: var(--sage); color: white; padding: 14px 24px;
}
.payment-confirm-inner {
    max-width: 1120px; margin: 0 auto; display: flex; align-items: center;
    justify-content: center; gap: 12px; flex-wrap: wrap;
}
.payment-confirm-inner .btn-outline { border-color: rgba(255,255,255,0.5); color: white; }

/* ===== TOAST ===== */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--charcoal); color: white; padding: 12px 24px;
    border-radius: 100px; font-size: 0.88rem; font-weight: 500; z-index: 200;
    box-shadow: var(--shadow-lg); animation: toast-in 0.3s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== LOADING ===== */
.loading-spinner {
    display: flex; justify-content: center; align-items: center; min-height: 60vh;
}
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--sand); border-top-color: var(--sage);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center; padding: 60px 24px; color: var(--stone);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--charcoal); margin-bottom: 8px; }

/* ===== ACCOUNT PAGE ===== */
.account-card {
    background: var(--warm-white); border-radius: var(--radius-lg); padding: 32px;
    border: 1px solid var(--sand-light); margin-bottom: 20px;
}
.account-card h2 { font-size: 1.2rem; margin-bottom: 16px; }
.account-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--sand-light);
}
.account-row:last-child { border-bottom: none; }
.account-label { font-size: 0.85rem; color: var(--stone); }
.account-value { font-weight: 600; font-size: 0.92rem; }

/* ===== RECIPE COUNT BADGE ===== */
.recipe-count {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.88rem; color: var(--stone); margin-bottom: 24px;
}
.recipe-count strong { color: var(--charcoal); }

/* ===== FILTER GROUPS ===== */
.filter-section {
    margin-bottom: 12px;
}
.filter-section-label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--stone); margin-bottom: 8px; display: block;
}
.filter-row {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.filter-chip.dietary { border-color: rgba(196,112,75,0.3); }
.filter-chip.dietary.active { background: var(--terracotta); border-color: var(--terracotta); color: white; }
.filter-chip.dietary:hover { border-color: var(--terracotta-light); color: var(--terracotta); }
.filter-chip.time { border-color: rgba(138,133,120,0.3); }
.filter-chip.time.active { background: var(--stone); border-color: var(--stone); color: white; }
.filter-chip.time:hover { border-color: var(--stone); color: var(--charcoal); }
.active-filters {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.active-filter-tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.75rem; font-weight: 600; padding: 4px 12px;
    border-radius: 100px; background: var(--sage-50); color: var(--sage);
    border: none; cursor: pointer; font-family: inherit; transition: all var(--transition);
}
.active-filter-tag:hover { background: var(--sage-100); }
.active-filter-tag .close { font-size: 0.9rem; line-height: 1; }
.dietary-badge {
    display: inline-block; font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; padding: 2px 7px; border-radius: 3px;
    background: rgba(196,112,75,0.08); color: var(--terracotta);
}
.recipe-card-dietary {
    display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px;
}
.recipe-detail-dietary {
    display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 16px;
}
.recipe-detail-dietary .dietary-badge {
    font-size: 0.7rem; padding: 4px 10px; border-radius: 100px;
    background: var(--sage-50); color: var(--sage);
}
.fiber-stat { color: var(--sage) !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--sand); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--stone); }
