/* distribuidores.php — rediseño Industrial-Agro B2B (split-screen + ticket en vivo).
   Hoja propia, sin depender de formularios-pro.css/ui-pro.css: paleta reutiliza los mismos hex
   institucionales (verde/esmeralda/profundo), pero la estructura (líneas finas tipo slate, tipografía
   del sistema, radios pequeños) es deliberadamente distinta del resto de formularios del sitio. */

.dist2 {
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface: #ffffff;
  --canvas: #f8fafc;
  --brand: #009546;
  --brand-deep: #00713a;
  --brand-ink: #0a3d23;
  --brand-tint: #eef6f0;
  /* Escala emerald institucional, para los estados de foco/activo pedidos por el usuario. */
  --em-50: #eef6f0;
  --em-100: #d7ecdf;
  --em-700: #00713a;
  --em-800: #075c34;
  --em-900: #0a3d23;
  --em-950: #05261a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  padding: 24px 16px 64px;
}

/* Con main_flush el <main> ya no tiene margen: el despeje del navbar va como relleno para que el
   fondo --canvas cubra también la zona detrás del navbar flotante. */
main.dist2 {
  padding-top: calc(var(--sv-navbar-clear, var(--sv-navbar-clear-fallback)) + 24px);
}

.dist2-top {
  max-width: 1180px;
  margin: 0 auto 28px;
}

.dist2-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.dist2-top h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.dist2-lead {
  margin: 0;
  max-width: 62ch;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------- Layout split-screen ---------- */

.dist2-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.dist2-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dist2-step {
  padding: 22px 22px;
  border-bottom: 1px solid var(--line);
}

.dist2-step:last-child {
  border-bottom: 0;
}

/* Aviso temporal cuando falta ese paso al intentar enviar (js/distribuidores.js): anillo rojo
   pulsante, sin cambiar bordes/tamaño del paso para no mover el layout. */
.dist2-step--alerta {
  border-radius: 6px;
  animation: dist2AlertaPulso 1.4s ease-in-out infinite;
}

@keyframes dist2AlertaPulso {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.6), 0 0 0 2px rgba(220, 38, 38, 0.15); }
  50% { box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.35), 0 0 0 5px rgba(220, 38, 38, 0.08); }
}

@media (prefers-reduced-motion: reduce) {
  .dist2-step--alerta {
    animation: none;
    box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.6);
  }
}

.dist2-step h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.dist2-step h2 span {
  font-variant-numeric: tabular-nums;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--em-100);
  background: var(--em-900);
  border-radius: 4px;
  padding: 2px 7px;
}

.dist2-field {
  margin-bottom: 14px;
}

.dist2-field:last-of-type {
  margin-bottom: 10px;
}

.dist2-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.dist2-field select,
.dist2-field input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 36px 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  appearance: none;
  -webkit-appearance: none;
}

.dist2-field select {
  background: var(--canvas) url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23475569'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.1l3.71-3.87a.75.75 0 111.08 1.04l-4.25 4.43a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 16px;
}

.dist2-field select:focus,
.dist2-field input[type="text"]:focus {
  outline: none;
  border-color: var(--em-700);
  box-shadow: 0 0 0 3px rgba(0, 113, 58, 0.2);
}

.dist2-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.dist2-hint a {
  color: var(--brand-deep);
  font-weight: 600;
}

.dist2-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--brand-tint);
  border: 1px solid var(--em-100);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--brand-ink);
}

.dist2-callout .dist2-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--brand-deep);
}

.dist2-callout strong {
  color: var(--em-900);
}

/* ---------- Fichas de tipo de negocio (radio) ---------- */

.dist2-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dist2-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.dist2-tile input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.dist2-tile .dist2-icon {
  width: 22px;
  height: 22px;
  color: var(--ink-soft);
}

.dist2-tile span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.dist2-tile:has(input:checked) {
  border-color: var(--em-700);
  background: rgba(238, 246, 240, 0.6);
}

.dist2-tile:has(input:checked) .dist2-icon,
.dist2-tile:has(input:checked) span {
  color: var(--em-950);
}

.dist2-tile:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Pills de catálogos (checkbox) ---------- */

.dist2-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 480px) {
  .dist2-pills {
    gap: 10px;
  }
}

/* Texto estático, sin ícono: el ancho de cada pill no cambia al activarse (evita layout shift en
   móvil), el estado se distingue solo por color/borde. */
.dist2-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.dist2-pill input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.dist2-pill:hover {
  border-color: var(--em-700);
}

/* bg-emerald-800 text-white border-emerald-800, tal como lo pidió el usuario */
.dist2-pill:has(input:checked) {
  background: var(--em-800);
  border-color: var(--em-800);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(5, 38, 26, 0.12);
}

.dist2-pill:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Ticket de solicitud (columna derecha) ---------- */

.dist2-ticket {
  background: var(--brand-ink);
  color: #fff;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
}

.dist2-ticket__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.28);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dist2-ticket__body {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dist2-ticket__body dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2px;
}

.dist2-ticket__body dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.dist2-ticket__aviso {
  margin: -4px 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

.dist2-ticket__aviso a {
  color: #fff;
  font-weight: 600;
}

.dist2-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

.dist2-submit:hover {
  background: #00a852;
}

.dist2-submit .dist2-icon {
  width: 18px;
  height: 18px;
}

.dist2-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

/* ---------- Desktop: split-screen real, ticket "pegado" ---------- */

@media (min-width: 900px) {
  .dist2-layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
    align-items: start;
  }

  .dist2-ticket {
    position: sticky;
    top: calc(var(--sv-navbar-clear, var(--sv-navbar-clear-fallback, 112px)) + 16px);
  }
}
