/* Vitrine pública. O painel admin continua usando style.css. */

:root,
:root[data-theme="dark"] {
    --bg: #0b0f0d;
    --surface: #121915;
    --surface-2: #18211c;
    --line: #25332b;
    --ink: #eaf3ee;
    --muted: #8fa398;
    --accent: #3ddc84;
    --accent-strong: #22c06b;
    --accent-ink: #06140c;
    --accent-soft: rgba(61, 220, 132, 0.12);
    --hot: #ff6b5e;
    --hot-ink: #1a0502;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --photo-bg: #ffffff;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f3f8f5;
    --surface: #ffffff;
    --surface-2: #eaf3ee;
    --line: #d9e7df;
    --ink: #0f1713;
    --muted: #5a6b62;
    --accent: #1f9d55;
    --accent-strong: #178045;
    --accent-ink: #ffffff;
    --accent-soft: rgba(31, 157, 85, 0.1);
    --hot: #e53935;
    --hot-ink: #ffffff;
    --shadow: 0 10px 30px rgba(15, 23, 19, 0.1);
    --photo-bg: #ffffff;
    color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.wrap {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

.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 var(--accent);
    outline-offset: 2px;
}

/* ---------- Cabeçalho ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 18px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand-text small { color: var(--muted); font-size: 12px; }

.search {
    flex: 1;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 42px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    transition: border-color .15s, box-shadow .15s;
}
.search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 14px;
}
.search input::placeholder { color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.icon-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 36px;
    align-items: center;
    padding-top: 44px;
    padding-bottom: 32px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

.hero h1 {
    margin: 16px 0 12px;
    font-size: clamp(30px, 4.6vw, 52px);
    line-height: 1.05;
    letter-spacing: -0.035em;
    font-weight: 800;
    text-wrap: balance;
}
.hero h1 em {
    font-style: normal;
    color: var(--accent);
}
.hero p {
    margin: 0;
    max-width: 52ch;
    color: var(--muted);
    font-size: 17px;
}

.stats {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 18px;
}
.stat dt { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat dd {
    margin: 4px 0 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat dd.small { font-size: 18px; padding-top: 8px; letter-spacing: 0; }

/* ---------- Categorias ---------- */
.rail {
    position: sticky;
    top: 68px;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.chips {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    scroll-snap-align: start;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.chip i { font-size: 14px; color: var(--accent); }
.chip .count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.chip[aria-pressed="true"] i { color: var(--accent-ink); }
.chip[aria-pressed="true"] .count {
    background: rgba(0, 0, 0, 0.18);
    color: var(--accent-ink);
}
.chip.is-empty { opacity: 0.45; }

.chips-divider {
    flex-shrink: 0;
    width: 1px;
    height: 22px;
    margin: 0 6px;
    background: var(--line);
}

/* ---------- Listagem ---------- */
.listing { padding-top: 24px; padding-bottom: 56px; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.result-count { margin: 0; color: var(--muted); font-size: 14px; }
.result-count strong { color: var(--ink); }

.toolbar-controls { display: flex; align-items: center; gap: 16px; }

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.check input {
    width: 18px; height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.select select {
    height: 40px;
    padding: 0 34px 0 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 14px;
    cursor: pointer;
}

.deals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.deal {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    transition: transform .18s, border-color .18s, box-shadow .18s;
}
.deal:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.deal-img {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--photo-bg);
    display: grid;
    place-items: center;
    padding: 18px;
}
.deal-img img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}
.deal-img .no-photo {
    font-size: 44px;
    color: #b8c7be;
}

.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--hot);
    color: var(--hot-ink);
    font-size: 13px;
    font-weight: 800;
}

.deal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    padding: 14px 16px 16px;
}

.deal-cat {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}

.deal-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.deal-price { margin-top: auto; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.deal-price b {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.deal-price s { color: var(--muted); font-size: 14px; }

.deal-time { margin: 0; color: var(--muted); font-size: 12px; }

.deal-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 14px;
    font-weight: 700;
    transition: background .15s;
}
.deal:hover .deal-cta { background: var(--accent-strong); }

/* ---------- Estados vazios ---------- */
.empty {
    text-align: center;
    padding: 64px 20px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    color: var(--muted);
}
.empty[hidden] { display: none; }
.empty i { font-size: 42px; color: var(--accent); margin-bottom: 14px; }
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 20px; }
.empty p { margin: 0 0 16px; }
.empty a { color: var(--accent); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 20px;
    border-radius: 12px;
    border: 0;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    cursor: pointer;
}
.btn:hover { background: var(--accent-strong); }

/* ---------- Rodapé ---------- */
.footer {
    border-top: 1px solid var(--line);
    padding: 28px 0;
    color: var(--muted);
    font-size: 13px;
}
.footer p { margin: 0 0 6px; max-width: 80ch; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; }
}

@media (max-width: 720px) {
    .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
    .brand-text small { display: none; }
    .search { order: 3; flex-basis: 100%; max-width: none; }
    .topbar-actions { margin-left: auto; }
    .btn-ghost span { display: none; }
    .btn-ghost { width: 42px; padding: 0; justify-content: center; }
    .rail { top: 108px; }
    .deals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .deal-body { padding: 10px 12px 12px; }
    .deal-price b { font-size: 19px; }
    .deal-img { padding: 12px; }
    .toolbar-controls { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
