:root {
  --navy: #0B1F3A;
  --navy-2: #123058;
  --blue: #164E8A;
  --amber: #F6C445;
  --green: #179B67;
  --red: #C83C3C;
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --text: #172033;
  --text-2: #667085;
  --border: #E4E8EF;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(11, 31, 58, 0.10);

  /* Texto sobre fondo oscuro (hero, header, tarjetas, comunidad) — variables
     para poder invertir a un tema claro sin duplicar reglas. */
  --on-dark-text: #ffffff;
  --on-dark-sub: #b7c2da;
  --on-dark-nav: #dbe3f2;
  --on-dark-badge-border: rgba(255,255,255,0.2);
  --on-dark-badge-bg: rgba(255,255,255,0.08);

  /* Header de las tarjetas de cupón: siempre oscuro/premium, independiente
     del tema de color elegido para el resto del sitio. */
  --card-dark: #0B1F3A;
  --card-dark-2: #123058;

  /* Fondo del hero — separado de --navy para poder tener un hero claro
     (tema "crema") sin afectar los acentos oscuros pequeños (footer, chips). */
  --hero-bg-1: var(--navy);
  --hero-bg-2: var(--navy-2);
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: 'Manrope', sans-serif;
  margin: 0;
}

img { max-width: 100%; display: block; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }

.btn-accent { background: var(--amber); color: var(--navy); }
.btn-accent:hover { box-shadow: 0 8px 20px rgba(246, 196, 69, 0.5); }

.btn-ghost { background: var(--on-dark-badge-bg); color: var(--on-dark-text); border: 1.5px solid var(--on-dark-badge-border); }
.btn-ghost:hover { filter: brightness(1.15); }

.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-lg { padding: 0.85rem 1.7rem; font-size: 1rem; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.85rem; }

/* Hero wrap: header + hero comparten el mismo fondo navy de pantalla completa */
.hero-wrap {
  background: linear-gradient(160deg, var(--hero-bg-1) 0%, var(--hero-bg-2) 100%);
  border-bottom: 3px solid var(--amber);
}

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 50; }
.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.4rem 1.25rem;
}
.brand {
  flex-shrink: 0;
  display: inline-flex;
}
.brand-logo {
  height: 84px;
  width: auto;
  flex-shrink: 0;
  border-radius: 10px;
  background: #fff;
  padding: 5px 14px;
  border: 3px solid var(--amber);
}
.main-nav { display: flex; gap: 1.6rem; margin-left: 0.5rem; }
.main-nav a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--on-dark-nav); text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.main-nav a:hover { color: var(--on-dark-text); }
.nav-ico { font-size: 0.9rem; }
.topbar-inner .btn-whatsapp { margin-left: auto; }
.wa-icon { width: 18px; height: 18px; flex-shrink: 0; }

.nav-toggle {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  display: none;
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  min-width: 36px;
  flex: 0 0 36px;
  padding: 8px 6px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span { display: block; height: 2px; background: var(--on-dark-text); border-radius: 2px; }

/* Hero */
.hero { padding: 2.2rem 0 3rem; overflow: hidden; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 2rem;
}
.hero-grid > * { min-width: 0; }

.badge-update {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--on-dark-badge-bg);
  border: 1px solid var(--on-dark-badge-border);
  color: var(--on-dark-nav);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
}
.hero-copy h1 { font-size: 2.5rem; line-height: 1.18; margin-bottom: 1rem; color: var(--on-dark-text); font-weight: 800; }
.hero-copy h1 .hl { color: var(--amber); }
.hero-sub { color: var(--on-dark-sub); font-size: 1.05rem; margin-bottom: 1.6rem; max-width: 48ch; }
.hero-sub .accent-num { color: var(--amber); font-weight: 800; }
.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.hero-art {
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-art .mascot {
  position: relative;
  height: 460px;
  width: auto;
  z-index: 2;
  animation: float 3.6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art .mascot { animation: none; }
}

/* Secciones */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--surface); }
.section-head { margin-bottom: 1.5rem; }
.section-head h2 { font-size: 1.6rem; margin-bottom: 0.4rem; color: var(--navy); }
.section-head p { color: var(--text-2); margin: 0; }

/* Chips de filtro */
.filter-pills { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.filter-pill {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.filter-pill:hover { border-color: var(--blue); }
.filter-pill.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Tarjetas de cupón — estilo Centro de Cupones (Mercado Libre) */
.coupon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
}
.coupon-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem 1.1rem;
  min-width: 0;
  transition: transform 0.15s ease;
}
.coupon-card:hover { transform: translateY(-3px); }

.coupon-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}
.meta-views, .meta-rank {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #F3F5F9;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.coupon-main-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.coupon-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
}
.coupon-icon.bancario { background: #E3EEFF; }
.coupon-icon .mp-icon { width: 88%; height: auto; display: block; }

.coupon-info { flex: 1; min-width: 0; }
.coupon-discount-lg { font-family: 'Manrope', sans-serif; font-size: 1.15rem; font-weight: 800; color: var(--text); margin: 0; overflow-wrap: break-word; }
.coupon-line { color: var(--text-2); font-size: 0.82rem; margin: 0.15rem 0 0; }
.coupon-expiry { color: var(--red); font-size: 0.82rem; font-weight: 700; margin: 0.25rem 0 0; }

.coupon-code-masked {
  flex-shrink: 0;
  font-family: 'Courier New', monospace;
  font-weight: 800;
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .coupon-code-masked { font-size: 0.8rem; }
}

.btn-redeem {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s ease;
}
.btn-redeem:hover { filter: brightness(1.08); }

.coupon-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-2);
}
.copy-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  color: #6C5CE7;
}
.foot-badges { display: flex; gap: 0.7rem; }
.foot-badges .verified { color: var(--green); font-weight: 700; }
.foot-badges .trending { color: #d9720a; font-weight: 700; }

/* Votos: me gusta / no me gusta */
.coupon-votes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.vote-btn {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #F0F1F4;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}
.vote-btn:hover { background: #E4E6EC; transform: translateY(-1px); }
.vote-btn.like.active { background: rgba(200, 60, 60, 0.18); }
.vote-btn.dislike.active { background: rgba(200, 60, 60, 0.18); }
.vote-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-2);
  margin-right: 0.6rem;
}

/* Cómo funciona */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.step { text-align: center; }
.step-num {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  margin: 0 auto 0.8rem;
}
.step h3 { font-size: 1.1rem; margin-bottom: 0.4rem; color: var(--navy); }
.step p { color: var(--text-2); margin: 0; font-size: 0.92rem; }

/* Comunidad */
.community { background: var(--navy); color: #fff; }
.community h2 { color: #fff; font-size: 1.6rem; }
.community p { color: #c9d3e6; }
.community-inner { display: flex; justify-content: space-between; align-items: center; gap: 2rem; flex-wrap: wrap; }
.community-actions { display: flex; flex-direction: column; gap: 0.8rem; align-items: flex-start; }
.social-row { display: flex; gap: 1.2rem; }
.social-row a { color: #c9d3e6; font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.social-row a:hover { color: #fff; }

/* Footer */
.site-footer { background: #0a1830; color: #9aa5bd; padding: 2.2rem 0; }
.footer-logo {
  height: 40px; width: auto;
  background: #fff; border-radius: 8px; padding: 4px 10px;
  border: 3px solid var(--amber);
  margin-bottom: 1rem;
}
.affiliate-notice { font-size: 0.8rem; max-width: 70ch; line-height: 1.6; margin: 0 0 0.8rem; }
.copyright { font-size: 0.78rem; margin: 0; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 100;
}

/* Responsive */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; min-height: 260px; }
  .hero-art .mascot { height: 260px; }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--navy-2);
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding: 1rem 1.25rem;
    gap: 0.9rem;
    margin: 0;
  }
  /* El fondo del menú desplegable siempre es oscuro (var(--navy-2)),
     así que su texto debe ser siempre claro, sin importar el modo
     día/noche activo (que cambia --on-dark-nav para el hero). */
  .main-nav.open a {
    color: #e7ebf3;
  }
  .main-nav.open a:hover {
    color: #ffffff;
  }
  .nav-toggle { display: flex; }
  .brand-logo { height: 62px; }
  .topbar-inner .btn-whatsapp {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    padding: 0;
    gap: 0;
    justify-content: center;
  }
  .topbar-inner .btn-whatsapp .wa-icon { width: 22px; height: 22px; }
  .topbar-inner .btn-whatsapp .whatsapp-label { display: none; }
  .hero-copy h1 { font-size: 1.7rem; }
  .community-inner { flex-direction: column; align-items: flex-start; }
}

/* Asistente de chat (respuestas programadas) */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.chat-fab:hover { transform: scale(1.06); }
.chat-fab::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2ecc71;
  border: 2px solid #fff;
}

.chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 210;
  width: 340px;
  max-width: calc(100vw - 24px);
  height: 480px;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-header {
  background: var(--blue);
  color: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.chat-header-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.chat-header-text strong { font-size: 0.95rem; }
.chat-status { font-size: 0.78rem; color: #cfe0ff; }
.chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: #F6F8FB;
}
.chat-msg { display: flex; gap: 0.5rem; max-width: 88%; }
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.chat-bubble {
  background: #fff;
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  white-space: pre-line;
}
.chat-msg.user .chat-bubble { background: var(--blue); color: #fff; }
.chat-bubble a { color: inherit; text-decoration: underline; }

.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.7rem;
  background: #F6F8FB;
  flex-shrink: 0;
}
.chat-chip {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.chat-chip:hover { border-color: var(--blue); color: var(--blue); }

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}
.chat-input-row input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}
.chat-input-row input:focus { border-color: var(--blue); }
.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

@media (max-width: 480px) {
  .chat-panel { width: calc(100vw - 24px); right: 12px; bottom: 12px; height: 70vh; }
  .chat-fab { right: 12px; bottom: 12px; }
}
