/* ============================================================================
   Poultry Marketplace - site.css
   Single stylesheet for the entire public site + dashboard + admin shells.
   Tokens at the top map to /data/config.json brand colors. When the brand is
   re-themed, change tokens only.
   ============================================================================ */

:root {
  --c-ink:     #0E1A0F;
  --c-paper:   #FBF8F1;
  --c-primary: #1A2E1B;
  --c-accent:  #C8A84E;
  --c-muted:   #6E7A6F;
  --c-line:    #E5DFCF;
  --c-soft:    #F2EDDF;
  --c-danger:  #A8362A;
  --c-success: #3F7A3F;
  --c-warn:    #C77A1F;

  --f-head: "Bebas Neue", "Oswald", "Impact", system-ui, sans-serif;
  --f-body: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(14,26,15,.06);
  --shadow-md: 0 4px 14px rgba(14,26,15,.08);
  --shadow-lg: 0 10px 40px rgba(14,26,15,.12);

  --max: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--c-ink);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--f-head);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0 0 .4em;
  color: var(--c-ink);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); line-height: 1.1; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }
small, .small { font-size: .85rem; color: var(--c-muted); }
hr { border: 0; border-top: 1px solid var(--c-line); margin: 2rem 0; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.section { padding: 56px 0; }
.section--soft { background: var(--c-soft); }
.section--ink { background: var(--c-ink); color: #FBF8F1; }
.section--ink h1, .section--ink h2, .section--ink h3 { color: #FBF8F1; }

/* ----------------------------- buttons ----------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--f-body);
  font-weight: 600;
  font-size: .95rem;
  padding: 11px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .05s, box-shadow .15s, background .15s, border-color .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: #213a23; }
.btn--accent  { background: var(--c-accent);  color: var(--c-ink); }
.btn--accent:hover { background: #d8b85b; }
.btn--ghost   { background: transparent; color: var(--c-ink); border-color: var(--c-line); }
.btn--ghost:hover { border-color: var(--c-ink); }
.btn--danger  { background: var(--c-danger); color: #fff; }
.btn--lg { padding: 14px 28px; font-size: 1.05rem; }
.btn--sm { padding: 7px 12px; font-size: .85rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ----------------------------- chips / badges ----------------------------- */
.chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--c-soft);
  color: var(--c-ink);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .03em;
  border: 1px solid var(--c-line);
}
.chip--accent  { background: var(--c-accent); border-color: var(--c-accent); }
.chip--primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.chip--success { background: #E2EFE2; color: var(--c-success); border-color: #C7DEC7; }
.chip--warn    { background: #FBEFD9; color: var(--c-warn); border-color: #F0DEB1; }
.chip--danger  { background: #F7DDD9; color: var(--c-danger); border-color: #ECC0BA; }
.chip--featured { background: var(--c-accent); color: var(--c-ink); }
.chip--npip    { background: #DCEBE0; color: #1f4d2a; border-color: #C0D9C7; }

/* ----------------------------- forms ----------------------------- */
.field { display: block; margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.field .help { font-size: .8rem; color: var(--c-muted); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="url"], input[type="password"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: #fff;
  font-family: var(--f-body);
  font-size: 1rem;
  color: var(--c-ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(26,46,27,.12);
}
textarea { min-height: 120px; resize: vertical; font-family: var(--f-body); }
.fieldset { border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 18px; margin: 0 0 18px; }
.fieldset > legend { font-weight: 600; padding: 0 8px; }
.checkbox-row { display: flex; gap: 8px; align-items: flex-start; }
.checkbox-row input { margin-top: 4px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-form { grid-template-columns: 1fr; } }

/* ----------------------------- header ----------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251,248,241,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-line);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}
.site-header .logo {
  font-family: var(--f-head);
  font-size: 1.6rem;
  letter-spacing: .04em;
  color: var(--c-ink);
}
.site-header .logo span { color: var(--c-accent); }
.site-header nav {
  flex: 1;
  display: flex;
  gap: 22px;
  font-weight: 500;
  font-size: .95rem;
}
.site-header nav a { color: var(--c-ink); }
.site-header nav a:hover { color: var(--c-primary); text-decoration: none; }
.site-header .header-cta { display: flex; gap: 10px; align-items: center; }
@media (max-width: 880px) {
  .site-header nav { display: none; }
  .site-header .container { gap: 12px; }
}

/* ----------------------------- hero ----------------------------- */
.hero {
  position: relative;
  padding: 72px 0 88px;
  background: linear-gradient(180deg, #FBF8F1 0%, #F2EDDF 100%);
  overflow: hidden;
}
.hero h1 { max-width: 780px; }
.hero .lede { max-width: 640px; font-size: 1.15rem; color: var(--c-muted); margin-bottom: 28px; }
.hero .hero-search {
  display: flex;
  gap: 8px;
  max-width: 640px;
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow: var(--shadow-sm);
}
.hero .hero-search input {
  border: 0;
  flex: 1;
  background: transparent;
  font-size: 1rem;
}
.hero .hero-search input:focus { box-shadow: none; }
.hero .trust-row { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 26px; color: var(--c-muted); font-size: .9rem; }
.hero .trust-row strong { color: var(--c-ink); display: block; font-family: var(--f-head); font-size: 1.6rem; line-height: 1; }

/* ----------------------------- category grid ----------------------------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.cat-tile {
  display: block;
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
  color: inherit;
}
.cat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.cat-tile .tile-img {
  aspect-ratio: 4 / 3;
  background: var(--c-soft);
  background-size: cover;
  background-position: center;
}
.cat-tile .tile-body { padding: 14px 14px 16px; }
.cat-tile h3 { margin: 0 0 4px; font-size: 1.1rem; }
.cat-tile p { margin: 0; font-size: .85rem; color: var(--c-muted); }

/* ----------------------------- listing card ----------------------------- */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.listing-card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.listing-card .photo {
  aspect-ratio: 4 / 3;
  background: var(--c-soft) center/cover no-repeat;
  position: relative;
}
.listing-card .photo .overlay {
  position: absolute;
  top: 10px; left: 10px;
  display: flex;
  gap: 6px;
}
.listing-card .body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.listing-card h3 { font-size: 1.1rem; margin: 0 0 4px; }
.listing-card h3 a { color: var(--c-ink); }
.listing-card .meta { font-size: .82rem; color: var(--c-muted); margin-bottom: 8px; }
.listing-card .price { font-family: var(--f-head); font-size: 1.5rem; color: var(--c-primary); margin-top: auto; }
.listing-card .price small { font-size: .7rem; color: var(--c-muted); font-family: var(--f-body); margin-left: 4px; }

/* ----------------------------- search page ----------------------------- */
.search-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  padding: 28px 0 56px;
}
@media (max-width: 880px) { .search-shell { grid-template-columns: 1fr; } }
.filters {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 18px;
  position: sticky;
  top: 80px;
  align-self: start;
}
.filters h4 { margin-top: 0; font-family: var(--f-body); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.filters .filter-group { padding: 12px 0; border-top: 1px solid var(--c-line); }
.filters .filter-group:first-of-type { border-top: 0; }
.filters label { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; cursor: pointer; }
.search-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 30px 0 0;
}
.pagination button { background: #fff; border: 1px solid var(--c-line); padding: 8px 14px; border-radius: var(--r-md); cursor: pointer; }
.pagination button.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--c-muted); }

/* ----------------------------- listing detail ----------------------------- */
.detail-shell {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 36px;
  padding: 28px 0 56px;
}
@media (max-width: 880px) { .detail-shell { grid-template-columns: 1fr; } }
.detail-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.detail-gallery .hero-img {
  aspect-ratio: 4 / 3;
  background: var(--c-soft) center/cover no-repeat;
  border-radius: var(--r-lg);
}
.detail-gallery .thumb-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.detail-gallery .thumb-row .thumb {
  aspect-ratio: 1;
  background: var(--c-soft) center/cover no-repeat;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 2px solid transparent;
}
.detail-gallery .thumb-row .thumb.active { border-color: var(--c-accent); }
.detail-info .price { font-family: var(--f-head); font-size: 2.4rem; color: var(--c-primary); margin: 0 0 10px; }
.detail-info .seller-card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 18px 0;
  display: flex;
  gap: 12px;
  align-items: center;
}
.detail-info .seller-card .avatar {
  width: 52px; height: 52px;
  background: var(--c-soft) center/cover no-repeat;
  border-radius: 50%;
}
.detail-info .seller-card .info { flex: 1; }
.detail-info .seller-card .name { font-weight: 600; }
.attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  margin: 14px 0;
}
.attr-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--c-line);
  vertical-align: top;
}
.attr-table td:first-child { color: var(--c-muted); width: 40%; }

/* ----------------------------- footer ----------------------------- */
.site-footer {
  background: var(--c-ink);
  color: #C9D1CA;
  padding: 50px 0 30px;
  margin-top: 60px;
}
.site-footer a { color: #fff; opacity: .8; }
.site-footer a:hover { opacity: 1; text-decoration: none; }
.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-grid h4 { color: #fff; font-family: var(--f-body); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.foot-grid ul { list-style: none; padding: 0; margin: 0; }
.foot-grid li { margin-bottom: 8px; font-size: .92rem; }
.foot-bar {
  border-top: 1px solid #2A3A2C;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: .85rem;
  color: #8A958C;
}

/* ----------------------------- dashboard / admin ----------------------------- */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
@media (max-width: 880px) { .app-shell { grid-template-columns: 1fr; } }
.app-side {
  background: var(--c-ink);
  color: #C9D1CA;
  padding: 22px 0;
}
.app-side .brand {
  font-family: var(--f-head);
  font-size: 1.3rem;
  color: #fff;
  padding: 0 22px 18px;
  border-bottom: 1px solid #2A3A2C;
}
.app-side nav { display: flex; flex-direction: column; padding: 14px 0; }
.app-side nav a {
  color: #C9D1CA;
  padding: 10px 22px;
  font-size: .94rem;
}
.app-side nav a:hover { background: #213a23; color: #fff; text-decoration: none; }
.app-side nav a.active { background: #213a23; color: var(--c-accent); border-left: 3px solid var(--c-accent); padding-left: 19px; }
.app-main { padding: 28px 32px 60px; max-width: 1100px; }
.app-main h1 { font-size: 1.8rem; margin-bottom: 18px; }
.app-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 22px; margin-bottom: 22px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 16px; }
.kpi .num { font-family: var(--f-head); font-size: 2rem; color: var(--c-primary); line-height: 1; }
.kpi .lbl { font-size: .8rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); overflow: hidden; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--c-line); font-size: .92rem; }
.table th { background: var(--c-soft); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }
.table .row-actions { display: flex; gap: 6px; }

/* ----------------------------- toasts / alerts ----------------------------- */
.alert { padding: 12px 16px; border-radius: var(--r-md); border: 1px solid; margin: 10px 0; font-size: .92rem; }
.alert--info    { background: #EAF1F7; border-color: #C5D7E6; color: #244C70; }
.alert--success { background: #E2EFE2; border-color: #C7DEC7; color: #1f4d2a; }
.alert--warn    { background: #FBEFD9; border-color: #F0DEB1; color: #7a4d10; }
.alert--danger  { background: #F7DDD9; border-color: #ECC0BA; color: #6d231a; }

.toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { background: var(--c-ink); color: #fff; padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-lg); animation: tin .25s ease; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ----------------------------- utility ----------------------------- */
.row     { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.stack   { display: flex; flex-direction: column; gap: 14px; }
.center  { text-align: center; }
.muted   { color: var(--c-muted); }
.hide-mobile { display: initial; }
@media (max-width: 640px) { .hide-mobile { display: none; } }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.skeleton { background: linear-gradient(90deg, #efeae0 25%, #f7f3e7 50%, #efeae0 75%); background-size: 200% 100%; animation: sk 1.4s linear infinite; border-radius: var(--r-md); }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
