/* ─── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --card-bg: rgba(20, 5, 40, 0.5);
  --card-border: rgba(255, 215, 0, 0.12);
  --card-shadow: 0 25px 60px -12px rgba(80, 40, 120, 0.6);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.5);
  --whatsapp: #25D366;
  --whatsapp-hover: #1da851;
  --whatsapp-shadow: rgba(37, 211, 102, 0.35);
  --accent: #7c3aed;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body { height: 100%; }

body {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* Fallback: solo se ve si la imagen no carga */
  background-color: #1a0a2e;
}

/* ─── Noise overlay ────────────────────────────────────────── */
.noise {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat; background-size: 256px 256px;
}

/* ─── Floating orbs ────────────────────────────────────────── */
.orb {
  position: fixed; border-radius: 50%; filter: blur(90px); opacity: 0.25;
  pointer-events: none; z-index: 0; will-change: transform;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  top: -10%; left: -8%;
  animation: orbFloat1 25s ease-in-out infinite;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #f59e0b 0%, transparent 70%);
  bottom: -12%; right: -8%;
  animation: orbFloat2 30s ease-in-out infinite;
}
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -30px) scale(1.08); }
}

/* ─── Main content ─────────────────────────────────────────── */
.main-content {
  position: relative; z-index: 1; flex: 1;
  display: flex; justify-content: center; align-items: center;
  width: 100%; padding: 24px 16px 100px;
}

/* ─── Card ─────────────────────────────────────────────────── */
.card {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: 20px;
  background: var(--card-bg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: 28px; padding: 32px 40px;
  max-width: 440px; width: 100%; text-align: center;
  box-shadow: var(--card-shadow);
  animation: cardIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0; transform: translateY(24px);
}
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }

/* ─── Logo ─────────────────────────────────────────────────── */
.card-logo {
  display: flex; justify-content: center; align-items: center;
  width: 100%; min-height: 0; overflow: hidden;
}
.logo-img {
  object-fit: contain; border-radius: 8px;
  display: none;
  max-width: 340px; max-height: 220px;
  width: 100%; height: auto;
}
.logo-img.visible {
  display: block;
  animation: logoIn 0.5s ease-out;
}
@keyframes logoIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* ─── Heading ──────────────────────────────────────────────── */
.heading {
  font-size: 1.35rem; font-weight: 600; line-height: 1.5;
  margin: 0; color: var(--text-primary);
  letter-spacing: -0.01em; overflow-wrap: break-word;
}

/* ─── Sucursal selector ────────────────────────────────────── */
.sucursal-selector {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; width: 100%;
}
.sucursal-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary); font-size: 0.9rem; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  transition: all 0.25s; position: relative; overflow: hidden;
}
.sucursal-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff; transform: translateY(-1px);
}
.sucursal-btn:active { transform: translateY(0) scale(0.97); }
.sucursal-btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

/* ─── Consent checkbox ─────────────────────────────────────── */
.consent-area {
  width: 100%;
  display: flex; justify-content: center;
}
.consent-label {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; user-select: none;
  max-width: 380px; width: 100%;
}
.consent-checkbox {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 2px;
  accent-color: var(--whatsapp);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}
.consent-checkbox:checked {
  background: var(--whatsapp);
  border-color: var(--whatsapp);
}
.consent-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: left;
}
.consent-text a {
  color: var(--whatsapp);
  text-decoration: none;
}

/* ─── CTA button ───────────────────────────────────────────── */
.cta-area {
  min-height: 70px; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
}
.cta-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; background: var(--whatsapp); color: #fff;
  font-size: 1.05rem; font-weight: 700; padding: 16px 32px;
  border-radius: 14px; cursor: pointer;
  transition: background 0.25s, transform 0.2s, box-shadow 0.25s;
  width: 100%; box-shadow: 0 8px 24px var(--whatsapp-shadow);
  position: relative; overflow: hidden;
  animation: pulseCta 3s ease-in-out infinite;
}
.cta-button::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.cta-button:hover:not(.disabled) {
  background: var(--whatsapp-hover);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px var(--whatsapp-shadow);
}
.cta-button:active:not(.disabled) { transform: translateY(0) scale(0.98); }
.cta-button.disabled {
  opacity: 0.4; cursor: not-allowed; pointer-events: none;
  animation: none; box-shadow: none; background: rgba(255, 255, 255, 0.1);
}
@keyframes pulseCta {
  0%, 100% { box-shadow: 0 8px 24px var(--whatsapp-shadow); }
  50% { box-shadow: 0 8px 32px rgba(37, 211, 102, 0.5); }
}
.whatsapp-icon, .operator-icon { flex-shrink: 0; }

/* ─── Assign confirm ───────────────────────────────────────── */
.assign-confirm, .cooldown-message, .vendor-error {
  width: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  padding: 10px 0; animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.confirm-icon { margin-bottom: 4px; }
.confirm-text { font-size: 1rem; font-weight: 500; color: var(--text-secondary); }
.confirm-text strong { color: var(--text-primary); font-weight: 700; }
.confirm-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; opacity: 0.6; }
.confirm-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 12px 28px;
  background: #25d366; color: #fff; font-size: 1rem; font-weight: 600;
  border: none; border-radius: 12px; cursor: pointer; text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.confirm-btn:hover { background: #20bd5a; transform: scale(1.02); }
.confirm-btn:active { transform: scale(0.98); }

/* ─── Cooldown ─────────────────────────────────────────────── */
.cooldown-message {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 16px; padding: 14px 18px;
}
.cooldown-icon { margin-bottom: 4px; }
.cooldown-text { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.cooldown-timer {
  font-size: 1.6rem; font-weight: 700; color: #fbbf24;
  font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
}
.cooldown-progress {
  width: 100%; max-width: 220px; height: 5px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.08);
  overflow: hidden; margin-top: 6px;
}
.cooldown-progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  transition: width 1s linear;
}

/* ─── Vendor error ─────────────────────────────────────────── */
.vendor-error-icon { margin-bottom: 4px; }
.vendor-error-text { font-size: 1rem; font-weight: 600; color: #ef4444; }
.vendor-error-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; opacity: 0.6; }

/* ─── Loading overlay ──────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; justify-content: center; align-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.5s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-content { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--whatsapp); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 1.1rem; font-weight: 600; color: #fff;
  letter-spacing: 0.3px; animation: loadingPulse 1.5s ease-in-out infinite;
}
@keyframes loadingPulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ─── Footer ───────────────────────────────────────────────── */
.footer {
  position: relative; z-index: 1; width: 100%;
  padding: 20px 16px; text-align: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.footer-content { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.footer-credit { font-size: 0.85rem; color: var(--text-secondary); opacity: 0.7; font-weight: 400; }
.footer-credit a { text-decoration: none; }
.footer-credit strong {
  font-weight: 600;
  background: linear-gradient(135deg, #7c3aed, #f59e0b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.footer-copyright { font-size: 0.75rem; color: var(--text-muted); opacity: 0.5; font-weight: 400; }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .logo-img { max-width: 280px; max-height: 180px; }
}

@media (max-width: 480px) {
  .main-content { padding-bottom: 60px; }
  .card { padding: 24px 18px; border-radius: 20px; gap: 16px; }
  .logo-img { max-width: 220px; max-height: 150px; }
  .heading { font-size: 1.15rem; }
  .cta-button { font-size: 0.95rem; padding: 14px 24px; border-radius: 12px; }
  .sucursal-btn { padding: 8px 14px; font-size: 0.8rem; border-radius: 10px; }
  .consent-text { font-size: 0.72rem; }
}

@media (max-width: 360px) {
  .card { padding: 18px 12px; border-radius: 16px; gap: 14px; }
  .logo-img { max-width: 180px; max-height: 120px; }
  .heading { font-size: 1rem; }
  .cta-button { font-size: 0.85rem; padding: 12px 20px; border-radius: 10px; }
}
