:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-grad: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  --danger: #ef4444;
  --success: #16a34a;
  --warning: #f59e0b;
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --bg: #f8fafc;
  --panel: #ffffff;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 16px rgba(2, 44, 100, 0.06);
  --shadow-lg: 0 8px 30px rgba(2, 44, 100, 0.12);
}

.dark {
  --ink: #e2e8f0;
  --ink-soft: #94a3b8;
  --muted: #64748b;
  --bg: #0f172a;
  --panel: #1e293b;
  --border: #334155;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

img { max-width: 100%; }
a { color: var(--primary-dark); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select {
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.section { padding: clamp(32px, 6vw, 56px) 0; }
.section.alt { background: var(--panel); }
.section-title { font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 800; margin-bottom: 20px; text-align: center; }

/* ===== Botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  transition: transform .12s, box-shadow .12s, background .12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary-grad); color: #fff; box-shadow: 0 3px 10px rgba(14, 165, 233, 0.3); }
.btn-primary:hover { box-shadow: 0 5px 16px rgba(14, 165, 233, 0.4); }
.btn-success { background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #f87171, #dc2626); color: #fff; }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }

/* ===== Header ===== */
.site-header {
  background: #0b1220;
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-size: 0.95rem; }
.logo-icon { font-size: 1.3rem; }
.logo b { color: var(--primary); }
.header-nav { display: flex; align-items: center; gap: 6px; }
.header-nav a { color: #a8b6cc; font-size: 0.82rem; padding: 4px 8px; border-radius: 6px; }
.header-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.dark-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s;
}
.dark-toggle:hover { background: rgba(255,255,255,0.2); }

/* ===== Hero (Landing) ===== */
.hero { background: radial-gradient(1200px 500px at 80% -10%, #123a6b 0%, #0b1220 60%); color: #fff; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 30px; align-items: center; padding: clamp(40px, 8vw, 70px) 16px; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); line-height: 1.12; margin-bottom: 14px; font-weight: 800; }
.hero p { color: #b8c7de; font-size: clamp(0.88rem, 2vw, 1.05rem); max-width: 460px; margin-bottom: 20px; }
.grad { background: linear-gradient(90deg, #38bdf8, #a5b4fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-badges { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-badges span {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 5px 12px; border-radius: 999px; font-size: 0.78rem; color: #dbe7f7;
}
.hero-card { position: relative; }
.mini-card {
  background: linear-gradient(160deg, #0c4a8f, #062852);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  transform: rotate(3deg);
}
.mini-card-head { display: flex; justify-content: space-between; align-items: center; color: #cfe3ff; font-size: 0.8rem; margin-bottom: 14px; }
.mini-stamp { background: #f59e0b; color: #1e1b0a; border-radius: 6px; padding: 2px 8px; font-weight: 800; font-size: 0.78rem; }
.mini-dots { display: flex; gap: 8px; margin-bottom: 12px; }
.dot { width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,0.12); border: 1.5px dashed rgba(255,255,255,0.4); }
.dot.filled { background: var(--primary-grad); border-style: solid; border-color: transparent; box-shadow: 0 3px 8px rgba(14,165,233,0.5); }
.mini-text { color: #e6f2ff; font-size: 0.85rem; }
.mini-bubble {
  position: absolute; top: -12px; right: -4px;
  background: var(--success); color: #fff; font-weight: 700; font-size: 0.78rem;
  padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow);
}

/* ===== Steps (Landing) ===== */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.step-num {
  width: 36px; height: 36px; border-radius: 10px; background: var(--primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; margin-bottom: 10px;
}
.step h3 { margin-bottom: 6px; font-size: 0.95rem; }
.step p { color: var(--muted); font-size: 0.85rem; }

/* ===== Beneficios ===== */
.benefits-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.benefit { text-align: center; padding: 20px 14px; }
.benefit-icon { font-size: 2rem; }
.benefit h4 { margin: 8px 0 4px; font-size: 0.92rem; }
.benefit p { color: var(--muted); font-size: 0.82rem; }

/* ===== CTA + Footer ===== */
.cta-box { text-align: center; background: var(--primary-grad); color: #fff; border-radius: 20px; padding: clamp(28px, 5vw, 44px) 20px; box-shadow: var(--shadow-lg); }
.cta-box h2 { margin-bottom: 14px; font-size: clamp(1.2rem, 3.5vw, 1.6rem); }
.cta-box .btn { background: #fff; color: #0c4a8f; }
.site-footer { background: #0b1220; color: #8ea0ba; padding: 20px 0; text-align: center; font-size: 0.82rem; }
.site-footer b { color: #dce7f5; }
.muted { opacity: 0.7; font-size: 0.78rem; }

/* ===== Tarjeta del socio ===== */
.page-shell { max-width: 720px; margin: 0 auto; padding: 16px 14px 40px; }
.page-head { text-align: center; margin-bottom: 16px; }
.page-head h1 { font-size: clamp(1.2rem, 4vw, 1.7rem); }
.page-head p { color: var(--muted); font-size: 0.85rem; }

.card {
  background: linear-gradient(160deg, #0c4a8f, #062852);
  color: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow-lg); margin-bottom: 14px;
}
.card.top { background: linear-gradient(160deg, #0ea5e9, #1d4ed8); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h3 { font-size: 0.95rem; }
.card-title { color: #bcd8ff; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; }

.socio-info { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 0.85rem; align-items: baseline; }
.socio-info dt { color: #bcd8ff; }
.socio-info dd { font-weight: 600; }

.punch { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0; }
.punch span {
  aspect-ratio: 1; border-radius: 10px; border: 2px dashed rgba(255,255,255,0.45);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  background: rgba(255,255,255,0.08);
  transition: all .3s ease;
}
.punch span.filled {
  border-style: solid; border-color: transparent;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  box-shadow: 0 3px 12px rgba(245,158,11,0.5);
  animation: stickerPop .5s ease;
}
.punch span.last {
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
  box-shadow: 0 3px 16px rgba(16,185,129,0.6);
  border-color: #fff;
}

@keyframes stickerPop {
  0% { transform: scale(0.3) rotate(-20deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(5deg); }
  70% { transform: scale(0.9) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes celebrationBurst {
  0% { transform: scale(0); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

.celebration-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .3s ease;
}

.celebration-card {
  background: linear-gradient(160deg, #fbbf24, #f59e0b);
  border-radius: 24px; padding: 28px; text-align: center;
  box-shadow: 0 16px 50px rgba(0,0,0,0.3);
  animation: celebrationBounce .6s ease;
  max-width: 300px;
  margin: 16px;
}

.celebration-card .trophy { font-size: 3rem; margin-bottom: 12px; }
.celebration-card h2 { color: #78350f; font-size: 1.2rem; margin-bottom: 6px; }
.celebration-card p { color: #92400e; font-size: 0.88rem; margin-bottom: 16px; }

.confetti {
  position: fixed; width: 8px; height: 8px;
  top: -10px; z-index: 201;
  animation: confettiFall 2s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes celebrationBounce {
  0% { transform: scale(0.3) translateY(40px); opacity: 0; }
  60% { transform: scale(1.05) translateY(-10px); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.free-badge { background: var(--success); color: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 0.8rem; display: inline-block; }

/* ===== Tarjeta completada con festin ===== */
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes goldGlow {
  0%, 100% { box-shadow: 0 0 16px rgba(245,158,11,0.3), 0 0 30px rgba(245,158,11,0.1); }
  50% { box-shadow: 0 0 24px rgba(245,158,11,0.5), 0 0 50px rgba(245,158,11,0.2); }
}
@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-6px) scale(1.1); }
  50% { transform: translateY(0) scale(1); }
  75% { transform: translateY(-3px) scale(1.05); }
}
@keyframes goldTextShine {
  0% { background-position: -100% center; }
  100% { background-position: 200% center; }
}
.glass-card.completed {
  border: 2px solid #f59e0b !important;
  animation: goldGlow 2s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}
.glass-card.completed::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(245,158,11,0.1), transparent);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.glass-card.completed > * { position: relative; z-index: 1; }
.trophy-icon {
  font-size: 2.8rem;
  animation: trophyBounce 1.5s ease-in-out infinite;
  display: inline-block;
  filter: drop-shadow(0 3px 6px rgba(245,158,11,0.4));
}
.completed-title {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 800;
  background: linear-gradient(90deg, #f59e0b, #f97316, #fbbf24, #f59e0b);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: goldTextShine 3s linear infinite;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.completed-subtitle {
  color: #fbbf24;
  font-size: 0.82rem;
  font-weight: 600;
}
.cupon-code {
  background: rgba(245,158,11,0.15);
  border: 1px dashed #f59e0b;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 2px;
  display: inline-block;
  margin-top: 6px;
}

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.panel h2 { font-size: 1rem; margin-bottom: 10px; }
.panel h2 .icon { margin-right: 4px; }

.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin: 10px 0; font-size: 0.85rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.tag-pendiente { background: #fef3c7; color: #92400e; }
.tag-aprobada { background: #dcfce7; color: #166534; }
.tag-rechazada { background: #fee2e2; color: #991b1b; }

.state-banner { padding: 14px; border-radius: 12px; text-align: center; font-size: 0.92rem; font-weight: 700; margin: 12px 0; }
.state-gratis { background: #dcfce7; border: 2px solid #22c55e; color: #166534; }
.state-normal { background: #eff6ff; border: 2px solid #bfdbfe; color: #1d4ed8; }

/* ===== Login / Auth simple ===== */
.auth-card {
  max-width: 380px; margin: 30px auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 1.2rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 0.82rem; margin-bottom: 16px; }

/* ===== Tablas admin ===== */
.table-wrap { margin: 12px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 500px; }
table.data th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--bg); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.82rem; }
table.data tr:hover td { background: var(--bg); }

.tabs { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 16px; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.tab {
  padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--panel);
  font-weight: 600; font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; flex-shrink: 0;
  transition: all .15s;
}
.tab.active { background: var(--primary-grad); color: #fff; border-color: transparent; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.stat .value { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 800; color: var(--primary-dark); }
.stat .label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ===== Mensajes vacios ===== */
.empty { text-align: center; color: var(--muted); padding: 24px 10px; font-size: 0.88rem; }
.empty .big { font-size: 2rem; display: block; margin-bottom: 8px; }

.money { font-weight: 700; white-space: nowrap; }

/* ===== Toast ===== */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: #0b1220; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 0.82rem; box-shadow: var(--shadow-lg); opacity: 0; transition: all .25s; z-index: 100; max-width: 90vw; text-align: center; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== Search box fijo ===== */
.search-box {
  position: sticky;
  top: 50px;
  z-index: 40;
  background: var(--bg);
  padding: 10px 0;
  margin-bottom: 10px;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--panel);
}
.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.4;
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 1024px) {
  .hero-inner { gap: 24px; }
  .steps, .benefits-grid { gap: 14px; }
  .step, .benefit { padding: 18px; }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; padding: 32px 16px; text-align: center; }
  .hero p { margin-left: auto; margin-right: auto; }
  .hero-badges { justify-content: center; }
  .hero-card { max-width: 280px; margin: 20px auto 0; }
  .mini-card { padding: 16px; transform: rotate(1deg); }
  .steps { grid-template-columns: 1fr; }
  .benefits-grid { grid-template-columns: 1fr 1fr; }
  .section { padding: 28px 0; }
  .row { flex-direction: column; }
  .header-inner { padding: 8px 12px; }
  .logo { font-size: 0.88rem; gap: 6px; }
  .logo-icon { font-size: 1.1rem; }
  .header-nav a { font-size: 0.78rem; padding: 3px 6px; }

  .tab .tab-text { display: none; }
  .tab { padding: 8px 12px; font-size: 1.1rem; }
  .tab.active { padding: 8px 14px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 10px 8px; }
  .stat .value { font-size: 1.2rem; }
  .stat .label { font-size: 0.65rem; }

  .panel { padding: 14px; }
  .auth-card { margin: 20px 12px; padding: 20px; }

  .punch { gap: 6px; }
  .punch span { font-size: 1rem; border-width: 1.5px; }

  .card { padding: 14px; border-radius: 14px; }
  .socio-info { font-size: 0.8rem; gap: 2px 10px; }
}

/* ===== Responsive: Phone pequeno ===== */
@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: 0.82rem; }
  .hero-badges span { font-size: 0.72rem; padding: 4px 10px; }
  .benefits-grid { grid-template-columns: 1fr; }
  .cta-box { padding: 24px 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .btn { padding: 8px 14px; font-size: 0.82rem; }
  .btn-lg { padding: 10px 18px; font-size: 0.88rem; }

  .page-shell { padding: 12px 10px 32px; }
  .page-head h1 { font-size: 1.1rem; }
  .card { padding: 12px; }
  .card-head h3 { font-size: 0.88rem; }
  .socio-info { font-size: 0.78rem; }
  .punch span { font-size: 0.9rem; }

  .tabs { gap: 3px; }
  .tab { padding: 6px 10px; font-size: 1rem; }

  .auth-card { margin: 16px 10px; padding: 16px; }
  .auth-card h1 { font-size: 1.05rem; }

  .celebration-card { padding: 20px; margin: 12px; border-radius: 18px; }
  .celebration-card .trophy { font-size: 2.4rem; }
  .celebration-card h2 { font-size: 1rem; }
}
