/* ════════════════════════════════════════════════════════════════════════════
   Commonpot — Shared Stylesheet
   All pages link this file. Page-specific styles stay inline.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Georgia, serif; background: #faf8f4; color: #1e1e1e; }

/* ── Top Nav ───────────────────────────────────────────────────────────────── */
body > nav { background: #fff; border-bottom: 1px solid #e8e0d8; padding: 0 1.5rem; display: flex; align-items: center; gap: 1.25rem; height: 56px; position: sticky; top: 0; z-index: 100; }
body > nav .logo, .logo { font-size: 1.3rem; font-weight: 700; color: #5c3d1e; text-decoration: none; letter-spacing: -.5px; }
.logo span { color: #b45309; }
body > nav a { color: #555; text-decoration: none; font-size: .9rem; }
body > nav a:hover { color: #b45309; }
body > nav a.active { color: #b45309; font-weight: 600; }
#nav-auth { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.nav-btn { background: #5c3d1e; color: #fff !important; padding: .35rem .9rem; border-radius: 5px; font-size: .85rem; }
.nav-btn:hover { background: #7a5230 !important; }
.nav-signout { font-size: .8rem; color: #bbb !important; }
.nav-signout:hover { color: #b45309 !important; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.layout { max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem; display: grid; grid-template-columns: 220px 1fr; gap: 2rem; }
@media (max-width: 700px) { .layout { grid-template-columns: 1fr; } }
.container { max-width: 900px; margin: 0 auto; padding: 2rem 1.25rem; }
.main-content { min-width: 0; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-nav { background: #fff; border: 1px solid #e8e0d8; border-radius: 8px; padding: .5rem; display: flex; flex-direction: column; gap: .15rem; }
.sidebar-nav a { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-radius: 5px; text-decoration: none; color: #444; font-size: .9rem; transition: background .12s; }
.sidebar-nav a:hover { background: #fef3c7; color: #92400e; }
.sidebar-nav a.active { background: #fef3c7; color: #92400e; font-weight: 600; }
.sidebar-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #bbb; padding: .25rem .75rem; margin-top: .5rem; }
.sidebar-toggle { cursor: pointer; user-select: none; transition: color .15s; }
.sidebar-toggle:hover { color: #b45309 !important; }
.sidebar-group { display: flex; flex-direction: column; gap: .15rem; }

/* ── Profile card (sidebar) ────────────────────────────────────────────────── */
.profile-card { background: #fff; border: 1px solid #e8e0d8; border-radius: 8px; padding: 1.25rem; text-align: center; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: #e8d5b7; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; margin: 0 auto .75rem; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-weight: 700; font-size: 1.05rem; color: #3d2000; }
.profile-username { font-size: .8rem; color: #999; margin-bottom: .75rem; }
.house-item { display: flex; align-items: center; gap: .5rem; padding: .4rem .75rem; border-radius: 5px; text-decoration: none; color: #444; font-size: .875rem; }
.house-item:hover { background: #fef3c7; color: #92400e; }
.house-dot { width: 8px; height: 8px; border-radius: 50%; background: #b45309; flex-shrink: 0; }

/* ── Form Elements ─────────────────────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="url"], input[type="tel"], input[type="number"], input[type="date"],
input[type="time"], input[type="datetime-local"], textarea, select {
  width: 100%; padding: .7rem .9rem; border: 1.5px solid #e0d8ce; border-radius: 8px;
  font-family: Georgia, serif; font-size: .9rem; color: #2d1a00; background: #faf8f4;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
input:hover, textarea:hover, select:hover { border-color: #c8b89a; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #b45309; background: #fff;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, .08), 0 1px 3px rgba(0,0,0,.06);
}
input::placeholder, textarea::placeholder { color: #c0b5a5; font-style: italic; }
textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='%23a0937f'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center; background-size: 10px;
  padding-right: 2.25rem; cursor: pointer;
}
label { display: block; font-size: .78rem; font-weight: 600; color: #8a7560; margin-bottom: .4rem; margin-top: 1.25rem;
  text-transform: uppercase; letter-spacing: .04em; }
label:first-child, .form-row label { margin-top: 0; }
.form-hint { font-size: .75rem; color: #b0a590; margin-top: .2rem; line-height: 1.4; font-style: italic; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; }

/* Checkbox & radio */
input[type="checkbox"], input[type="radio"] {
  width: auto; padding: 0; margin: 0;
  accent-color: #b45309; cursor: pointer;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn { padding: .55rem 1.15rem; border-radius: 8px; font-family: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: all .18s ease; line-height: 1.4; }
.btn-primary { background: #5c3d1e; color: #fff; }
.btn-primary:hover { background: #4a3018; box-shadow: 0 3px 12px rgba(92,61,30,.25); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(92,61,30,.2); }
.btn-outline { background: #fff; border-color: #d8cfc4; color: #5c3d1e; }
.btn-outline:hover { border-color: #b45309; color: #b45309; background: #fffbf5; box-shadow: 0 2px 8px rgba(180,83,9,.08); }
.btn-sm { padding: .4rem .9rem; background: #5c3d1e; color: #fff; border: none; border-radius: 7px; font-size: .8rem; font-weight: 600; font-family: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; transition: all .18s ease; }
.btn-sm:hover { background: #4a3018; box-shadow: 0 2px 8px rgba(92,61,30,.2); transform: translateY(-1px); }
.btn-sm:active { transform: translateY(0); }
.btn-cancel { background: transparent; border: 1.5px solid #ddd5c8; color: #8a7560; padding: .55rem 1.15rem; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .875rem; font-weight: 500; transition: all .18s ease; }
.btn-cancel:hover { border-color: #c0a880; color: #5c3d1e; background: #faf5ee; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid #e8e0d8; border-radius: 8px; overflow: hidden; transition: box-shadow .15s, transform .15s; cursor: pointer; text-decoration: none; color: inherit; display: block; }
.card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.1); transform: translateY(-2px); }
.card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #f0ebe3; display: flex; align-items: center; justify-content: center; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .placeholder { font-size: 2.5rem; }
.card-body { padding: .9rem 1rem; }
.card-title { font-size: 1rem; font-weight: 700; line-height: 1.3; margin-bottom: .35rem; color: #2d1a00; }
.card-meta { font-size: .78rem; color: #888; display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .4rem; }
.card-tags { display: flex; gap: .3rem; flex-wrap: wrap; }

/* ── Recipe cards (compact) ────────────────────────────────────────────────── */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.recipe-card { border: 1px solid #e8e0d8; border-radius: 6px; overflow: hidden; text-decoration: none; color: inherit; display: block; transition: box-shadow .12s; }
.recipe-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.recipe-thumb { aspect-ratio: 4/3; background: #f0ebe3; display: flex; align-items: center; justify-content: center; font-size: 2rem; overflow: hidden; }
.recipe-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recipe-info { padding: .6rem .75rem; }
.recipe-info strong { font-size: .875rem; display: block; line-height: 1.3; }
.recipe-info span { font-size: .75rem; color: #999; }

/* ── Panels ────────────────────────────────────────────────────────────────── */
.panel { background: #fff; border: 1px solid #e8e0d8; border-radius: 8px; padding: 1.5rem; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.panel-header h2 { font-size: 1rem; color: #3d2000; }

/* ── Grid ──────────────────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.section { max-width: 1100px; margin: 2rem auto; padding: 0 1.25rem; }
.section-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.25rem; }
.section-header h2 { font-size: 1.15rem; color: #3d2000; }

/* ── Tags & Badges ─────────────────────────────────────────────────────────── */
.tag { background: #fef3c7; color: #92400e; border-radius: 3px; padding: .1rem .45rem; font-size: .72rem; }
.stars { color: #f59e0b; font-size: .8rem; }
.diet-pref-chip, .diet-chip { background: #f5f0e8; border: 1px solid #e8e0d8; border-radius: 20px; padding: .2rem .7rem; font-size: .78rem; color: #5c3d1e; cursor: pointer; transition: background .12s, border-color .12s; user-select: none; }
.diet-pref-chip:hover, .diet-chip:hover { background: #fde68a; border-color: #f0dfc0; }
.diet-pref-chip.active, .diet-chip.active { background: #fde68a; border-color: #b45309; color: #92400e; font-weight: 600; }

/* ── Modals ─────────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(30,20,10,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: #fffcf8; border-radius: 14px; padding: 2.25rem 2rem; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(30,20,10,.18), 0 0 0 1px rgba(200,180,150,.15); }
.modal h3 { font-size: 1.2rem; margin-bottom: .35rem; color: #3d2000; font-weight: 700; }
.modal h3 + p, .modal-subtitle { font-size: .85rem; color: #a0937f; margin-bottom: 1.25rem; line-height: 1.5; }
.modal hr { border: none; border-top: 1px solid #ede5d8; margin: 1.25rem 0; }
.modal-actions { display: flex; gap: .75rem; margin-top: 2rem; justify-content: flex-end; padding-top: 1.35rem; border-top: 1px solid #ede5d8; }

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e8e0d8; margin-bottom: 1.75rem; }
.tab { padding: .6rem 1.1rem; font-size: .875rem; color: #888; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.tab:hover { color: #5c3d1e; }
.tab.active { color: #5c3d1e; border-bottom-color: #b45309; font-weight: 700; }

/* ── Empty states ──────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 2rem 1rem; color: #bbb; font-size: .9rem; }
.empty-state { text-align: center; padding: 2rem 1rem; color: #bbb; font-size: .9rem; }

/* ── Activity feed ─────────────────────────────────────────────────────────── */
.feed-list { display: flex; flex-direction: column; gap: .5rem; }
.feed-item { display: flex; align-items: center; gap: .85rem; padding: .7rem .9rem; background: #fff; border: 1px solid #e8e0d8; border-radius: 7px; text-decoration: none; color: inherit; transition: box-shadow .12s; }
.feed-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.feed-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e8d5b7; display: flex; align-items: center; justify-content: center; font-size: .85rem; flex-shrink: 0; overflow: hidden; }
.feed-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-text { flex: 1; font-size: .875rem; line-height: 1.4; }
.feed-text strong { color: #3d2000; }
.feed-text .feed-recipe { color: #b45309; font-weight: 600; }
.feed-time { font-size: .72rem; color: #bbb; flex-shrink: 0; }
.feed-thumb { width: 48px; height: 36px; border-radius: 4px; object-fit: cover; background: #f0ebe3; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; overflow: hidden; }
.feed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.count { font-size: .85rem; color: #999; }

/* ── Skeleton loading ──────────────────────────────────────────────────────── */
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.card-skeleton { background: #fff; border: 1px solid #e8e0d8; border-radius: 8px; overflow: hidden; }
.sk { background: linear-gradient(90deg, #f0ebe3 25%, #fffbf3 50%, #f0ebe3 75%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: 4px; }
.sk-img { aspect-ratio: 4/3; border-radius: 0; }
.sk-body { padding: .9rem 1rem; display: flex; flex-direction: column; gap: .55rem; }
.sk-title { height: 16px; }
.sk-meta { height: 11px; width: 55%; }
.sk-tag { height: 11px; width: 35%; }

/* ── Load more ─────────────────────────────────────────────────────────────── */
.load-more { display: block; margin: 2rem auto; padding: .65rem 2rem; background: #fff; border: 1px solid #ddd; border-radius: 6px; font-family: inherit; font-size: .9rem; cursor: pointer; color: #555; }
.load-more:hover { border-color: #b45309; color: #b45309; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer { text-align: center; padding: 1.5rem 2rem; color: #aaa; font-size: .8rem; border-top: 1px solid #e8e0d8; margin-top: 3rem; }
footer a { color: #b45309; text-decoration: none; }
footer a:hover { text-decoration: underline; }
.footer-links { display: flex; gap: 1.25rem; justify-content: center; margin-bottom: .5rem; }
.footer-copy { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.footer-privacy { background: #f5f5f5; border: 1px solid #e8e0d8; border-radius: 20px; padding: .15rem .65rem; font-size: .72rem; color: #888 !important; letter-spacing: .01em; text-decoration: none !important; }
.footer-privacy:hover { border-color: #b45309; color: #b45309 !important; }

/* ── Local sub-nav (vendors, gardens, surplus, markets pages) ──────────────── */
.local-subnav { display: flex; gap: 1rem; justify-content: center; padding: .75rem 1rem; background: #fff; border-bottom: 1px solid #e8e0d8; font-size: .9rem; flex-wrap: wrap; }
.local-subnav a { color: #555; text-decoration: none; padding: .3rem .6rem; border-radius: 5px; }
.local-subnav a:hover { color: #b45309; background: #fef3c7; }
.local-subnav a.active { color: #b45309; font-weight: 600; background: #fef3c7; }

/* ── Lazy loading ──────────────────────────────────────────────────────────── */
img[loading="lazy"] { opacity: 0; transition: opacity .3s ease; }
img[loading="lazy"].loaded { opacity: 1; }
/* Reveal immediately if JS hasn't run yet (noscript fallback) */
@media (scripting: none) { img[loading="lazy"] { opacity: 1; } }

/* ── Accessibility ─────────────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid #b45309; outline-offset: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid #b45309; outline-offset: 2px; }
[role="button"] { cursor: pointer; }

/* ── Print base ────────────────────────────────────────────────────────────── */
@media print {
  body > nav, footer, .sidebar, .cp-ver, .cp-bell { display: none !important; }
  body { background: #fff !important; }
}
