:root {
  --bg: #0a0a0a;
  --panel: #131313;
  --panel2: #1a1a1a;
  --border: #262626;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --accent: #ce1126;
  --accent-hover: #e42a3f;
  --rd-blue: #002d62;
  --rd-blue-light: #1e5fae;
  --danger: #f85149;
  --warn: #d29922;
  --ok: #22c55e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10,10,10,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--rd-blue) 0%, var(--rd-blue) 33%, #fff 33%, #fff 66%, var(--accent) 66%, var(--accent) 100%) 1;
}
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 14px 16px; }
.brand {
  background: none; border: none; color: var(--text);
  font-size: 20px; font-weight: 800; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 8px; letter-spacing: .2px;
}
.logo-img { height: 30px; width: 30px; object-fit: contain; border-radius: 8px; vertical-align: middle; }
.app { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 46px 12px 30px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(30,95,174,.5); background: rgba(0,45,98,.15);
  color: #6fa8f0; font-size: 12px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 42px); font-weight: 800; line-height: 1.15;
  margin: 0 0 14px; letter-spacing: -.5px;
}
.hero h1 .accent-word { color: var(--accent); }
.hero h1 .accent-word-blue { color: var(--rd-blue-light); }
.hero p.subtitle { color: var(--muted); font-size: 16px; max-width: 560px; margin: 0 auto 22px; line-height: 1.5; }
.hero-bg {
  background-size: cover; background-position: center; border-radius: 18px;
  padding: 46px 20px; margin-bottom: 26px;
}
.hero-bg-overlay { background: rgba(6,6,6,.72); border-radius: 18px; padding: 0; }

.stats-row { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; margin-top: 6px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; color: var(--rd-blue-light); }
.stat:nth-child(odd) b { color: var(--accent); }
.stat span { color: var(--muted); font-size: 12px; letter-spacing: .3px; text-transform: uppercase; }

/* ---------- Catalog header ---------- */
.catalog-head { text-align: center; margin: 10px 0 22px; }
.catalog-head h2 { font-size: 28px; font-weight: 800; margin: 4px 0 6px; }
.catalog-head .count { color: var(--muted); font-size: 14px; }

.search-row { display: flex; gap: 10px; max-width: 640px; margin: 20px auto 0; }
.search-row input {
  flex: 1; padding: 13px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 15px;
}
.search-row input:focus { outline: none; border-color: var(--accent); }
.search-row button {
  padding: 0 22px; border-radius: 10px; border: none; background: var(--accent);
  color: #fff; font-weight: 700; cursor: pointer;
}

/* ---------- Product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: rgba(239,68,68,.4); }
.card-body { padding: 16px; }
.card h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.3; font-weight: 700; }
.card .badge { color: var(--muted); font-weight: 500; font-size: 13px; }
.card .desc-snip { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.price-row .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.card .price { font-size: 19px; font-weight: 800; color: var(--text); }
.card .stock { color: var(--ok); font-size: 12px; margin: 2px 0 14px; display: flex; align-items: center; gap: 5px; }
.card .stock::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); display: inline-block; }
.card .stock.low { color: var(--warn); }
.card .stock.low::before { background: var(--warn); }
.card-cta {
  display: block; width: 100%; text-align: center; padding: 11px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; border: none;
}

.card-img-wrap { position: relative; height: 150px; }
.card-img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--panel2); }
.card-img-empty {
  height: 150px; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85); font-size: 22px; font-weight: 800; text-align: center;
  padding: 0 14px; letter-spacing: .3px;
  background: linear-gradient(135deg, var(--rd-blue), var(--accent));
}
.detail-img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; margin-bottom: 18px; }

/* Sombra alrededor de cada producto con los colores de la bandera de RD
   (azul, rojo, blanco), rotando lentamente. */
@keyframes flagGlow {
  0%   { box-shadow: 0 0 14px 1px rgba(0,45,98,.5); }
  33%  { box-shadow: 0 0 14px 1px rgba(206,17,38,.5); }
  66%  { box-shadow: 0 0 14px 1px rgba(255,255,255,.4); }
  100% { box-shadow: 0 0 14px 1px rgba(0,45,98,.5); }
}
.flag-glow { animation: flagGlow 4.5s ease-in-out infinite; }
.flag-glow:hover { animation-play-state: paused; }

.back {
  background: none; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 0; margin-bottom: 16px;
}
.back:hover { color: var(--text); }

.detail h2 { margin-top: 0; font-size: 24px; font-weight: 800; }
.detail .price-big { font-size: 28px; font-weight: 800; color: var(--text); margin: 8px 0; }
.detail .desc { color: var(--muted); white-space: pre-wrap; margin: 12px 0; line-height: 1.6; }
.detail .stock-line { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

.qty-row { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.qty-row button {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 18px; cursor: pointer;
}
.qty-row span { font-size: 18px; min-width: 30px; text-align: center; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text);
  font-size: 15px; font-family: inherit;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 60px; }

.btn {
  display: inline-block; padding: 13px 20px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; width: 100%; margin-top: 8px;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
.btn-secondary { background: var(--panel2); border: 1px solid var(--border); color: var(--text); }

.box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; margin-top: 16px;
}
.pay-instructions { line-height: 1.7; }
.pay-instructions code {
  background: var(--panel2); padding: 3px 8px; border-radius: 6px; font-size: 15px;
}
.total-badge {
  display: inline-block; background: var(--panel2); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 8px; font-weight: 800; font-size: 17px; margin: 8px 0;
}

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: rgba(248,81,73,.12); border: 1px solid var(--danger); color: #ffb4ae; }
.alert-warn { background: rgba(210,153,34,.12); border: 1px solid var(--warn); color: #ffd889; }
.alert-success { background: rgba(34,197,94,.12); border: 1px solid var(--ok); color: #86e5aa; }

.result-icon { font-size: 44px; margin-bottom: 8px; }
.creds { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; white-space: pre-wrap; font-family: monospace; font-size: 14px; margin-top: 12px; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.spinner { text-align: center; padding: 40px 0; color: var(--muted); }
