/* ═══════════════════════════════════════════════════════════════════════════
   b2b-panel-flotante.css  —  Panel wizard B2B sobre el mapa Leaflet
   MAPITA · Logística y Comercio Exterior
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --b2b-bg:          #1a1d2e;
  --b2b-bg2:         #22263a;
  --b2b-border:      #2e3350;
  --b2b-accent:      #4f8ef7;
  --b2b-accent2:     #3ecf8e;
  --b2b-warn:        #f7a84f;
  --b2b-danger:      #f76f6f;
  --b2b-text:        #e2e8f0;
  --b2b-muted:       #8896b3;
  --b2b-radius:      10px;
  --b2b-shadow:      0 8px 32px rgba(0,0,0,.55);
  --b2b-w:           420px;
  --b2b-h-max:       82vh;
  --b2b-header-h:    48px;
  --b2b-step-dot:    28px;
  --b2b-z:           1500;        /* por encima de controles Leaflet */
}

/* ── Contenedor principal ──────────────────────────────────────────────────── */
#b2b-panel-flotante {
  position: fixed;
  top: 80px;
  right: 20px;
  width: var(--b2b-w);
  max-height: var(--b2b-h-max);
  z-index: var(--b2b-z);
  background: var(--b2b-bg);
  border: 1px solid var(--b2b-border);
  border-radius: var(--b2b-radius);
  box-shadow: var(--b2b-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 13px;
  color: var(--b2b-text);
  user-select: none;
  transition: opacity .2s, transform .2s;
}
#b2b-panel-flotante.b2b-oculto {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
}
#b2b-panel-flotante.b2b-minimizado .b2b-body,
#b2b-panel-flotante.b2b-minimizado .b2b-nav {
  display: none;
}

/* ── Header / drag handle ─────────────────────────────────────────────────── */
.b2b-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--b2b-header-h);
  padding: 0 12px;
  background: var(--b2b-bg2);
  border-bottom: 1px solid var(--b2b-border);
  cursor: move;
  flex-shrink: 0;
}
.b2b-header-icon {
  font-size: 18px;
  line-height: 1;
}
.b2b-header-title {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.b2b-header-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--b2b-accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: .5px;
}
.b2b-btn-icon {
  background: none;
  border: none;
  color: var(--b2b-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.b2b-btn-icon:hover { color: var(--b2b-text); background: rgba(255,255,255,.07); }

/* ── Progress steps ───────────────────────────────────────────────────────── */
.b2b-steps {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--b2b-bg2);
  border-bottom: 1px solid var(--b2b-border);
  flex-shrink: 0;
  gap: 0;
}
.b2b-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.b2b-step::after {
  content: '';
  position: absolute;
  top: calc(var(--b2b-step-dot)/2 - 1px);
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--b2b-border);
  z-index: 0;
}
.b2b-step:last-child::after { display: none; }
.b2b-step-dot {
  width: var(--b2b-step-dot);
  height: var(--b2b-step-dot);
  border-radius: 50%;
  border: 2px solid var(--b2b-border);
  background: var(--b2b-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  position: relative;
  z-index: 1;
  transition: border-color .2s, background .2s, color .2s;
}
.b2b-step.activo  .b2b-step-dot { border-color: var(--b2b-accent); color: var(--b2b-accent); }
.b2b-step.ok      .b2b-step-dot { border-color: var(--b2b-accent2); background: var(--b2b-accent2); color: #fff; }
.b2b-step-label {
  font-size: 9px;
  color: var(--b2b-muted);
  margin-top: 3px;
  text-align: center;
  white-space: nowrap;
}
.b2b-step.activo .b2b-step-label { color: var(--b2b-accent); }
.b2b-step.ok     .b2b-step-label { color: var(--b2b-accent2); }

/* ── Body scrollable ──────────────────────────────────────────────────────── */
.b2b-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--b2b-border) transparent;
}
.b2b-body::-webkit-scrollbar { width: 5px; }
.b2b-body::-webkit-scrollbar-thumb { background: var(--b2b-border); border-radius: 3px; }

/* ── Slide (step panel) ───────────────────────────────────────────────────── */
.b2b-slide { display: none; }
.b2b-slide.activo { display: block; }
.b2b-slide-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #7ab8ff;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: .3px;
}
.b2b-slide-title span { font-size: 18px; }

/* ── Inputs y selects ─────────────────────────────────────────────────────── */
.b2b-field { margin-bottom: 10px; }
.b2b-field label {
  display: block;
  font-size: 11px;
  color: #a0aec8;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.b2b-field label em {
  color: var(--b2b-danger);
  font-style: normal;
}
.b2b-input, .b2b-select {
  width: 100%;
  background: #2a3050;
  border: 1px solid var(--b2b-border);
  color: #f0f4ff;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
  /* Flecha del select en color claro */
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238896b3' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
/* Para input no usar el background-image de la flecha */
.b2b-input {
  background-image: none;
  padding-right: 10px;
  -webkit-appearance: auto;
  appearance: auto;
}
.b2b-input:focus, .b2b-select:focus { border-color: var(--b2b-accent); }
.b2b-input::placeholder { color: #8896b3; }

/* Opciones del select — contraste garantizado */
.b2b-select option {
  background: #1e2340;
  color: #e8eeff;
  padding: 6px 10px;
  font-size: 12px;
}
.b2b-select option:checked,
.b2b-select option:hover {
  background: #4f8ef7;
  color: #fff;
}

/* textarea también */
.b2b-body textarea.b2b-input {
  background: #2a3050;
  color: #f0f4ff;
  background-image: none;
  padding-right: 10px;
}

/* Grupos de 2 columnas */
.b2b-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.b2b-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ── Tarjetas de elección (radio-cards) ───────────────────────────────────── */
.b2b-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.b2b-cards.col3 { grid-template-columns: 1fr 1fr 1fr; }
.b2b-card-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: #252840;
  border: 1px solid #3a4060;
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  font-size: 11px;
  color: #d4dbf0;
  font-weight: 500;
}
.b2b-card-opt:hover   { background: rgba(79,142,247,.15); border-color: var(--b2b-accent); color: #fff; }
.b2b-card-opt.sel     { border-color: var(--b2b-accent); background: rgba(79,142,247,.22); color: #fff; }
.b2b-card-opt .b2b-icon { font-size: 22px; line-height: 1; }
.b2b-card-opt .b2b-clabel { color: #7a8aaa; font-size: 10px; margin-top: 2px; }

/* ── Checkboxes de accesorios ─────────────────────────────────────────────── */
.b2b-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 10px;
}
.b2b-check-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 8px;
  background: var(--b2b-bg2);
  border: 1px solid var(--b2b-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: border-color .12s;
}
.b2b-check-item input[type=checkbox] { margin-top: 1px; accent-color: var(--b2b-accent); }
.b2b-check-item .b2b-chk-desc { color: var(--b2b-muted); font-size: 10px; }

/* ── Resumen de seguros ───────────────────────────────────────────────────── */
.b2b-seguros-resumen { display: flex; flex-direction: column; gap: 7px; }
.b2b-seg-card {
  background: var(--b2b-bg2);
  border: 1px solid var(--b2b-border);
  border-radius: 7px;
  padding: 8px 10px;
}
.b2b-seg-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
}
.b2b-seg-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(79,142,247,.18);
  color: var(--b2b-accent);
}
.b2b-seg-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--b2b-muted);
  padding: 1px 0;
}
.b2b-seg-row strong { color: var(--b2b-text); }
.b2b-seg-total {
  margin-top: 8px;
  background: rgba(62,207,142,.08);
  border: 1px solid rgba(62,207,142,.25);
  border-radius: 7px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}
.b2b-seg-total-label { color: var(--b2b-accent2); font-size: 12px; }
.b2b-seg-total-val   { font-size: 15px; color: var(--b2b-accent2); }
.b2b-seg-ahorro { font-size: 10px; color: var(--b2b-muted); text-align: right; margin-top: 3px; }

/* ── Advertencias inline ──────────────────────────────────────────────────── */
.b2b-warn-box {
  background: rgba(247,168,79,.08);
  border: 1px solid rgba(247,168,79,.3);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 11px;
  color: var(--b2b-warn);
  margin-bottom: 8px;
}
.b2b-info-box {
  background: rgba(79,142,247,.08);
  border: 1px solid rgba(79,142,247,.2);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 11px;
  color: var(--b2b-accent);
  margin-bottom: 8px;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.b2b-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(79,142,247,.3);
  border-top-color: var(--b2b-accent);
  border-radius: 50%;
  animation: b2b-spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes b2b-spin { to { transform: rotate(360deg); } }

/* ── Footer de navegación ─────────────────────────────────────────────────── */
.b2b-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--b2b-border);
  background: var(--b2b-bg2);
  flex-shrink: 0;
  position: relative;
}
.b2b-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.b2b-btn:active { transform: scale(.97); }
.b2b-btn-primary   { background: var(--b2b-accent);  color: #fff; }
.b2b-btn-secondary { background: var(--b2b-bg); color: var(--b2b-muted); border: 1px solid var(--b2b-border); }
.b2b-btn-success   { background: var(--b2b-accent2); color: #fff; }
.b2b-btn:disabled  { opacity: .4; cursor: not-allowed; }

/* ── Texto de ayuda bajo el título ────────────────────────────────────────── */
.b2b-help {
  font-size: 11px;
  color: #7a8aaa;
  margin: -6px 0 10px;
  line-height: 1.5;
}

/* ── Etiqueta de sección dentro del slide ─────────────────────────────────── */
.b2b-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #5c6e95;
  border-bottom: 1px solid #2e3350;
  padding-bottom: 4px;
  margin: 12px 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.b2b-section-label:first-child { margin-top: 0; }

/* ── INCOTERM cards ───────────────────────────────────────────────────────── */
.b2b-incoterm-group { margin-bottom: 8px; }
.b2b-incoterm-header {
  font-size: 10px;
  font-weight: 700;
  color: #5c7aaa;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin: 4px 0 5px;
}
.b2b-cards-incoterm {
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 4px;
}
#b2b-incoterm-mar { grid-template-columns: repeat(4, 1fr); }
.b2b-inc { padding: 6px 4px; }
.b2b-inc strong { font-size: 13px; font-weight: 800; color: #9ec4ff; display: block; }
.b2b-inc-name { font-size: 9px; color: #a0aec8; font-style: italic; display: block; margin: 1px 0 2px; }
.b2b-inc .b2b-clabel { font-size: 9px; line-height: 1.3; }
.b2b-card-opt.b2b-inc.sel strong { color: #fff; }

/* ── Grilla de instrumentos de pago ──────────────────────────────────────── */
.b2b-pago-grid { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.b2b-pago-opt {
  padding: 8px 10px;
  background: #1f2338;
  border: 1px solid #2e3a58;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.b2b-pago-opt:hover { border-color: var(--b2b-accent); background: rgba(79,142,247,.1); }
.b2b-pago-opt.sel   { border-color: var(--b2b-accent); background: rgba(79,142,247,.18); }
.b2b-pago-head { display: flex; gap: 6px; margin-bottom: 4px; }
.b2b-pago-tag {
  font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 12px; letter-spacing: .3px;
}
.b2b-tag-verde    { background: rgba(62,207,142,.15);  color: #3ecf8e; border: 1px solid rgba(62,207,142,.3); }
.b2b-tag-amarillo { background: rgba(247,168,79,.12);  color: #f7a84f; border: 1px solid rgba(247,168,79,.3); }
.b2b-tag-rojo     { background: rgba(247,111,111,.12); color: #f76f6f; border: 1px solid rgba(247,111,111,.3); }
.b2b-pago-opt strong { display: block; font-size: 12px; color: #c8d8f8; margin-bottom: 1px; }
.b2b-pago-norm { font-size: 10px; color: #7a8aaa; font-style: italic; display: block; margin-bottom: 3px; }
.b2b-pago-opt p { font-size: 11px; color: #8898b8; margin: 0; line-height: 1.4; }
.b2b-pago-opt.sel p, .b2b-pago-opt.sel strong { color: #e0ebff; }

/* ── Chips del resumen ────────────────────────────────────────────────────── */
.b2b-chip { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 12px; letter-spacing: .3px; display: inline-block; }
.b2b-chip-blue  { background: rgba(79,142,247,.2);  color: #7ab8ff; }
.b2b-chip-green { background: rgba(62,207,142,.15); color: #3ecf8e; }
.b2b-chip-gray  { background: rgba(140,150,180,.15);color: #8896b3; }

/* ── Header resumen (step 6) ──────────────────────────────────────────────── */
.b2b-resumen-header {
  background: #1f2338; border: 1px solid #2e3a58; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px;
}
.b2b-resumen-ruta { font-size: 15px; font-weight: 700; color: #c0d4ff; margin-bottom: 6px; }
.b2b-resumen-meta { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── Grid de costos ───────────────────────────────────────────────────────── */
.b2b-costos-grid { display: flex; flex-direction: column; gap: 6px; }

/* ── Red de negocios — etiqueta con badge ─────────────────────────────────── */
.b2b-section-red { color: #3ecf8e; border-color: rgba(62,207,142,.25); }
.b2b-badge-destacado {
  display: inline-block;
  font-size: 9px; font-weight: 800; letter-spacing: .8px;
  padding: 1px 6px; border-radius: 10px;
  background: rgba(62,207,142,.18); color: #3ecf8e;
  border: 1px solid rgba(62,207,142,.35);
  margin-left: 6px; vertical-align: middle;
}

/* ── Tarjetas de contraparte ──────────────────────────────────────────────── */
.b2b-contrapartes-grid { display: flex; flex-direction: column; gap: 7px; margin-bottom: 6px; }
.b2b-contraparte-card {
  display: flex; align-items: flex-start; gap: 10px;
  background: #1c2138; border: 1px solid rgba(62,207,142,.2);
  border-radius: 8px; padding: 9px 11px;
  transition: border-color .15s, background .15s;
}
.b2b-contraparte-card:hover { border-color: rgba(62,207,142,.5); background: rgba(62,207,142,.05); }
.b2b-contraparte-avatar {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(79,142,247,.2); display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.b2b-contraparte-info { flex: 1; min-width: 0; }
.b2b-contraparte-nombre { font-weight: 700; font-size: 12px; color: #c8d8f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b2b-contraparte-tipo   { font-size: 10px; color: #7a8aaa; margin: 1px 0 4px; }
.b2b-contraparte-meta   { display: flex; gap: 6px; flex-wrap: wrap; }
.b2b-contraparte-chip   { font-size: 9px; padding: 1px 6px; border-radius: 10px; background: rgba(79,142,247,.15); color: #7ab8ff; font-weight: 600; }
.b2b-contraparte-match  { font-size: 10px; color: #3ecf8e; font-weight: 700; white-space: nowrap; flex-shrink: 0; }

/* ── CTA cuando no hay contrapartes ──────────────────────────────────────── */
.b2b-contrapartes-cta {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(79,142,247,.06); border: 1px dashed rgba(79,142,247,.25);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 6px;
}
.b2b-cta-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.b2b-contrapartes-cta div  { display: flex; flex-direction: column; gap: 3px; }
.b2b-contrapartes-cta strong { font-size: 11px; color: #c0d0f0; }
.b2b-contrapartes-cta span   { font-size: 10px; color: #7a8aaa; }
.b2b-link-cta { font-size: 11px; color: var(--b2b-accent); text-decoration: none; font-weight: 600; margin-top: 2px; }
.b2b-link-cta:hover { text-decoration: underline; color: #7ab8ff; }

/* ── Botón de ayuda "?" ───────────────────────────────────────────────────── */
.b2b-btn-ayuda {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #f7c94f; background: rgba(247,201,79,.12); color: #f7c94f;
  font-size: 13px; font-weight: 900; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s; line-height: 1;
}
.b2b-btn-ayuda:hover { background: rgba(247,201,79,.25); transform: scale(1.1); }

/* ── Panel popup — fariasortiz.com.ar ───────────────────────────────────── */
.b2b-ayuda-popup {
  position: absolute;
  bottom: 58px;
  left: 12px; right: 12px;
  background: linear-gradient(145deg, #1a2040 0%, #0e1528 100%);
  border: 1px solid rgba(247,201,79,.35);
  border-radius: 10px;
  padding: 14px 16px 12px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.5);
  z-index: 10;
  animation: b2b-popup-in .18s ease;
}
@keyframes b2b-popup-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.b2b-ayuda-close { position: absolute; top: 8px; right: 8px; color: #f7c94f; }
.b2b-ayuda-marca { text-align: center; margin-bottom: 10px; }
.b2b-ayuda-iconos { font-size: 22px; letter-spacing: 4px; margin-bottom: 4px; }
.b2b-ayuda-nombre { font-size: 15px; font-weight: 800; letter-spacing: 2px; color: #f7c94f; }
.b2b-ayuda-sub    { font-size: 10px; color: #a0aec8; margin-top: 2px; letter-spacing: .5px; }
.b2b-ayuda-rubros { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-bottom: 10px; }
.b2b-ayuda-rubros span {
  font-size: 9px; padding: 2px 7px; border-radius: 10px;
  background: rgba(247,201,79,.1); border: 1px solid rgba(247,201,79,.25);
  color: #d4b84a; font-weight: 600;
}
.b2b-ayuda-link {
  display: block; text-align: center; padding: 7px;
  background: rgba(247,201,79,.12); border: 1px solid rgba(247,201,79,.3);
  border-radius: 6px; color: #f7c94f; font-size: 12px; font-weight: 700;
  text-decoration: none; letter-spacing: .5px; transition: background .15s;
  margin-bottom: 8px;
}
.b2b-ayuda-link:hover { background: rgba(247,201,79,.22); }
.b2b-ayuda-legal { font-size: 9px; color: #5c6e95; text-align: center; margin: 0; }

/* ── Ajuste responsive (< 460px) ─────────────────────────────────────────── */
@media (max-width: 460px) {
  #b2b-panel-flotante { width: 98vw; right: 1vw; top: auto; bottom: 60px; }
  .b2b-cards { grid-template-columns: 1fr 1fr; }
  .b2b-cards-incoterm { grid-template-columns: 1fr 1fr; }
  .b2b-checks { grid-template-columns: 1fr; }
  .b2b-ayuda-popup { left: 6px; right: 6px; }
}
