/* ============================================================
   Budget Food Calculator — Main Stylesheet
   Colors: Primary #2E7D32 | Secondary #66BB6A | Accent #FFB300
   ============================================================ */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: #222; background: #fff; line-height: 1.65; }
img { max-width: 100%; height: auto; display: block; }
a { color: #2E7D32; text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; }

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:   #2E7D32;
  --primary-d: #1b5e20;
  --secondary: #66BB6A;
  --accent:    #FFB300;
  --accent-d:  #e65100;
  --bg:        #ffffff;
  --bg-light:  #f4f7f4;
  --border:    #e0e0e0;
  --text:      #222222;
  --text-muted:#666666;
  --radius:    8px;
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.14);
  --transition:all .2s ease;
}

/* ── Utility ────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 1rem; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-1 { margin-top:.5rem; } .mt-2 { margin-top:1rem; } .mt-3 { margin-top:1.5rem; } .mt-4 { margin-top:2rem; }
.mb-1 { margin-bottom:.5rem; } .mb-2 { margin-bottom:1rem; } .mb-3 { margin-bottom:1.5rem; } .mb-4 { margin-bottom:2rem; }
.badge { display:inline-block; padding:.2em .65em; border-radius:999px; font-size:.75rem; font-weight:600; background:var(--bg-light); color:var(--text-muted); }
.badge-green { background:#e8f5e9; color:var(--primary); }
.badge-amber { background:#fff8e1; color:#b45309; }

/* ── Grid ───────────────────────────────────────────────────── */
.grid { display:grid; gap:1.5rem; }
.grid-2 { grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); }
.grid-3 { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); }
.grid-4 { grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); }
@media(min-width:768px){ .grid-2{ grid-template-columns:repeat(2,1fr); } }
@media(min-width:1024px){ .grid-3{ grid-template-columns:repeat(3,1fr); } .grid-4{ grid-template-columns:repeat(4,1fr); } }

/* ── Typography ─────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { line-height:1.25; font-weight:700; }
h1 { font-size:clamp(1.75rem,4vw,2.75rem); }
h2 { font-size:clamp(1.4rem,3vw,2rem); }
h3 { font-size:1.25rem; }
h4 { font-size:1.1rem; }
p  { margin-bottom:1rem; }
p:last-child { margin-bottom:0; }
strong { font-weight:700; }
.lead { font-size:1.15rem; color:var(--text-muted); }
.section-title { text-align:center; margin-bottom:2rem; }
.section-title h2 { margin-bottom:.5rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn { display:inline-flex; align-items:center; gap:.4em; padding:.6em 1.4em; border:none; border-radius:var(--radius); cursor:pointer; font-weight:600; font-size:.95rem; transition:var(--transition); text-decoration:none; }
.btn-primary   { background:var(--primary);   color:#fff; }
.btn-primary:hover  { background:var(--primary-d); color:#fff; text-decoration:none; }
.btn-secondary { background:var(--secondary); color:#fff; }
.btn-secondary:hover{ background:#43a047; color:#fff; text-decoration:none; }
.btn-accent    { background:var(--accent);    color:#222; }
.btn-accent:hover   { background:var(--accent-d); color:#fff; text-decoration:none; }
.btn-outline   { background:transparent; border:2px solid var(--primary); color:var(--primary); }
.btn-outline:hover  { background:var(--primary); color:#fff; text-decoration:none; }
.btn-danger    { background:#d32f2f; color:#fff; }
.btn-danger:hover   { background:#b71c1c; text-decoration:none; }
.btn-sm { padding:.35em .85em; font-size:.85rem; }
.btn-lg { padding:.75em 2em; font-size:1.1rem; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header { background:#fff; border-bottom:1px solid var(--border); position:sticky; top:0; z-index:1000; box-shadow:var(--shadow); }
.header-inner { display:flex; align-items:center; justify-content:space-between; height:64px; }
.site-logo { display:flex; align-items:center; font-size:1.25rem; font-weight:800; color:var(--primary); text-decoration:none; gap:.5rem; }
.logo-text { color:var(--primary); }
.logo-text span { color:var(--accent); }
.site-nav ul { display:flex; gap:.25rem; align-items:center; }
.site-nav > ul > li > a { padding:.45em .7em; border-radius:var(--radius); font-size:.9rem; font-weight:500; color:var(--text); transition:var(--transition); }
.site-nav > ul > li > a:hover { background:var(--bg-light); color:var(--primary); text-decoration:none; }
.site-nav .has-dropdown { position:relative; }
.site-nav .dropdown { display:none; position:absolute; top:100%; left:0; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-lg); min-width:220px; z-index:100; padding:.5rem 0; }
.site-nav .has-dropdown:hover .dropdown,
.site-nav .has-dropdown:focus-within .dropdown { display:block; }
.site-nav .dropdown li a { display:block; padding:.55em 1rem; font-size:.875rem; color:var(--text); }
.site-nav .dropdown li a:hover { background:var(--bg-light); text-decoration:none; }
.nav-toggle { display:none; flex-direction:column; justify-content:space-around; width:32px; height:28px; background:none; border:none; cursor:pointer; padding:0; }
.nav-toggle span { width:100%; height:2px; background:var(--text); border-radius:2px; transition:var(--transition); display:block; }
@media(max-width:767px){
  .nav-toggle { display:flex; }
  .site-nav { display:none; position:fixed; top:64px; left:0; right:0; bottom:0; background:#fff; overflow-y:auto; padding:1rem; z-index:999; }
  .site-nav.open { display:block; }
  .site-nav ul { flex-direction:column; gap:0; }
  .site-nav > ul > li > a { display:block; padding:.75em .5em; font-size:1rem; border-bottom:1px solid var(--border); }
  .site-nav .dropdown { position:static; box-shadow:none; border:none; padding:.25rem 0 0 1rem; }
  .site-nav .has-dropdown:hover .dropdown { display:block; }
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero { background:linear-gradient(135deg,var(--primary) 0%,#388e3c 100%); color:#fff; padding:4rem 0; text-align:center; }
.hero h1 { color:#fff; margin-bottom:1rem; }
.hero .lead { color:rgba(255,255,255,.85); margin-bottom:2rem; }
.hero-cta { display:flex; gap:1rem; justify-content:center; flex-wrap:wrap; }
.hero-cta .btn-accent { font-size:1.05rem; padding:.7em 1.8em; }

/* ── Section ────────────────────────────────────────────────── */
.section { padding:4rem 0; }
.section-alt { background:var(--bg-light); }
.section-green { background:var(--primary); color:#fff; }
.section-green h2, .section-green h3 { color:#fff; }
.section-green p { color:rgba(255,255,255,.88); }

/* ── Cards ──────────────────────────────────────────────────── */
.card { background:#fff; border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; transition:var(--transition); display:flex; flex-direction:column; }
.card:hover { box-shadow:var(--shadow-lg); transform:translateY(-2px); }
.card-img { width:100%; aspect-ratio:16/9; object-fit:cover; background:var(--bg-light); }
.card-img-placeholder { width:100%; aspect-ratio:16/9; background:linear-gradient(135deg,#e8f5e9,#c8e6c9); display:flex; align-items:center; justify-content:center; font-size:3rem; }
.card-body { padding:1.25rem; flex:1; display:flex; flex-direction:column; }
.card-body h3 { margin-bottom:.5rem; font-size:1.05rem; }
.card-body p  { color:var(--text-muted); font-size:.9rem; flex:1; }
.card-meta { display:flex; gap:1rem; flex-wrap:wrap; font-size:.8rem; color:var(--text-muted); margin-top:auto; padding-top:.75rem; border-top:1px solid var(--border); margin-top:.75rem; }
.card-meta span { display:flex; align-items:center; gap:.3em; }
.card-footer { padding:.75rem 1.25rem; background:var(--bg-light); border-top:1px solid var(--border); }

/* ── Recipe Card ────────────────────────────────────────────── */
.recipe-card .price { font-size:1.25rem; font-weight:700; color:var(--primary); }
.recipe-card .per-serving { font-size:.8rem; color:var(--text-muted); }

/* ── Calculator Cards ───────────────────────────────────────── */
.calc-card { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:2rem; box-shadow:var(--shadow); }
.calc-card h2 { color:var(--primary); margin-bottom:1.5rem; }
.calc-result { background:var(--bg-light); border:2px solid var(--secondary); border-radius:var(--radius); padding:1.5rem; margin-top:1.5rem; display:none; }
.calc-result.show { display:block; }
.result-row { display:flex; justify-content:space-between; padding:.5rem 0; border-bottom:1px solid var(--border); }
.result-row:last-child { border-bottom:none; font-weight:700; font-size:1.1rem; color:var(--primary); }
.result-label { color:var(--text-muted); }
.result-value { font-weight:600; }
.rating-tight    { color:#d32f2f; }
.rating-moderate { color:#f57c00; }
.rating-comfortable { color:var(--primary); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom:1.25rem; }
.form-label { display:block; font-weight:600; margin-bottom:.4rem; font-size:.9rem; }
.form-control { width:100%; padding:.6em .85em; border:1px solid var(--border); border-radius:var(--radius); font-size:1rem; transition:var(--transition); background:#fff; color:var(--text); }
.form-control:focus { outline:none; border-color:var(--secondary); box-shadow:0 0 0 3px rgba(102,187,106,.2); }
.form-control.error { border-color:#d32f2f; }
.form-hint  { font-size:.8rem; color:var(--text-muted); margin-top:.3rem; }
.form-error { font-size:.8rem; color:#d32f2f; margin-top:.3rem; }
select.form-control { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right .7em center; padding-right:2.5em; }
textarea.form-control { min-height:140px; resize:vertical; }
.form-row { display:grid; gap:1rem; }
@media(min-width:600px){ .form-row { grid-template-columns:1fr 1fr; } }
.form-check { display:flex; align-items:center; gap:.5rem; }
.form-check input[type=checkbox] { width:1.1em; height:1.1em; accent-color:var(--primary); }
.form-actions { display:flex; gap:.75rem; flex-wrap:wrap; align-items:center; margin-top:1.5rem; }

/* ── Alert ──────────────────────────────────────────────────── */
.alert { padding:1rem 1.25rem; border-radius:var(--radius); margin-bottom:1.5rem; font-weight:500; }
.alert-success { background:#e8f5e9; color:#1b5e20; border-left:4px solid var(--primary); }
.alert-error   { background:#ffebee; color:#b71c1c; border-left:4px solid #d32f2f; }
.alert-info    { background:#e3f2fd; color:#0d47a1; border-left:4px solid #1565c0; }

/* ── Breadcrumbs ────────────────────────────────────────────── */
.breadcrumb { padding:.75rem 0; font-size:.85rem; }
.breadcrumb ol { display:flex; flex-wrap:wrap; gap:.35rem; }
.breadcrumb li { display:flex; align-items:center; color:var(--text-muted); }
.breadcrumb li::after { content:'/'; margin-left:.35rem; color:var(--border); }
.breadcrumb li:last-child::after { display:none; }
.breadcrumb li a { color:var(--primary); }
.breadcrumb li:last-child { color:var(--text); }

/* ── Page Hero ──────────────────────────────────────────────── */
.page-hero { background:var(--bg-light); border-bottom:1px solid var(--border); padding:2.5rem 0; }
.page-hero h1 { margin-bottom:.5rem; }
.page-hero .lead { margin-bottom:0; }

/* ── Feature boxes ──────────────────────────────────────────── */
.feature-box { text-align:center; padding:2rem 1.5rem; }
.feature-icon { width:64px; height:64px; background:var(--bg-light); border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:1.75rem; margin:0 auto 1rem; }
.feature-box h3 { margin-bottom:.5rem; }
.feature-box p { color:var(--text-muted); font-size:.9rem; }

/* ── Stats strip ─────────────────────────────────────────────── */
.stats-strip { background:var(--primary); color:#fff; padding:2rem 0; }
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:1.5rem; text-align:center; }
.stat-num { font-size:2.25rem; font-weight:800; color:var(--accent); display:block; line-height:1; }
.stat-label { font-size:.9rem; opacity:.85; }

/* ── Recipe detail ───────────────────────────────────────────── */
.recipe-detail { max-width:800px; margin:0 auto; }
.recipe-hero-img { width:100%; max-height:420px; object-fit:cover; border-radius:var(--radius); margin-bottom:2rem; }
.recipe-meta-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:1rem; background:var(--bg-light); border-radius:var(--radius); padding:1.25rem; margin-bottom:2rem; }
.recipe-meta-item { text-align:center; }
.recipe-meta-item .label { font-size:.75rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; }
.recipe-meta-item .value { font-size:1.15rem; font-weight:700; color:var(--primary); }
.recipe-ingredients h3, .recipe-instructions h3 { color:var(--primary); border-bottom:2px solid var(--secondary); padding-bottom:.5rem; margin-bottom:1rem; }
.recipe-ingredients ul { list-style:disc; padding-left:1.5rem; }
.recipe-ingredients li { padding:.2rem 0; }
.recipe-instructions ol { list-style:decimal; padding-left:1.5rem; }
.recipe-instructions li { padding:.4rem 0; }

/* ── Article ─────────────────────────────────────────────────── */
.article-body { max-width:780px; margin:0 auto; }
.article-body h2 { color:var(--primary); margin:2rem 0 .75rem; }
.article-body h3 { margin:1.5rem 0 .5rem; }
.article-body ul { list-style:disc; padding-left:1.5rem; margin-bottom:1rem; }
.article-body ol { list-style:decimal; padding-left:1.5rem; margin-bottom:1rem; }
.article-body li { margin-bottom:.3rem; }
.article-body blockquote { border-left:4px solid var(--secondary); padding:.75rem 1rem; background:var(--bg-light); border-radius:0 var(--radius) var(--radius) 0; margin:1.5rem 0; color:var(--text-muted); font-style:italic; }
.article-body table { width:100%; border-collapse:collapse; margin:1.5rem 0; font-size:.9rem; }
.article-body th { background:var(--primary); color:#fff; text-align:left; padding:.6em .9em; }
.article-body td { padding:.5em .9em; border-bottom:1px solid var(--border); }
.article-body tr:nth-child(even) td { background:var(--bg-light); }
.article-hero-img { width:100%; max-height:400px; object-fit:cover; border-radius:var(--radius); margin-bottom:2rem; }
.article-byline { color:var(--text-muted); font-size:.875rem; margin-bottom:2rem; }

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:1rem 1.25rem; margin-bottom:2rem; display:flex; gap:1rem; flex-wrap:wrap; align-items:flex-end; }
.filter-bar .form-group { margin-bottom:0; flex:1; min-width:160px; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { margin:2.5rem 0 0; }
.pagination ul { display:flex; justify-content:center; gap:.5rem; flex-wrap:wrap; }
.pagination li a { display:block; padding:.45em .9em; border:1px solid var(--border); border-radius:var(--radius); color:var(--primary); transition:var(--transition); }
.pagination li.active a, .pagination li a:hover { background:var(--primary); color:#fff; border-color:var(--primary); text-decoration:none; }

/* ── Table ───────────────────────────────────────────────────── */
.data-table { width:100%; border-collapse:collapse; font-size:.9rem; }
.data-table th { background:var(--primary); color:#fff; text-align:left; padding:.65em .9em; white-space:nowrap; }
.data-table td { padding:.55em .9em; border-bottom:1px solid var(--border); vertical-align:middle; }
.data-table tr:hover td { background:var(--bg-light); }
.table-responsive { overflow-x:auto; border-radius:var(--radius); border:1px solid var(--border); }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer { background:#1a1a1a; color:#ccc; margin-top:4rem; }
.footer-inner { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:2rem; padding:3rem 0; }
.footer-col h3 { color:#fff; font-size:1rem; margin-bottom:1rem; }
.footer-col p  { font-size:.875rem; line-height:1.6; }
.footer-col ul li { margin-bottom:.4rem; }
.footer-col ul li a { color:#bbb; font-size:.875rem; }
.footer-col ul li a:hover { color:#fff; text-decoration:none; }
.footer-bottom { border-top:1px solid #333; padding:1rem 0; text-align:center; }
.footer-bottom p { font-size:.8rem; color:#888; margin:0; }
.social-links { display:flex; gap:.75rem; margin-top:1rem; }
.social-links a { color:#bbb; font-size:1.2rem; }
.social-links a:hover { color:#fff; }

/* ── Admin layout ────────────────────────────────────────────── */
.admin-body { background:var(--bg-light); min-height:100vh; }
.admin-header { background:var(--primary); color:#fff; padding:0 1.5rem; height:60px; display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:200; box-shadow:var(--shadow); }
.admin-header .brand { font-weight:700; font-size:1.1rem; color:#fff; text-decoration:none; }
.admin-header .brand span { color:var(--accent); }
.admin-header-right { display:flex; align-items:center; gap:1rem; font-size:.875rem; }
.admin-header-right a { color:rgba(255,255,255,.85); }
.admin-header-right a:hover { color:#fff; }
.admin-wrap { display:flex; min-height:calc(100vh - 60px); }
.admin-sidebar { width:220px; min-width:220px; background:#fff; border-right:1px solid var(--border); padding:1.5rem 0; }
.admin-sidebar-link { display:flex; align-items:center; gap:.7rem; padding:.65rem 1.25rem; font-size:.9rem; color:var(--text); transition:var(--transition); border-left:3px solid transparent; }
.admin-sidebar-link:hover { background:var(--bg-light); color:var(--primary); text-decoration:none; }
.admin-sidebar-link.active { background:#e8f5e9; color:var(--primary); border-left-color:var(--primary); font-weight:600; }
.admin-sidebar-section { padding:.4rem 1.25rem; font-size:.7rem; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.1em; margin-top:1rem; }
.admin-main { flex:1; padding:2rem; overflow-x:hidden; }
.admin-card { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:1.5rem; margin-bottom:1.5rem; box-shadow:var(--shadow); }
.admin-page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.5rem; flex-wrap:wrap; gap:1rem; }
.admin-page-header h1 { font-size:1.5rem; }
.stat-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:1rem; margin-bottom:2rem; }
.stat-card { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:1.25rem; text-align:center; box-shadow:var(--shadow); }
.stat-card .num { font-size:2rem; font-weight:800; color:var(--primary); line-height:1; }
.stat-card .lbl { font-size:.8rem; color:var(--text-muted); margin-top:.25rem; }
@media(max-width:900px){
  .admin-sidebar { display:none; }
  .admin-main { padding:1rem; }
}

/* ── Login page ──────────────────────────────────────────────── */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg-light); padding:1rem; }
.login-box { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:2.5rem; width:100%; max-width:420px; box-shadow:var(--shadow-lg); }
.login-box h1 { text-align:center; color:var(--primary); margin-bottom:1.75rem; font-size:1.5rem; }

/* ── Tips page ───────────────────────────────────────────────── */
.tips-list { counter-reset:tip; }
.tip-item { counter-increment:tip; display:flex; gap:1.25rem; padding:1.5rem 0; border-bottom:1px solid var(--border); }
.tip-item:last-child { border-bottom:none; }
.tip-num { width:2.5rem; height:2.5rem; min-width:2.5rem; border-radius:50%; background:var(--primary); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:.9rem; }
.tip-content h3 { margin-bottom:.3rem; }
.tip-content p { font-size:.9rem; color:var(--text-muted); margin:0; }

/* ── Related section ─────────────────────────────────────────── */
.related-section { margin-top:3rem; padding-top:2rem; border-top:2px solid var(--border); }
.related-section h2 { margin-bottom:1.5rem; }

/* ── SVG placeholders ────────────────────────────────────────── */
.img-placeholder { background:linear-gradient(135deg,#e8f5e9 0%,#c8e6c9 100%); display:flex; align-items:center; justify-content:center; color:var(--primary); font-size:3rem; }

/* ── Responsive helpers ──────────────────────────────────────── */
@media(max-width:600px){
  .section { padding:2.5rem 0; }
  .hero { padding:2.5rem 0; }
  .filter-bar { flex-direction:column; }
}
