/* ============================================================
   overlay-contact.css — Modal de contacto QuVi
   Nomenclatura: cq-* (ContactoQuvi)
   Z-index: --z-modal (2000) / --z-modal-panel (2001)
   ============================================================ */

/* ─── Backdrop ────────────────────────────────────────────── */
.cq-backdrop {
  position: fixed; inset: 0;
  z-index: var(--z-modal, 2000);
  background: rgba(15,23,42,.52);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--motion-ease, ease);
  touch-action: none;
}
.cq-scroll-locked { overscroll-behavior: none; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cq-backdrop {
    background: rgba(15,23,42,.52);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }
}
.cq-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ─── Container ───────────────────────────────────────────── */
.cq-wrap {
  position: fixed; inset: 0;
  z-index: var(--z-modal-panel, 2001);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  padding: 16px;
  overscroll-behavior: contain;
}
.cq-wrap.is-open { pointer-events: auto; }

/* ─── Dialog ──────────────────────────────────────────────── */
.cq-dialog {
  --cq-brand: var(--brand, #1D6FE0);
  --surface: #fff;
  --label: #0b1220;
  --secondary: #667085;
  --fill: #f4f7fb;
  --separator: #e2e8f0;
  position: relative;
  background: var(--surface, #fff);
  border: 0;
  border-radius: 22px;
  width: min(620px, 100%);
  max-height: min(720px, calc(100dvh - 32px));
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 28px 90px rgba(15,23,42,.22);
  transform: scale(.96) translateY(8px);
  opacity: 0;
  transition:
    transform .28s cubic-bezier(.22,.61,.36,1),
    opacity .22s ease;
  outline: none;
}
.cq-wrap.is-open .cq-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ─── Header ──────────────────────────────────────────────── */
.cq-head {
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--separator, #e6eaf0);
  padding: 26px 28px 20px;
  flex: 0 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
}
.cq-head__brand {
  display: block; margin-bottom: 5px;
  font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cq-brand);
}
.cq-head__close {
  appearance: none; border: 0;
  background: var(--fill, #f4f6fa); color: var(--secondary, #6b7280);
  border-radius: 50%; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 0; flex: 0 0 auto;
  transition: background .15s ease;
}
.cq-head__close:hover { background: color-mix(in srgb,var(--cq-brand) 9%,#fff); color: var(--label, #111827); }
.cq-head__close:focus-visible { outline: 2px solid var(--cq-brand); outline-offset: 2px; }
.cq-head__close i, .cq-head__close svg { width: 16px; height: 16px; display: block; }

.cq-head__copy { min-width: 0; }
.cq-head__title {
  font-size: 1.35rem; font-weight: 800; line-height: 1.2; letter-spacing: -.02em;
  color: var(--label, #111827); margin: 0;
}
.cq-head__sub {
  font-size: .84rem; line-height: 1.55;
  color: var(--secondary, #6b7280); margin: 6px 0 0;
}

/* ─── Body ────────────────────────────────────────────────── */
.cq-body {
  flex: 1 1 auto; overflow-y: auto; min-height: 0;
  overscroll-behavior: contain;
  padding: 24px 28px 28px;
  background: var(--surface, #fff);
  display: flex; flex-direction: column; gap: 18px;
  touch-action: pan-y;
}
.cq-body::-webkit-scrollbar { width: 4px; }
.cq-body::-webkit-scrollbar-track { background: transparent; }
.cq-body::-webkit-scrollbar-thumb {
  background: var(--separator, #e6eaf0);
  border-radius: 2px;
}
.cq-body--message { padding-top: 20px; gap: 14px; }

/* ─── Footer / actions ────────────────────────────────────── */
.cq-foot {
  border-top: 1px solid var(--separator, #e6eaf0);
  padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex: 0 0 auto;
  background: var(--surface, #fff);
}
.cq-foot--end { justify-content: flex-end; }

/* ─── Buttons ─────────────────────────────────────────────── */
.cq-btn {
  appearance: none; border: 0;
  font: 600 13.5px/1.2 var(--font, system-ui);
  min-height: 46px; padding: 0 18px; border-radius:var(--qv-action-radius,9999px);
  cursor: pointer; white-space: nowrap;
  transition: all .14s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.cq-btn i, .cq-btn svg { width: 14px; height: 14px; display: block; }

.cq-btn--ghost {
  background: var(--fill, #f4f6fa);
  color: var(--secondary, #6b7280);
}
.cq-btn--ghost:hover {
  background: var(--separator, #e6eaf0);
  color: var(--label, #111827);
}
.cq-btn--primary {
  background: var(--cq-brand);
  color: #fff;
  box-shadow: none;
}
.cq-btn--primary:hover { filter: brightness(1.07); }
.cq-btn--primary:disabled {
  background: var(--tint-disabled, #b3d9ff);
  cursor: not-allowed;
  filter: none;
}
.cq-btn--primary.is-loading { opacity: .7; cursor: wait; }

/* ─── Lista de temas (step 1) ─────────────────────────────── */
.cq-dialog[data-step="1"] { width: min(520px, 100%); }
.cq-body--topics { padding-top: 4px; padding-bottom: 12px; }
.cq-intents {
  display: block;
}
.cq-intent {
  appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e3ebf6;
  background: transparent;
  padding: 14px 2px;
  cursor: pointer; text-align: left;
  display: grid; grid-template-columns:34px minmax(0,1fr) 16px; gap:12px; align-items:center;
  transition: background-color .14s ease;
}
.cq-intent:last-child { border-bottom: 0; }
.cq-intent:hover {
  background: color-mix(in srgb,var(--brand, #0d99ff) 4%,var(--surface, #fff));
}
.cq-intent__icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-tint, #edf5ff);
  display: flex; align-items: center; justify-content: center;
  transition: background .14s ease;
}
.cq-intent:hover .cq-intent__icon {
  background: color-mix(in oklch, var(--brand, #0d99ff) 14%, white 86%);
}
.cq-intent__icon i, .cq-intent__icon svg {
  width: 16px; height: 16px; display: block;
  color: var(--brand, #0d99ff);
}
.cq-intent__label {
  font-size: 14px; font-weight: 700; line-height: 1.35;
  color: var(--label, #111827);
}
.cq-intent__arrow {
  display: grid; place-items: center;
  color: var(--tertiary, #94a3b8);
  transition: color .14s ease, transform .14s ease;
}
.cq-intent__arrow i, .cq-intent__arrow svg { width: 15px; height: 15px; }
.cq-intent:hover .cq-intent__arrow { color: var(--cq-brand); transform: translateX(2px); }

/* ─── Fields ──────────────────────────────────────────────── */
.cq-fields { display: flex; flex-direction: column; gap: 12px; }
.cq-fields--row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.cq-field { display: flex; flex-direction: column; gap: 5px; }
.cq-field label {
  font-size: 13px; font-weight: 600; color: var(--label, #111827);
}
.cq-field label .cq-opt {
  font-weight: 400; color: var(--secondary, #6b7280); font-size: 12px;
}
.cq-field input,
.cq-field textarea,
.cq-field select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background: var(--surface, #fff);
  border: 1px solid #dce6f5;
  border-radius: var(--rad-md, 12px);
  padding: 10px 13px;
  font: 400 14px/1.4 var(--font, system-ui);
  color: var(--label, #111827);
  width: 100%; box-sizing: border-box;
  height: 42px;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
  outline: none;
}
.cq-field textarea { height: auto; }
.cq-field input::placeholder,
.cq-field textarea::placeholder { color: var(--secondary, #6b7280); }
.cq-field input:focus,
.cq-field textarea:focus {
  border-color: var(--brand, #0d99ff);
  background: var(--surface, #fff);
  box-shadow: 0 0 0 2px var(--brand-a16, color-mix(in srgb,var(--brand, #0d99ff) 16%,transparent));
}
.cq-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.cq-field select:focus {
  border-color: var(--brand, #0d99ff);
  background-color: var(--surface, #fff);
  box-shadow: 0 0 0 2px var(--brand-a16, color-mix(in srgb,var(--brand, #0d99ff) 16%,transparent));
}
.cq-field textarea {
  resize: vertical; min-height: 140px; max-height: 260px; line-height: 1.55;
}
.cq-field--error input,
.cq-field--error textarea { border-color: var(--error, #f87171); }
.cq-field__err {
  font-size: 11.5px; color: var(--error-ink, #dc2626); display: none;
}
.cq-field--error .cq-field__err { display: block; }

.cq-char {
  font-size: 11px; color: var(--secondary, #6b7280);
  text-align: right; margin-top: 4px;
}
.cq-char.is-warn { color: var(--warn-ink, #b45309); }

/* ─── Consent ─────────────────────────────────────────────── */
.cq-consent {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  background: var(--fill, #f4f6fa);
  border-radius: var(--rad-md, 12px);
}
.cq-consent input[type="checkbox"] {
  flex: 0 0 auto; margin-top: 1px;
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--brand, #0d99ff);
}
.cq-consent label {
  font-size: 12px; line-height: 1.55; color: var(--secondary, #6b7280); cursor: pointer;
}
.cq-consent label a { color: var(--brand, #0d99ff); text-decoration: none; }
.cq-consent label a:hover { text-decoration: underline; }

/* ─── Error message bar ───────────────────────────────────── */
.cq-err {
  display: none; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--error-ink, #dc2626);
  padding: 10px 13px; border-radius: var(--rad-md, 12px);
  background: var(--error-bg, #fef2f2);
  border: 1px solid color-mix(in oklch, var(--error, #f87171) 28%, transparent 72%);
}
.cq-err.is-visible { display: flex; }
.cq-err i, .cq-err svg { width: 13px; height: 13px; display: block; flex: 0 0 auto; }

/* ─── Honeypot ────────────────────────────────────────────── */
.cq-hp {
  position: absolute; left: -9999px; width: 1px; height: 1px;
  overflow: hidden; opacity: 0; pointer-events: none;
}

/* ─── Success ─────────────────────────────────────────────── */
.cq-success {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 28px 24px 24px; gap: 10px;
}
.cq-success__ring {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--success-bg, #f0fdf4);
  display: flex; align-items: center; justify-content: center;
  color: var(--success, #22c55e);
  box-shadow: 0 0 0 8px color-mix(in oklch, var(--success, #22c55e) 10%, transparent 90%);
}
.cq-success__ring i, .cq-success__ring svg { width: 28px; height: 28px; display: block; }
.cq-success__title {
  font-size: 18px; font-weight: 700; color: var(--label, #111827);
  margin: 6px 0 0;
}
.cq-success__sub {
  font-size: 14px; line-height: 1.55; color: var(--secondary, #6b7280);
  margin: 0; max-width: 340px;
}
.cq-success__note {
  font-size: 12px; color: var(--secondary, #6b7280);
  padding: 10px 16px;
  background: var(--fill, #f4f6fa);
  border-radius: var(--rad-md, 12px);
  margin-top: 8px;
}

/* ─── Mobile ──────────────────────────────────────────────── */
@media (max-width: 599px) {
  .cq-wrap {
    padding: 16px;
    align-items: center;
  }
  .cq-dialog {
    width: 100%;
    max-height: calc(100dvh - 32px);
    border-radius: 22px;
    transform: scale(.98) translateY(8px);
    opacity: 0;
  }
  .cq-wrap.is-open .cq-dialog { transform: scale(1) translateY(0); opacity: 1; }
  .cq-fields--row { grid-template-columns: 1fr; }
  .cq-head { padding: 22px 20px 17px; }
  .cq-body { padding: 20px; }
  .cq-foot { padding: 14px 20px; }
}

/* ─── Dark mode ───────────────────────────────────────────── */
body.oscuro .cq-dialog {
  box-shadow: 0 24px 64px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.3);
}
