/* ═══════════════════════════════════════════════════════════════════════
   Lazzo Bienestar · Cliente — Compromiso parental (C5.2.B)
   Overlay slide-in derecha · z-index 1095 (sobre cuestionario 1090).
   Scope `.bcl-cp-*`.
   ═══════════════════════════════════════════════════════════════════════ */

.bcl-cp-overlay {
  position: fixed; inset: 0;
  z-index: 1095;
  background: var(--bcl-bg, #fdf6f0);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bcl-cp-overlay.open { transform: translateX(0); pointer-events: auto; }

.bcl-cp-inner {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100%;
  display: flex; flex-direction: column;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--bcl-txt);
}
.bcl-cp-content-grow { flex: 1 0 auto; padding-bottom: 12px; }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.bcl-cp-topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 14px 18px 8px;
  background: linear-gradient(180deg, var(--bcl-bg) 70%, transparent 100%);
}
.bcl-cp-back {
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 1px 6px -2px rgba(0,0,0,.10);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--bcl-txt);
  flex-shrink: 0;
}
.bcl-cp-back i { width: 18px; height: 18px; }
.bcl-cp-back:active { transform: scale(.95); }
.bcl-cp-title {
  flex: 1;
  text-align: center;
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  color: var(--bcl-txt);
}

/* ── Intro ──────────────────────────────────────────────────────────────── */
.bcl-cp-intro {
  margin: 4px 18px 18px;
  padding: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  background: color-mix(in srgb, var(--bcl-c2) 8%, white);
  border: 1px solid color-mix(in srgb, var(--bcl-c2) 25%, transparent);
  border-radius: 14px;
}
.bcl-cp-intro i {
  flex-shrink: 0;
  width: 22px; height: 22px;
  color: var(--bcl-c2-d);
  margin-top: 1px;
}
.bcl-cp-intro-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.bcl-cp-intro-text strong {
  font-size: 14px;
  color: var(--bcl-txt);
  line-height: 1.35;
}
.bcl-cp-intro-text span {
  font-size: 12.5px;
  color: var(--bcl-muted);
  line-height: 1.55;
}

/* ── Sections ───────────────────────────────────────────────────────────── */
.bcl-cp-section {
  margin: 0 18px 18px;
  padding: 16px;
  background: white;
  border: 1px solid var(--bcl-line);
  border-radius: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.bcl-cp-section-t {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--bcl-txt);
  margin: 0;
}
.bcl-cp-section-sub {
  font-size: 12.5px;
  color: var(--bcl-muted);
  line-height: 1.5;
  margin: -8px 0 0;
}

/* ── Rows / inputs ──────────────────────────────────────────────────────── */
.bcl-cp-row {
  display: flex; flex-direction: column; gap: 6px;
}
.bcl-cp-row label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--bcl-muted);
}
.bcl-cp-row input[type="text"],
.bcl-cp-row input[type="email"] {
  -webkit-appearance: none;
  appearance: none;
  border: 1.5px solid var(--bcl-line);
  border-radius: 12px;
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
  color: var(--bcl-txt);
  background: var(--bcl-bg-soft);
  transition: border-color 0.15s, background 0.15s;
}
.bcl-cp-row input[type="text"]:focus,
.bcl-cp-row input[type="email"]:focus {
  outline: none;
  border-color: var(--bcl-c1);
  background: white;
}
.bcl-cp-input-hint {
  font-size: 11.5px; color: var(--bcl-muted); margin-top: 2px;
}
.bcl-cp-input-err {
  font-size: 11.5px; color: var(--bcl-red); font-weight: 600; margin-top: 2px;
}

/* ── Chips relación ─────────────────────────────────────────────────────── */
.bcl-cp-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.bcl-cp-chip {
  border: 1.5px solid var(--bcl-line);
  border-radius: 999px;
  padding: 8px 14px;
  background: white;
  font: inherit;
  font-size: 13.5px;
  color: var(--bcl-txt);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.06s;
}
.bcl-cp-chip:hover {
  background: var(--bcl-bg-soft);
  border-color: color-mix(in srgb, var(--bcl-c1) 25%, var(--bcl-line));
}
.bcl-cp-chip:active { transform: scale(0.96); }
.bcl-cp-chip.sel {
  background: var(--bcl-c1);
  border-color: var(--bcl-c1);
  color: white;
  box-shadow: 0 4px 12px -6px rgba(155,127,212,.55);
}

/* ── Custodia checkbox ──────────────────────────────────────────────────── */
.bcl-cp-custodia {
  margin: 0 18px 18px;
  padding: 14px;
  background: color-mix(in srgb, var(--bcl-c1) 5%, white);
  border: 1px solid color-mix(in srgb, var(--bcl-c1) 20%, var(--bcl-line));
  border-radius: 14px;
}
.bcl-cp-check {
  display: flex; gap: 12px; align-items: flex-start;
  cursor: pointer;
}
.bcl-cp-check input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.bcl-cp-check-box {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: 1.5px solid var(--bcl-line);
  border-radius: 6px;
  background: white;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  margin-top: 1px;
}
.bcl-cp-check-box i { width: 14px; height: 14px; }
.bcl-cp-check input[type="checkbox"]:checked + .bcl-cp-check-box {
  background: var(--bcl-c1);
  border-color: var(--bcl-c1);
  color: white;
}
.bcl-cp-check-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.bcl-cp-check-text strong {
  font-size: 13.5px;
  color: var(--bcl-txt);
}
.bcl-cp-check-text span {
  font-size: 12px;
  color: var(--bcl-muted);
  line-height: 1.55;
}

/* ── Preview PDF box ────────────────────────────────────────────────────── */
.bcl-cp-pdfbox {
  margin: 0 18px 18px;
  padding: 16px;
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--bcl-c1) 6%, white),
              color-mix(in srgb, var(--bcl-c2) 5%, white));
  border: 1px solid color-mix(in srgb, var(--bcl-c1) 22%, var(--bcl-line));
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.bcl-cp-pdfbox-meta {
  display: flex; flex-direction: column; gap: 3px;
}
.bcl-cp-pdfbox-meta strong {
  font-size: 14px;
  color: var(--bcl-txt);
}
.bcl-cp-pdfbox-meta span {
  font-size: 12.5px;
  color: var(--bcl-muted);
  line-height: 1.5;
}
.bcl-cp-btn-pdf {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--bcl-c1);
  border-radius: 14px;
  padding: 11px 16px;
  background: white;
  color: var(--bcl-c1-d);
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.06s, opacity 0.15s;
}
.bcl-cp-btn-pdf:hover:not([disabled]) {
  background: color-mix(in srgb, var(--bcl-c1) 8%, white);
}
.bcl-cp-btn-pdf:active:not([disabled]) { transform: scale(0.98); }
.bcl-cp-btn-pdf i { width: 16px; height: 16px; }
.bcl-cp-btn-pdf[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Estado loading del botón PDF (sin spinner Lucide para evitar SVG zombie) */
.bcl-cp-btn-pdf.bcl-cp-btn-pdf-loading {
  opacity: 0.65;
  background: var(--bcl-bg-soft);
}
.bcl-cp-btn-pdf.bcl-cp-btn-pdf-loading i {
  animation: bcl-cp-pulse 1.1s ease-in-out infinite;
}
@keyframes bcl-cp-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50%      { transform: scale(1.15); opacity: 1; }
}

/* ── Sección firma (C5.2.C.1 canvas activo · upload placeholder) ────────── */
.bcl-cp-firma .bcl-cp-firma-tabs {
  display: flex; flex-direction: column; gap: 10px;
}
.bcl-cp-firma-tab {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bcl-bg-soft);
  border: 1.5px dashed var(--bcl-line);
  border-radius: 14px;
  font: inherit;
  font-size: 14px; font-weight: 600;
  color: var(--bcl-muted);
  text-align: left;
  position: relative;
  cursor: not-allowed;
  opacity: 0.78;
}
/* Tab activa (firmar canvas) — gradiente sólido, clickable */
.bcl-cp-firma-tab-active {
  cursor: pointer;
  opacity: 1;
  color: white;
  background: var(--bcl-grad, linear-gradient(135deg, #9b7fd4, #b89aff));
  border: 1.5px solid transparent;
  box-shadow: 0 4px 14px rgba(155, 127, 212, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}
.bcl-cp-firma-tab-active:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(155, 127, 212, .38);
}
.bcl-cp-firma-tab-active:active:not([disabled]) {
  transform: scale(.98);
}
.bcl-cp-firma-tab-active[disabled] {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}
/* Botón "Firmar aquí mismo" en modo bloqueado: clickeable pero visual "disabled".
   El onclick muestra el campo concreto que falta en el aviso de abajo. */
.bcl-cp-firma-tab-active.is-bloqueado {
  cursor: pointer;
  opacity: .55;
  box-shadow: none;
  background: linear-gradient(135deg, #b3a4d4, #c8b9e6);
}
.bcl-cp-firma-tab-active.is-bloqueado:hover {
  opacity: .7;
  transform: none;
}
.bcl-cp-firma-tab i:first-child {
  width: 18px; height: 18px;
  flex-shrink: 0;
}
.bcl-cp-firma-tab > span:first-of-type { flex: 1; }
.bcl-cp-firma-soon {
  background: var(--bcl-c2);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.bcl-cp-firma-aviso {
  margin: 0;
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px;
  color: var(--bcl-muted);
  line-height: 1.5;
  background: rgba(155,127,212,.05);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(155,127,212,.15);
}
.bcl-cp-firma-aviso i {
  width: 14px; height: 14px;
  flex-shrink: 0;
  color: var(--bcl-c1-d);
  margin-top: 1px;
}
/* Variante error rojo: mensaje específico del campo que falta. */
.bcl-cp-firma-aviso.bcl-cp-firma-aviso-error {
  background: rgba(212, 76, 76, 0.08);
  border-color: rgba(212, 76, 76, 0.25);
  color: #8b1d1d;
  font-weight: 600;
}
.bcl-cp-firma-aviso.bcl-cp-firma-aviso-error i {
  color: #c43d3d;
}
@keyframes bclCpFirmaAvisoShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.bcl-cp-firma-aviso-shake {
  animation: bclCpFirmaAvisoShake 0.5s ease-in-out;
}

/* Preview firma capturada (post-canvas, antes de confirmar guardar) */
.bcl-cp-firma-preview {
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 14px;
  background: var(--bcl-bg-soft, #fff);
  border: 1.5px solid rgba(155, 127, 212, .30);
  border-radius: 14px;
}
.bcl-cp-firma-preview img {
  grid-row: 1 / span 2;
  width: 96px; height: 56px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 8px;
  padding: 4px;
}
.bcl-cp-firma-preview-meta {
  display: flex; flex-direction: column; gap: 2px;
}
.bcl-cp-firma-preview-meta strong {
  font-size: 14px; font-weight: 700;
  color: var(--bcl-txt);
}
.bcl-cp-firma-preview-meta span {
  font-size: 12px;
  color: var(--bcl-muted);
  line-height: 1.45;
}
.bcl-cp-firma-refirmar {
  grid-column: 2;
  align-self: start;
  justify-self: start;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: rgba(0,0,0,.04);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px; font-weight: 600;
  color: var(--bcl-txt);
  cursor: pointer;
  transition: background .15s ease;
}
.bcl-cp-firma-refirmar:hover { background: rgba(0,0,0,.07); }
.bcl-cp-firma-refirmar i { width: 14px; height: 14px; }

/* CTA "Firmar y guardar" — variante con shield icon */
.bcl-cp-btn-firmar i[data-lucide="loader"],
.bcl-cp-btn-firmar i.lucide-loader {
  animation: bclCpSpin 1s linear infinite;
}
@keyframes bclCpSpin {
  to { transform: rotate(360deg); }
}

/* ── Footer CTA ─────────────────────────────────────────────────────────── */
.bcl-cp-cta {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin-top: 14px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(253,246,240,.95);
  -webkit-backdrop-filter: blur(20px);
          backdrop-filter: blur(20px);
  border-top: 1px solid var(--bcl-line);
  box-shadow: 0 -8px 24px -16px rgba(0,0,0,.08);
}
.bcl-cp-btn-primary {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  border: 0; border-radius: 14px;
  padding: 13px 18px;
  background: var(--bcl-grad);
  color: white;
  font: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.15s;
  box-shadow: 0 6px 18px -8px rgba(155,127,212,.55);
}
.bcl-cp-btn-primary:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -10px rgba(155,127,212,.7);
}
.bcl-cp-btn-primary:active:not([disabled]) { transform: translateY(0); }
.bcl-cp-btn-primary i { width: 16px; height: 16px; }
.bcl-cp-btn-primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
