/* Anuncia.lol — estilos base */
:root {
  --bg: #08080c;
  --bg-soft: #101017;
  --card: #15151e;
  --card-2: #1c1c27;
  --line: #262633;
  --text: #f4f4f7;
  --muted: #9a9aad;
  --accent: #c6ff3f;
  --accent-ink: #10160a;
  --hot: #ff4d6d;
  --ok: #38d996;
  --warn: #ffb020;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(0, 0, 0, .45);
  --header-h: 62px;
  --nav-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(198, 255, 63, .09), transparent 60%),
    radial-gradient(800px 400px at -10% 0%, rgba(255, 77, 109, .07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(8, 8, 12, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.12rem; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 900; font-size: 1rem;
  box-shadow: 0 0 0 4px rgba(198, 255, 63, .12);
}
.brand span b { color: var(--accent); }

.header-spacer { flex: 1; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Search */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; flex: 1; max-width: 460px;
}
.search input { background: none; border: 0; outline: 0; width: 100%; }
.search input::placeholder { color: var(--muted); }
.search svg { color: var(--muted); flex: none; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--muted); font-weight: 600; font-size: .9rem;
  white-space: nowrap;
}
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Hero mínimo */
.page-head { padding: 18px 0 4px; }
.page-head h1 { margin: 0; font-size: 1.45rem; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

/* Grid de ofertas */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px 0 28px;
}

.deal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.deal-card:hover { transform: translateY(-3px); border-color: #3a3a4a; box-shadow: var(--shadow); }

.deal-media { position: relative; aspect-ratio: 4 / 3; background: #0f0f16; overflow: hidden; }
.deal-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.deal-card:hover .deal-media img { transform: scale(1.04); }

.badge-discount {
  position: absolute; top: 10px; left: 10px;
  background: var(--hot); color: #fff;
  font-weight: 800; font-size: .82rem;
  padding: 4px 9px; border-radius: 8px;
  box-shadow: 0 4px 14px rgba(255, 77, 109, .35);
}
.badge-merchant {
  position: absolute; bottom: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(8, 8, 12, .82); backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  color: #fff; font-size: .74rem; font-weight: 700;
  padding: 4px 9px; border-radius: 8px;
}
.badge-local {
  position: absolute; top: 10px; right: 10px;
  background: rgba(56, 217, 150, .16); border: 1px solid rgba(56, 217, 150, .5);
  color: var(--ok); font-size: .68rem; font-weight: 700;
  padding: 4px 8px; border-radius: 8px;
}

.deal-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.deal-title {
  font-size: .95rem; font-weight: 700; line-height: 1.32;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; letter-spacing: -.01em;
}
.deal-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.price-row { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.price { font-size: 1.22rem; font-weight: 900; color: var(--accent); letter-spacing: -.02em; }
.price-old { color: var(--muted); text-decoration: line-through; font-size: .85rem; }
.deal-meta { color: var(--muted); font-size: .72rem; display: flex; align-items: center; gap: 4px; }

/* Estado vacío */
.empty {
  text-align: center; padding: 70px 20px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); margin: 20px 0;
}
.empty strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 6px; }

/* Navegación inferior (móvil, app-like) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: rgba(12, 12, 18, .94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: .66rem; font-weight: 700;
}
.bottom-nav a.is-active { color: var(--accent); }
.bottom-nav svg { width: 22px; height: 22px; }

/* Detalle */
.deal-detail { padding: 16px 0 30px; }
.breadcrumb { color: var(--muted); font-size: .82rem; margin-bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; align-items: start; }
.detail-media {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  background: var(--card); position: relative;
}
.detail-media img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #0d0d13; }

.detail-side { position: sticky; top: calc(var(--header-h) + 14px); display: flex; flex-direction: column; gap: 14px; }
.detail-title { font-size: 1.35rem; line-height: 1.3; letter-spacing: -.02em; margin: 0; }
.detail-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.detail-price .price { font-size: 2rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 12px; padding: 13px 20px;
  font-weight: 800; cursor: pointer; text-align: center;
}
.btn:hover { filter: brightness(1.06); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: var(--hot); color: #fff; }
.btn-small { padding: 8px 12px; font-size: .82rem; border-radius: 9px; }

.notice {
  background: rgba(255, 176, 32, .1); border: 1px solid rgba(255, 176, 32, .35);
  color: #ffd591; border-radius: 12px; padding: 10px 12px; font-size: .82rem;
}

.prose { color: #d8d8e2; font-size: .95rem; overflow-wrap: anywhere; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { padding-left: 20px; }
.prose strong { color: #fff; }

.section-title { font-size: 1.05rem; margin: 30px 0 12px; letter-spacing: -.01em; }

/* Aviso afiliados */
.affiliate-note { color: var(--muted); font-size: .74rem; line-height: 1.4; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 12px; padding: 26px 0 30px; color: var(--muted); font-size: .8rem; }
.site-footer a:hover { color: var(--accent); }

/* Flash */
.flashes { position: fixed; top: 72px; right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.flash { padding: 11px 14px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .86rem; }
.flash-success { border-color: rgba(56, 217, 150, .5); color: #b6ffe0; }
.flash-error { border-color: rgba(255, 77, 109, .5); color: #ffc2cc; }

/* Paginación */
.load-more { display: flex; justify-content: center; padding: 8px 0 26px; }

/* Responsive */
@media (max-width: 760px) {
  .search-desktop { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .detail-media img { aspect-ratio: 4 / 3; }
  .deals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 12px; }
  .deal-card { border-radius: 14px; }
  .deal-body { padding: 10px 10px 12px; }
  .deal-title { font-size: .86rem; }
  .price { font-size: 1.05rem; }
  .badge-local { font-size: .62rem; padding: 3px 6px; }
  .page-head h1 { font-size: 1.25rem; }
  .flashes { left: 12px; right: 12px; top: 68px; max-width: none; }
}

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
}

@media (min-width: 761px) {
  .mobile-search-row { display: none; }
}

/* Utilidades */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.center { text-align: center; }
