/* Layout: header fixo com busca, faixa de categorias, feed de promoções em lista + barra lateral de cupons */
:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #efedf8;
  --ink: #161a33;
  --muted: #5d6080;
  --line: #e2e0ef;
  --purple: #6d28d9;
  --purple-soft: #ede6ff;
  --orange: #ff7a00;
  --orange-deep: #f2540f;
  --on-orange: #ffffff;
  --hot: #e5381f;
  --cold: #2f7fe0;
  --good: #158a4a;
  --shadow: 0 1px 2px rgba(22, 26, 51, .06), 0 6px 18px rgba(22, 26, 51, .06);
  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1122; --surface: #181b33; --surface-2: #22264a; --ink: #f1f0fa; --muted: #a3a6c7;
    --line: #2c3058; --purple: #a98bff; --purple-soft: #2a2357; --orange: #ff8a1f; --orange-deep: #ff6a2b;
    --hot: #ff6a52; --cold: #6aa8ff; --good: #4cd38a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1122; --surface: #181b33; --surface-2: #22264a; --ink: #f1f0fa; --muted: #a3a6c7;
  --line: #2c3058; --purple: #a98bff; --purple-soft: #2a2357; --orange: #ff8a1f; --orange-deep: #ff6a2b;
  --hot: #ff6a52; --cold: #6aa8ff; --good: #4cd38a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; text-wrap: balance; margin: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand b { font-family: var(--display); font-size: 1.55rem; font-weight: 800; letter-spacing: -.01em; line-height: 1; }
.brand b span {
  font-size: .62em; color: var(--on-orange); background: linear-gradient(90deg, var(--orange), var(--orange-deep));
  padding: 1px 6px 0; border-radius: 6px; margin-left: 3px; vertical-align: 3px;
}
.search { flex: 1; min-width: 0; position: relative; }
.search input {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: 999px;
  padding: 10px 16px 10px 40px; outline: none;
}
.search input:focus { border-color: var(--purple); background: var(--surface); }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.nav { display: flex; gap: 6px; flex-shrink: 0; }
.nav a {
  text-decoration: none; font-weight: 700; padding: 9px 14px; border-radius: 999px; color: var(--muted); white-space: nowrap;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--purple); background: var(--purple-soft); }

.cats { border-top: 1px solid var(--line); }
.cats-in {
  max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.cats-in::-webkit-scrollbar { display: none; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px;
  font-weight: 600; font-size: .9rem; white-space: nowrap; color: var(--muted);
}
.chip:hover { border-color: var(--purple); color: var(--purple); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ---------- layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.wrap.single { grid-template-columns: minmax(0, 1fr); max-width: 900px; }
@media (max-width: 900px) { .wrap { grid-template-columns: minmax(0, 1fr); } .side { order: 2; } }

.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.feed-head h1 { font-size: 1.7rem; font-weight: 800; }
.tabs { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 700; color: var(--muted); font-size: .9rem; }
.tabs button[aria-pressed="true"] { background: var(--purple); color: #fff; }

.demo-note {
  font-size: .85rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--line);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 14px;
}

/* ---------- card de promoção ---------- */
.list { display: grid; gap: 12px; }
.deal {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 16px; padding: 14px; box-shadow: var(--shadow);
  transition: border-color .15s;
}
.deal:hover { border-color: color-mix(in srgb, var(--purple) 40%, var(--line)); }
.deal.expired { opacity: .62; }
.thumb {
  aspect-ratio: 1; max-width: 100%; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center;
  overflow: hidden; position: relative; cursor: pointer; border: 0; padding: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.thumb svg { width: 46%; height: 46%; }
.off {
  position: absolute; left: 6px; top: 6px; background: var(--good); color: #fff; font-weight: 800; font-size: .78rem;
  border-radius: 6px; padding: 1px 6px;
}
.body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.row1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.temp { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.temp button { border: 0; background: none; width: 32px; height: 30px; display: grid; place-items: center; color: var(--muted); }
.temp button svg { width: 16px; height: 16px; }
.temp button.down:hover, .temp button.down[aria-pressed="true"] { color: var(--cold); background: color-mix(in srgb, var(--cold) 12%, transparent); }
.temp button.up:hover, .temp button.up[aria-pressed="true"] { color: var(--hot); background: color-mix(in srgb, var(--hot) 12%, transparent); }
.temp b { min-width: 52px; text-align: center; font-family: var(--display); font-size: 1.05rem; font-weight: 800; padding-top: 2px; }
.temp.t-cold b { color: var(--cold); } .temp.t-warm b { color: var(--orange-deep); } .temp.t-hot b { color: var(--hot); }
.temp.t-hot { border-color: color-mix(in srgb, var(--hot) 45%, var(--line)); }
.when { font-size: .82rem; color: var(--muted); }
.tag-exp { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); color: var(--muted); border-radius: 6px; padding: 2px 7px; }

.deal h2 { font-family: var(--body); font-size: 1.04rem; font-weight: 700; line-height: 1.3; }
.deal h2 a { text-decoration: none; }
.deal h2 a:hover { color: var(--purple); }
.price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price strong { font-family: var(--display); font-size: 1.55rem; font-weight: 800; color: var(--good); line-height: 1; padding-top: 4px; }
.price s { color: var(--muted); font-size: .9rem; }
.meta { font-size: .86rem; color: var(--muted); display: flex; gap: 6px 12px; flex-wrap: wrap; }
.meta .store { font-weight: 700; color: var(--purple); }

.row3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.coupon {
  display: inline-flex; align-items: center; gap: 8px; border: 1.5px dashed var(--orange); background: color-mix(in srgb, var(--orange) 9%, var(--surface));
  border-radius: 8px; padding: 5px 6px 5px 10px; font-weight: 800; letter-spacing: .04em; font-size: .88rem;
}
.coupon button { border: 0; background: var(--orange); color: var(--on-orange); border-radius: 6px; padding: 3px 9px; font-weight: 700; font-size: .8rem; letter-spacing: 0; }
.comments-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: .88rem; font-weight: 600; background: none; border: 0; padding: 6px 4px; }
.comments-link svg { width: 17px; height: 17px; }
.comments-link:hover { color: var(--purple); }
.go {
  margin-left: auto; text-decoration: none; background: linear-gradient(180deg, var(--orange), var(--orange-deep)); color: var(--on-orange);
  font-weight: 800; padding: 9px 16px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--orange-deep) 60%, #000);
}
.go:hover { filter: brightness(1.05); }
.go svg { width: 15px; height: 15px; }
.expired .go { background: var(--surface-2); color: var(--muted); box-shadow: none; }

@media (max-width: 560px) {
  .deal { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .price strong { font-size: 1.3rem; }
  .go { margin-left: 0; width: 100%; justify-content: center; }
  .nav a.hide-sm { display: none; }
  .brand b { display: none; }
  .top-in { gap: 10px; }
}

.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------- lateral ---------- */
.side { display: grid; gap: 16px; align-content: start; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.box h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 10px; }
.cp-list { display: grid; gap: 10px; }
.cp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cp:last-child { border-bottom: 0; padding-bottom: 0; }
.cp small { color: var(--muted); grid-column: 1 / -1; font-size: .82rem; }
.cp .store { font-weight: 700; }
.hero-box { background: linear-gradient(135deg, var(--purple), #4c1d95); color: #fff; border: 0; }
.hero-box p { margin: 6px 0 0; opacity: .9; font-size: .92rem; }
.stores { display: flex; flex-wrap: wrap; gap: 6px; }
.disclosure { font-size: .82rem; color: var(--muted); }

/* ---------- modal de detalhe ---------- */
dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(720px, calc(100% - 24px)); max-height: calc(100% - 24px);
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(15, 17, 34, .55); }
.dlg { padding: 20px; display: grid; gap: 16px; }
.dlg-top { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; }
@media (max-width: 560px) { .dlg-top { grid-template-columns: minmax(0, 1fr); } .dlg-top .thumb { max-width: 180px; } }
.dlg h2 { font-family: var(--body); font-size: 1.25rem; font-weight: 800; }
.dlg .desc { white-space: pre-wrap; color: var(--ink); margin: 0; }
.close { position: sticky; top: 0; float: right; margin: 10px 10px 0 0; border: 0; background: var(--surface-2); width: 36px; height: 36px; border-radius: 50%; font-size: 1.2rem; z-index: 1; }
.cmts { display: grid; gap: 10px; }
.cmt { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.cmt b { font-size: .9rem; } .cmt time { font-size: .8rem; color: var(--muted); margin-left: 6px; }
.cmt p { margin: 3px 0 0; }

/* ---------- formulários / admin ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form { grid-template-columns: minmax(0, 1fr); } }
label { display: grid; gap: 4px; font-weight: 700; font-size: .88rem; }
label small { font-weight: 500; color: var(--muted); }
input[type="text"], input[type="url"], input[type="number"], input[type="password"], select, textarea {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface); width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--purple); outline: none; }
textarea { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; background: var(--purple); color: #fff; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--hot); border: 1.5px solid currentColor; }
.btn.sm { padding: 6px 10px; font-size: .85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-row:last-child { border-bottom: 0; }
.admin-row .t { font-weight: 700; overflow-wrap: anywhere; }
.admin-row small { color: var(--muted); }
.err { color: var(--hot); font-weight: 700; margin: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; background: var(--ink); color: var(--surface);
  padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 50; box-shadow: var(--shadow);
}

footer { border-top: 1px solid var(--line); background: var(--surface); }
footer .in { max-width: 1180px; margin: 0 auto; padding: 22px 16px; display: flex; gap: 12px 24px; flex-wrap: wrap; align-items: center; justify-content: space-between; color: var(--muted); font-size: .88rem; }
footer img { height: 54px; width: auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; }
@media (max-width: 560px) { .tabs button { padding: 6px 10px; font-size: .84rem; } .feed-head h1 { font-size: 1.45rem; } }
