/* ═══════════════════════════════════════════════════════
   Zerotek LeadBox — Front CSS
   Popup overlay · Formulario embebido · RGPD
   ═══════════════════════════════════════════════════════ */

/* ── Variables (sobreescritas por inline style por campaña) ── */
:root {
  --zlb-bg:       #ffffff;
  --zlb-text:     #111111;
  --zlb-accent:   #e31e24;
  --zlb-btn:      #e31e24;
  --zlb-btn-txt:  #ffffff;
  --zlb-overlay:  rgba(0,0,0,0.55);
  --zlb-radius:   14px;
  --zlb-shadow:   0 24px 64px rgba(0,0,0,.22);
  --zlb-font:     -apple-system, 'Segoe UI', sans-serif;
  --zlb-ease:     cubic-bezier(.22,1,.36,1);
}

/* ════════════════════════════════════════════
   POPUP OVERLAY
   ════════════════════════════════════════════ */
.zlb-popup-overlay {
  position: fixed;
  inset: 0;
  background: var(--zlb-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--zlb-ease), visibility .3s;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.zlb-popup-overlay.zlb-open {
  opacity: 1;
  visibility: visible;
}
.zlb-popup-overlay.zlb-open .zlb-popup-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.zlb-popup-box {
  background: var(--zlb-bg);
  color: var(--zlb-text);
  border-radius: var(--zlb-radius);
  box-shadow: var(--zlb-shadow);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(32px) scale(.97);
  opacity: 0;
  transition: transform .35s var(--zlb-ease), opacity .35s var(--zlb-ease);
  scrollbar-width: thin;
}

/* Botón cerrar */
.zlb-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: none;
  background: rgba(0,0,0,.08);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--zlb-text);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  transition: background .15s;
}
.zlb-close:hover { background: rgba(0,0,0,.16); }

/* ════════════════════════════════════════════
   EMBED
   ════════════════════════════════════════════ */
.zlb-embed-wrap {
  display: block;
}
.zlb-embed-box {
  background: var(--zlb-bg);
  color: var(--zlb-text);
  border-radius: var(--zlb-radius);
  box-shadow: var(--zlb-shadow);
  overflow: hidden;
  font-family: var(--zlb-font);
}

/* ════════════════════════════════════════════
   IMAGEN DE CABECERA
   ════════════════════════════════════════════ */
.zlb-header-img {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  position: relative;
}
.zlb-header-img::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--zlb-bg));
}
.zlb-header-img img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

/* ════════════════════════════════════════════
   CUERPO DEL FORMULARIO
   ════════════════════════════════════════════ */
.zlb-body {
  padding: 28px 32px 32px;
  font-family: var(--zlb-font);
}

.zlb-headline {
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--zlb-text);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: -.01em;
}

/* Línea decorativa bajo el titular */
.zlb-headline::after {
  content: '';
  display: block;
  width: 48px; height: 3px;
  background: var(--zlb-accent);
  border-radius: 2px;
  margin: 10px auto 0;
}

.zlb-subheadline {
  font-size: 14px;
  color: color-mix(in srgb, var(--zlb-text) 60%, transparent);
  text-align: center;
  margin: 0 0 20px;
  line-height: 1.6;
}

/* ════════════════════════════════════════════
   CAMPOS
   ════════════════════════════════════════════ */
.zlb-form { margin: 0; }

.zlb-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.zlb-field { display: flex; flex-direction: column; gap: 5px; }
.zlb-field-full { grid-column: 1 / -1; }
.zlb-field-half { grid-column: span 1; }

@media (max-width: 500px) {
  .zlb-field-half { grid-column: 1 / -1; }
  .zlb-fields-grid { grid-template-columns: 1fr; }
}

.zlb-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--zlb-text);
  display: block;
}
.zlb-req { color: var(--zlb-accent); margin-left: 2px; }

.zlb-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--zlb-font);
  color: var(--zlb-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
}
.zlb-input:focus {
  border-color: var(--zlb-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--zlb-accent) 15%, transparent);
}
.zlb-input::placeholder { color: #aaa; }

textarea.zlb-input { resize: vertical; min-height: 80px; }
select.zlb-input { cursor: pointer; }

/* ════════════════════════════════════════════
   PRIVACIDAD RGPD
   ════════════════════════════════════════════ */
.zlb-privacy {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #f8f8f8;
  border-radius: 8px;
  border: 1px solid #eee;
}
.zlb-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--zlb-text);
  cursor: pointer;
  line-height: 1.5;
}
.zlb-checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px; height: 16px;
  margin-top: 2px;
  accent-color: var(--zlb-accent);
  cursor: pointer;
}
.zlb-privacy a { color: var(--zlb-accent); }

/* ════════════════════════════════════════════
   ERROR / ÉXITO
   ════════════════════════════════════════════ */
.zlb-error-msg {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #991b1b;
  margin-bottom: 14px;
}

.zlb-success {
  text-align: center;
  padding: 32px 16px;
  animation: zlb-fade-in .4s ease;
}
.zlb-success-icon { font-size: 52px; margin-bottom: 12px; }
.zlb-success-msg  { font-size: 17px; font-weight: 600; color: var(--zlb-text); margin: 0; }

@keyframes zlb-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════
   BOTÓN DE ENVÍO
   ════════════════════════════════════════════ */
.zlb-submit-btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: var(--zlb-btn);
  color: var(--zlb-btn-txt);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--zlb-font);
  cursor: pointer;
  letter-spacing: .03em;
  text-transform: uppercase;
  transition: filter .15s, transform .1s;
  position: relative;
  overflow: hidden;
}
.zlb-submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background .15s;
}
.zlb-submit-btn:hover::before  { background: rgba(255,255,255,.1); }
.zlb-submit-btn:active         { transform: scale(.98); }
.zlb-submit-btn:disabled {
  opacity: .65;
  cursor: wait;
}

/* Estado cargando — spinner interno */
.zlb-submit-btn.zlb-loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: zlb-spin .6s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}
@keyframes zlb-spin {
  to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════
   PIE DEL FORMULARIO
   ════════════════════════════════════════════ */
.zlb-footer-text {
  margin-top: 14px;
  font-size: 12px;
  color: color-mix(in srgb, var(--zlb-text) 50%, transparent);
  text-align: center;
  line-height: 1.6;
}

/* ════════════════════════════════════════════
   ACCESIBILIDAD
   ════════════════════════════════════════════ */
.zlb-popup-overlay[aria-hidden="true"] { pointer-events: none; }
.zlb-popup-overlay[aria-hidden="false"],
.zlb-popup-overlay.zlb-open { pointer-events: all; }

/* Scroll lock */
body.zlb-lock { overflow: hidden; }

/* Focus visible */
.zlb-submit-btn:focus-visible,
.zlb-close:focus-visible,
.zlb-input:focus-visible {
  outline: 2px solid var(--zlb-accent);
  outline-offset: 2px;
}
