/* Deals & Codes Community — bright & playful public theme + dark admin. */
:root {
  --pink: #ff4d8d;
  --orange: #ff8a3d;
  --yellow: #ffd93d;
  --teal: #17c3b2;
  --purple: #7b61ff;
  --ink: #23203a;
  --paper: #fff9f2;
  --card: #ffffff;
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

/* ---------- header / footer ---------- */
.site-header {
  background: linear-gradient(120deg, var(--pink), var(--orange) 55%, var(--yellow));
  color: #fff;
  text-align: center;
  padding: 28px 16px 22px;
}
.site-header h1 { margin: 0; font-size: 2rem; letter-spacing: .5px; }
.tagline { margin: 6px 0 0; font-weight: 600; opacity: .95; }
.ad-label {
  display: inline-block; margin-top: 10px; padding: 3px 12px;
  background: rgba(0,0,0,.28); border-radius: 999px;
  font-size: .85rem; font-weight: 700;
}
.site-footer {
  text-align: center; padding: 26px 16px 34px; color: #5a5570; font-size: .92rem;
}
.site-footer a { color: var(--purple); font-weight: 700; }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 8px; }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--teal); background: #fff; color: var(--ink);
  padding: 5px 14px; border-radius: 999px; font-weight: 700; cursor: pointer;
}
.chip.active { background: var(--teal); color: #fff; }
#search {
  flex: 1 1 200px; padding: 9px 14px; border-radius: 999px;
  border: 2px solid #e4def5; font-size: 1rem;
}
.layout-toggle { display: flex; margin-left: auto; }
.layout-toggle button {
  border: 2px solid var(--purple); background: #fff; color: var(--ink);
  padding: 5px 12px; font-weight: 700; cursor: pointer;
}
.layout-toggle button:first-child { border-radius: 999px 0 0 999px; }
.layout-toggle button:last-child { border-radius: 0 999px 999px 0; }
.layout-toggle button.active { background: var(--purple); color: #fff; }
.filter-row {
  flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.result-count { font-weight: 700; color: #5a5570; margin-left: auto; }
.clear-filters {
  border: 2px solid var(--pink); background: #fff; color: var(--ink);
  padding: 5px 14px; border-radius: 999px; font-weight: 700; cursor: pointer;
}
.clear-filters[hidden] { display: none; }

/* ---------- layouts (swap via body class) ---------- */
.layout-grid .deals {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.layout-list .deals { display: flex; flex-direction: column; gap: 14px; }
.layout-list .card { flex-direction: row; }
.layout-list .card img, .layout-list .placeholder-tile { width: 180px; height: auto; flex: none; }
.layout-feed .deals {
  display: flex; flex-direction: column; gap: 20px;
  max-width: 560px; margin: 0 auto;
}

/* ---------- deal cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(35,32,58,.10);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
}
.card img { width: 100%; height: 190px; object-fit: cover; background: #f3f0ff; }
.placeholder-tile {
  height: 190px; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #ffe3ee, #ffe3ee 16px, #fff3d6 16px, #fff3d6 32px);
  font-size: 3rem;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.badge-off {
  position: absolute; top: 10px; left: 10px;
  background: var(--pink); color: #fff; font-weight: 900; font-size: 1.05rem;
  padding: 6px 12px; border-radius: 999px; transform: rotate(-4deg);
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
}
.card h3 { margin: 0; font-size: 1rem; line-height: 1.35; }
.deal-type { font-weight: 800; color: var(--purple); font-size: .85rem; text-transform: uppercase; letter-spacing: .4px; }
.price-line { margin: 0; }
.price-now { font-size: 1.25rem; font-weight: 900; color: #e0215f; }
.price-was { text-decoration: line-through; color: #8a86a3; margin-left: 6px; }
.price-note { display: block; font-size: .8rem; color: #5a5570; margin-top: 2px; }
.age { font-size: .85rem; color: #5a5570; margin: 0; }
.stale-note {
  background: #fff3cd; border: 2px dashed var(--orange); color: #7a4b00;
  padding: 7px 10px; border-radius: 10px; font-weight: 700; font-size: .88rem; margin: 0;
}
.fixture-tag {
  align-self: flex-start; background: var(--yellow); color: var(--ink);
  font-size: .75rem; font-weight: 800; padding: 2px 9px; border-radius: 999px;
}
.card-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.btn-shop {
  display: block; text-align: center; text-decoration: none;
  background: linear-gradient(120deg, var(--pink), var(--orange));
  color: #fff; font-weight: 900; padding: 11px; border-radius: 12px; font-size: 1.02rem;
}
.btn-shop.disabled { background: #cfcbe0; pointer-events: none; }
.btn {
  border: none; border-radius: 12px; padding: 10px; font-weight: 800;
  cursor: pointer; font-size: .95rem; background: var(--teal); color: #fff;
}
.btn:disabled { background: #cfcbe0; cursor: default; }
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-box {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #f3f0ff; border: 2px dashed var(--purple); border-radius: 12px;
  font-family: ui-monospace, Menlo, monospace; font-weight: 700; padding: 8px 6px;
  word-break: break-all; text-align: center;
}
.chip-note {
  background: #efeafd; color: var(--purple); font-weight: 700; text-align: center;
  padding: 8px; border-radius: 12px; font-size: .9rem;
}
.codes-left { font-size: .85rem; font-weight: 700; color: #e0215f; text-align: center; margin: 0; }
.claim-warning { font-size: .82rem; color: #7a4b00; margin: 0; text-align: center; }
.report-row { display: flex; gap: 6px; }
.report-btn {
  flex: 1; background: #fff; border: 2px solid #e4def5; color: #5a5570;
  border-radius: 10px; padding: 6px 2px; font-size: .8rem; font-weight: 700; cursor: pointer;
}
.report-btn.thanks { border-color: var(--teal); color: var(--teal); }
.loading, .empty { text-align: center; color: #5a5570; padding: 30px 0; }

/* ---------- terms ---------- */
.terms { max-width: 760px; }
.terms h3 { margin-bottom: 4px; }
.terms p { line-height: 1.55; }
.draft-note {
  background: #fff3cd; border-radius: 10px; padding: 9px 13px; font-weight: 700;
}

/* ---------- admin (dark, distinct) ---------- */
body.admin { background: #14161f; color: #e8eaf2; }
.admin-header { padding: 22px 20px 6px; max-width: 1100px; margin: 0 auto; }
.admin-header h1 { margin: 0; font-size: 1.6rem; }
.admin-sub { color: #9aa0b5; }
.admin-main { max-width: 1100px; }
.sample-banner {
  background: #8a6d00; color: #fff7d6; border: 2px solid #ffd93d;
  font-weight: 800; text-align: center; padding: 10px; border-radius: 12px;
  margin-bottom: 18px; font-size: 1.05rem;
}
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 22px; }
.total-card { background: #1f2333; border-radius: 14px; padding: 16px; text-align: center; }
.total-card .num { font-size: 1.9rem; font-weight: 900; display: block; }
.total-card .lbl { color: #9aa0b5; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; }
.chart-block { background: #1f2333; border-radius: 14px; padding: 18px; margin-bottom: 18px; overflow-x: auto; }
.chart-block h2 { margin-top: 0; font-size: 1.1rem; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: .85rem; }
.legend span::before { content: "■ "; }
body.admin .site-footer { color: #9aa0b5; }
body.admin .site-footer a { color: #9ecbff; }
svg text { fill: #e8eaf2; font-size: 11px; }
svg .bar-label { font-weight: 700; }
