/**
 * MasGood CF7 Steps.
 *
 * Estilos del formulario comercial integrado con Contact Form 7.
 * Autor: German Durán.
 */

/* Scope global del plugin: evita que el CSS afecte otros formularios del sitio. */
.masgood-cf7-steps,
.masgood-cf7-steps * {
  box-sizing: border-box;
}

.masgood-cf7-steps {
  --masgood-blue: #2b6cb0;
  --masgood-ink: #1a1a1a;
  --masgood-navy: #1c2c44;
  --masgood-muted: #4b5563;
  --masgood-line: #d1d5db;
  --masgood-card: #d9e5f3;
  --masgood-danger: #dc2626;
  color: var(--masgood-ink);
  font-family: NimbusSans, Arial, Helvetica, sans-serif;
}

/* CF7 puede inyectar <p>/<br>; estas reglas hacen el layout tolerante a ese HTML. */
.masgood-cf7-steps p {
  margin: 0;
  padding: 0;
}

.masgood-cf7-steps br {
  display: none;
}

.masgood-business-grid > p,
.masgood-mobile-progress > p,
.masgood-actions > p {
  display: contents;
}

/* El formulario real lo renderiza Contact Form 7; este bloque controla su caja visual. */
.masgood-cf7-steps .wpcf7-form {
  background: #fff;
  display: flex;
  flex-direction: column;
  padding: 48px 96px;
}

.masgood-cf7-steps .hidden-fields-container {
  order: 0;
}

.masgood-cf7-steps .masgood-form-shell {
  order: 1;
}

.masgood-cf7-steps .wpcf7-turnstile {
  align-self: flex-start;
  margin-top: 24px;
  order: 2;
}

.masgood-cf7-steps .wpcf7-response-output {
  order: 3;
}

/* Layout desktop: pasos 1 y 2 arriba, datos de contacto abajo. */
.masgood-form-shell {
  display: flex;
  flex-direction: column;
}

.masgood-top-steps {
  border-bottom: 1px solid var(--masgood-line);
  display: grid;
  gap: 64px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding-bottom: 48px;
}

.masgood-step {
  position: relative;
}

.masgood-step-location {
  border-left: 1px solid #e5e7eb;
  min-height: 300px;
  padding-left: 64px;
  position: relative;
}

.masgood-step-location::before {
  background-image: url("../img/mapa.png");
  background-position: right 8px top 26px;
  background-repeat: no-repeat;
  background-size: 210px auto;
  content: "";
  inset: 0;
  opacity: 0.55;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.masgood-step-contact {
  padding-top: 40px;
}

.masgood-heading {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0 0 24px;
}

.masgood-heading strong {
  font-size: 32px;
  line-height: 1;
}

.masgood-heading span {
  font-size: 26px;
  line-height: 1.35;
}

/* Tarjetas de selección de negocio. El JS sincroniza esta selección con un hidden de CF7. */
.masgood-business-grid {
  display: grid;
  gap: 18px 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.masgood-business-card {
  align-items: center !important;
  background: var(--masgood-card) !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  color: var(--masgood-navy) !important;
  cursor: pointer !important;
  display: flex !important;
  flex-direction: column !important;
  font: inherit !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  gap: 12px !important;
  height: 142px !important;
  justify-content: center !important;
  line-height: 1.05 !important;
  min-width: 0 !important;
  padding: 18px 16px !important;
  text-align: center !important;
  text-transform: none !important;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease !important;
}

.masgood-business-card:hover,
.masgood-business-card:focus-visible {
  background: rgba(255, 255, 255, 0) !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--masgood-blue), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1) !important;
  outline: 0 !important;
}

.masgood-business-card svg {
  color: currentColor !important;
  display: block !important;
  flex-shrink: 0 !important;
  height: 42px !important;
  overflow: visible !important;
  width: 42px !important;
}

.masgood-business-card path,
.masgood-business-card circle {
  fill: none !important;
  stroke: currentColor !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  stroke-width: 2.2 !important;
}

.masgood-field-icon path {
  fill: currentColor !important;
}

.masgood-business-card path[fill="none"] {
  fill: none !important;
  stroke: currentColor !important;
}

.masgood-business-card span br {
  display: block !important;
}

.masgood-business-card.is-selected {
  background: var(--masgood-blue) !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--masgood-blue), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1) !important;
  color: #fff !important;
}

.masgood-business-card.is-selected svg {
  color: #fff !important;
}

/* Override específico para Salient: el tema aplica reglas globales a todos los button. */
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card:hover,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card:focus,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card:focus-visible,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card.is-selected {
  -webkit-appearance: none !important;
  appearance: none !important;
  -webkit-border-radius: 12px !important;
  border-radius: 12px !important;
  border-width: 0 !important;
  min-height: 0 !important;
  text-decoration: none !important;
  text-shadow: none !important;
}

body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card::before,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card::after {
  content: none !important;
  display: none !important;
}

body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card:not(.is-selected):not(:hover):not(:focus-visible) {
  background: var(--masgood-card) !important;
  box-shadow: none !important;
  color: var(--masgood-navy) !important;
}

body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card:hover,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card:focus-visible {
  background: rgba(255, 255, 255, 0) !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--masgood-blue), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1) !important;
  color: var(--masgood-navy) !important;
}

body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card.is-selected,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card.is-selected:hover,
body[data-button-style^="rounded"] .masgood-cf7-steps .masgood-business-card.is-selected:focus-visible {
  background: var(--masgood-blue) !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--masgood-blue), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1) !important;
  color: #fff !important;
}

/* Compatibilidad: oculta el SVG/IMG viejo si quedó pegado en una plantilla anterior. */
.masgood-map {
  display: none !important;
}

/* Campos reales de CF7: text, email, tel, select o textarea. */
.masgood-fields,
.masgood-contact-grid {
  display: grid;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.masgood-fields {
  max-width: 512px;
  padding-top: 4px;
}

.masgood-contact-grid {
  gap: 24px;
}

.masgood-contact-row {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.masgood-field {
  display: block;
  position: relative;
}

.masgood-field .wpcf7-form-control-wrap {
  display: block;
}

.masgood-field input,
.masgood-field select,
.masgood-field textarea {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #9ca3af;
  border-radius: 12px;
  color: var(--masgood-ink);
  display: block;
  font: inherit;
  font-size: 16px;
  min-height: 56px;
  padding: 16px 24px;
  width: 100%;
}

.masgood-field-with-icon input {
  padding-left: 64px;
}

.masgood-field-icon {
  color: var(--masgood-muted);
  display: block;
  fill: currentColor;
  flex-shrink: 0;
  height: 24px;
  left: 20px;
  pointer-events: none;
  position: absolute;
  top: 17px;
  width: 24px;
  z-index: 2;
}

/* Estados de error locales y estados nativos que agrega CF7 al validar. */
.masgood-field.is-invalid input,
.masgood-field.is-invalid select,
.masgood-field.is-invalid textarea,
.masgood-field input.wpcf7-not-valid,
.masgood-field select.wpcf7-not-valid,
.masgood-field textarea.wpcf7-not-valid {
  border-color: var(--masgood-danger);
}

.masgood-field .wpcf7-not-valid-tip {
  color: var(--masgood-danger);
  font-size: 13px;
  margin-top: 6px;
}

.masgood-field-error {
  color: var(--masgood-danger);
  display: block;
  font-size: 13px;
  line-height: 1.3;
  margin-top: 6px;
}

/* Botones del wizard mobile y submit final de CF7. */
.masgood-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  padding-top: 16px;
}

.masgood-next,
.masgood-prev,
.masgood-cf7-steps input[type="submit"].masgood-submit {
  align-items: center;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  justify-content: center;
  min-height: 52px;
  padding: 0 36px;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.masgood-next,
.masgood-cf7-steps input[type="submit"].masgood-submit {
  background: var(--masgood-blue);
  box-shadow: 0 2px 4px -2px rgba(0, 0, 0, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  color: #fff;
}

.masgood-prev {
  background: #eef2f7;
  color: #1c2c44;
  display: none;
}

.masgood-next:hover,
.masgood-cf7-steps input[type="submit"].masgood-submit:hover {
  background: #235a94;
  transform: translateY(-1px);
}

.masgood-prev:hover {
  background: #e2e8f0;
}

.masgood-step-business .masgood-actions,
.masgood-step-location .masgood-actions {
  display: none;
}

/* Barra de progreso: solo aparece en mobile. */
.masgood-mobile-progress {
  display: none;
}

/* Respuesta final de Contact Form 7. */
.masgood-cf7-steps .wpcf7-response-output {
  border-radius: 12px;
  margin: 24px 0 0;
  padding: 12px 16px;
}

.masgood-success {
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(28, 44, 68, 0.08);
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: 760px;
  padding: 48px;
  text-align: center;
  width: 100%;
}

.masgood-success[hidden] {
  display: none;
}

.masgood-success-check {
  align-items: center;
  background: #e9fbf1;
  border: 2px solid #baf0d0;
  border-radius: 999px;
  color: #059669;
  display: flex;
  height: 80px;
  justify-content: center;
  margin-bottom: 28px;
  width: 80px;
}

.masgood-success-check svg {
  fill: currentColor;
  height: 42px;
  width: 42px;
}

.masgood-success h2 {
  color: var(--masgood-ink);
  font-size: 32px;
  line-height: 1.15;
  margin: 0 0 14px;
}

.masgood-success > p {
  color: #6b625d;
  font-size: 20px;
  line-height: 1.45;
  margin: 0 0 34px;
  max-width: 560px;
}

.masgood-success-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  text-align: left;
  width: 100%;
}

.masgood-success-summary-head {
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.masgood-success-summary-head span,
.masgood-success-summary-grid small {
  color: #8ba0bc;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.masgood-success-summary-head strong {
  background: #c9f7df;
  border-radius: 999px;
  color: #047857;
  font-size: 13px;
  padding: 4px 12px;
}

.masgood-success-summary-grid {
  display: grid;
  gap: 20px 36px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.masgood-success-summary-grid b {
  color: var(--masgood-navy);
  display: block;
  font-size: 16px;
  line-height: 1.35;
  margin-top: 7px;
}

.masgood-success-actions {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 34px;
}

.masgood-success-primary,
.masgood-success-secondary {
  align-items: center;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  justify-content: center;
  min-height: 52px;
  padding: 0 32px;
  text-decoration: none;
}

.masgood-success-primary {
  background: var(--masgood-blue);
  box-shadow: 0 10px 18px rgba(43, 108, 176, 0.28);
  color: #fff;
}

.masgood-success-primary:hover {
  color: #fff;
}

.masgood-success-secondary {
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #5b5551;
}

/* Tablet: reduce paddings sin cambiar el flujo. */
@media (max-width: 1024px) {
  .masgood-cf7-steps .wpcf7-form {
    padding: 40px 32px;
  }

  .masgood-top-steps {
    gap: 32px;
  }

  .masgood-step-location {
    padding-left: 32px;
  }
}

/* Mobile: los mismos campos pasan a verse como wizard por pasos. */
@media (max-width: 767px) {
  .masgood-cf7-steps .wpcf7-form {
    padding: 24px 16px;
  }

  .masgood-mobile-progress {
    display: flex;
    gap: 7px;
    margin-bottom: 20px;
  }

  .masgood-mobile-progress span {
    background: #d1d5db;
    border-radius: 9999px;
    cursor: pointer;
    display: block;
    flex: 1;
    height: 4px;
  }

  .masgood-mobile-progress span.is-active {
    background: var(--masgood-blue);
  }

  .masgood-mobile-progress span.is-locked {
    cursor: not-allowed;
    opacity: 0.55;
  }

  .masgood-top-steps {
    border-bottom: 0;
    display: block;
    padding-bottom: 0;
  }

  .masgood-cf7-steps[data-current-step="1"] [data-masgood-step]:not([data-masgood-step="1"]),
  .masgood-cf7-steps[data-current-step="2"] [data-masgood-step]:not([data-masgood-step="2"]),
  .masgood-cf7-steps[data-current-step="3"] [data-masgood-step]:not([data-masgood-step="3"]) {
    display: none;
  }

  .masgood-cf7-steps[data-current-step="1"] .wpcf7-turnstile,
  .masgood-cf7-steps[data-current-step="2"] .wpcf7-turnstile {
    display: none !important;
  }

  .masgood-cf7-steps[data-current-step="1"] [data-masgood-step]:not([data-masgood-step="1"]) .wpcf7-not-valid-tip,
  .masgood-cf7-steps[data-current-step="2"] [data-masgood-step]:not([data-masgood-step="2"]) .wpcf7-not-valid-tip,
  .masgood-cf7-steps[data-current-step="3"] [data-masgood-step]:not([data-masgood-step="3"]) .wpcf7-not-valid-tip,
  .masgood-cf7-steps[data-current-step="1"] [data-masgood-step]:not([data-masgood-step="1"]) .masgood-field-error,
  .masgood-cf7-steps[data-current-step="2"] [data-masgood-step]:not([data-masgood-step="2"]) .masgood-field-error,
  .masgood-cf7-steps[data-current-step="3"] [data-masgood-step]:not([data-masgood-step="3"]) .masgood-field-error {
    display: none;
  }

  .masgood-step-location,
  .masgood-step-contact {
    border-left: 0;
    min-height: 0;
    padding: 0;
  }

  .masgood-heading strong {
    font-size: 26px;
  }

  .masgood-heading span {
    font-size: 20px;
    line-height: 1.25;
  }

  .masgood-heading {
    gap: 6px;
    margin-bottom: 20px;
  }

  .masgood-business-grid {
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .masgood-business-card {
    font-size: 12px !important;
    gap: 9px !important;
    height: 108px !important;
    padding: 14px 10px !important;
  }

  .masgood-business-card svg {
    height: 34px !important;
    width: 34px !important;
  }

  .masgood-map {
    display: none !important;
  }

  .masgood-step-location::before {
    background-position: right 0 top 42px;
    background-size: 150px auto;
    opacity: 0.32;
  }

  .masgood-contact-row {
    grid-template-columns: 1fr;
  }

  .masgood-fields,
  .masgood-contact-grid {
    gap: 14px;
  }

  .masgood-field input,
  .masgood-field select,
  .masgood-field textarea {
    font-size: 14px;
    min-height: 48px;
    padding: 12px 16px;
  }

  .masgood-field-with-icon input {
    padding-left: 48px;
  }

  .masgood-field-icon {
    height: 19px;
    left: 17px;
    top: 14px;
    width: 19px;
  }

  .masgood-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
  }

  .masgood-step-business .masgood-actions,
  .masgood-step-location .masgood-actions {
    display: flex;
  }

  .masgood-next,
  .masgood-prev,
  .masgood-cf7-steps input[type="submit"].masgood-submit {
    display: inline-flex;
    font-size: 16px;
    min-height: 46px;
    padding: 0 22px;
    width: 100%;
  }

  .masgood-success {
    border-radius: 16px;
    padding: 30px 18px;
  }

  .masgood-success h2 {
    font-size: 24px;
  }

  .masgood-success > p {
    font-size: 16px;
    margin-bottom: 28px;
  }

  .masgood-success-summary {
    padding: 18px;
  }

  .masgood-success-summary-grid {
    grid-template-columns: 1fr;
  }

  .masgood-success-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .masgood-success-primary,
  .masgood-success-secondary {
    font-size: 15px;
    min-height: 46px;
    width: 100%;
  }
}
