/* ══════════════════════════════════════════════════════
   Orbitia Guided Tour — tour.css
   Botón flotante, modal de bienvenida, help mode
   ══════════════════════════════════════════════════════ */

/* ── Floating help button ───────────────────────────── */
#orbHelpBtn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dc3545, #a71d2a);
  color: #fff;
  border: none;
  box-shadow: 0 4px 18px rgba(220,53,69,.45);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  line-height: 1;
}
#orbHelpBtn:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 28px rgba(220,53,69,.6);
}
#orbHelpBtn .orb-help-tooltip {
  position: absolute;
  right: 60px;
  background: #212529;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  letter-spacing: .3px;
}
#orbHelpBtn .orb-help-tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #212529;
}
#orbHelpBtn:hover .orb-help-tooltip { opacity: 1; }

#orbHelpBtn.help-mode-on {
  background: linear-gradient(135deg, #6f42c1, #4a1d8c);
  box-shadow: 0 4px 18px rgba(111,66,193,.45);
  animation: orbPulse 2s infinite;
}
@keyframes orbPulse {
  0%,100% { box-shadow: 0 4px 18px rgba(111,66,193,.45); }
  50%      { box-shadow: 0 4px 28px rgba(111,66,193,.7); }
}

/* ── Welcome modal overlay ──────────────────────────── */
#orbWelcomeOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10,14,23,.75);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: orbFadeIn .35s ease;
}
@keyframes orbFadeIn { from { opacity:0 } to { opacity:1 } }

.orb-welcome-card {
  background: #fff;
  border-radius: 18px;
  padding: 40px 44px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  animation: orbSlideUp .4s cubic-bezier(.22,1,.36,1);
}
@keyframes orbSlideUp { from { transform:translateY(30px); opacity:0 } to { transform:translateY(0); opacity:1 } }

.orb-welcome-logo {
  width: 72px;
  margin-bottom: 16px;
}
.orb-welcome-card h3 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #212529;
  margin-bottom: 8px;
}
.orb-welcome-card p {
  color: #6c757d;
  font-size: .95rem;
  line-height: 1.6;
  margin-bottom: 28px;
}
.orb-welcome-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.orb-welcome-btns .btn-primary-tour {
  background: linear-gradient(135deg, #dc3545, #a71d2a);
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: 50px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(220,53,69,.35);
}
.orb-welcome-btns .btn-primary-tour:hover { transform:translateY(-2px); box-shadow: 0 6px 20px rgba(220,53,69,.4); }
.orb-welcome-btns .btn-skip-tour {
  background: transparent;
  color: #6c757d;
  border: 1px solid #dee2e6;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s;
}
.orb-welcome-btns .btn-skip-tour:hover { background: #f8f9fa; }

.orb-welcome-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.orb-step-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f8f9fa;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: .72rem;
  color: #495057;
  font-weight: 600;
}
.orb-step-chip i { font-size: .65rem; color: #dc3545; }

/* ── Driver.js custom theme ─────────────────────────── */
.driver-popover {
  border-radius: 14px !important;
  box-shadow: 0 12px 40px rgba(0,0,0,.2) !important;
  border: none !important;
  font-family: inherit !important;
  max-width: 420px !important;
  min-width: 360px !important;
}
.driver-popover-title {
  font-size: .98rem !important;
  font-weight: 800 !important;
  color: #212529 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  /* Reservar espacio para que la X no tape el título */
  padding-right: 36px !important;
  line-height: 1.3 !important;
}
/* Posición/tamaño consistente del botón cerrar */
.driver-popover-close-btn {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  border-radius: 50% !important;
  z-index: 5 !important;
}
.driver-popover-description {
  font-size: .85rem !important;
  color: #495057 !important;
  line-height: 1.6 !important;
}
.driver-popover-footer {
  gap: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
}
.driver-popover-navigation-btns {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  flex-grow: 1 !important;
  justify-content: flex-end !important;
  white-space: nowrap !important;
}
/* driver.js v1 usa estas clases reales (sin "-popover-" en el medio) */
.driver-popover-footer button,
.driver-prev-btn,
.driver-next-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 18px !important;
  font-size: .72rem !important;
  font-weight: 600 !important;
  padding: 5px 12px !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  background: #fff !important;
  color: #2d2d2d !important;
  border: 1px solid #ccc !important;
  font-family: inherit !important;
  line-height: 1.3 !important;
  text-shadow: none !important;
  box-shadow: none !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.driver-next-btn {
  background: #dc3545 !important;
  color: #fff !important;
  border: 1px solid #dc3545 !important;
}
.driver-next-btn:hover { background: #bb2d3b !important; border-color: #bb2d3b !important; }
.driver-prev-btn:hover { background: #f7f7f7 !important; }
.driver-popover-progress-text {
  font-size: .72rem !important;
  color: #6c757d !important;
}

/* ── Contextual help tooltips (help mode) ───────────── */
[data-help-tip] { position: relative; }
[data-help-tip].help-mode-active::after {
  content: attr(data-help-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #212529;
  color: #fff;
  font-size: .72rem;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 220px;
  white-space: normal;
  z-index: 999;
  pointer-events: none;
  line-height: 1.4;
  text-align: center;
}
[data-help-tip].help-mode-active::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #212529;
  z-index: 999;
}


/* ── Walkthrough banner — pill flotante centrado ─────────────── */
#orbWalkBanner {
  position: fixed;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100002;
  pointer-events: auto !important;
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  color: #fff;
  padding: 5px 6px 5px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(185,28,28,.5), 0 1px 6px rgba(0,0,0,.22);
  font-size: .76rem;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 500px;
  animation: orbWalkSlide .3s ease-out;
  border: 1px solid rgba(255,255,255,.15);
}
#orbWalkBanner > span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  letter-spacing: .01em;
}
@keyframes orbWalkSlide {
  from { transform: translateX(-50%) translateY(-140%); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}
#orbWalkBanner button {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .71rem;
  font-weight: 600;
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: background .15s;
  flex-shrink: 0;
  letter-spacing: .02em;
}
#orbWalkBanner button:hover { background: rgba(255,255,255,.28); }


/* ── Help menu (floating ?) ─────────────────────────────────────── */
#orbHelpMenu {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 100002;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.08);
  padding: 8px;
  width: 320px;
  animation: orbHelpMenuIn .18s ease-out;
}
@keyframes orbHelpMenuIn {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.orb-help-menu-header {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6c757d;
  padding: 8px 10px 6px;
}
.orb-help-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.orb-help-menu-item:hover { background: #f1f3f5; }
.orb-help-menu-item.primary { background: #fff5f5; }
.orb-help-menu-item.primary:hover { background: #ffe5e5; }
.orb-hmi-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .95rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.orb-hmi-body { flex: 1; min-width: 0; }
.orb-hmi-title {
  font-size: .88rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 2px;
}
.orb-hmi-desc {
  font-size: .73rem;
  color: #6c757d;
  line-height: 1.35;
}

/* ── Tour chooser (panel previo al recorrido) ───────────────────── */
.orb-chooser-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.orb-chooser-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 2px solid #e9ecef;
  background: #fff;
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
}
.orb-chooser-item:hover {
  border-color: #adb5bd;
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.orb-chooser-item.primary {
  border-color: #cfe2ff;
  background: #f0f7ff;
}
.orb-chooser-item.primary:hover {
  border-color: #0d6efd;
  background: #e7f1ff;
}
.orb-chi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.05rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.orb-chi-body { flex: 1; min-width: 0; }
.orb-chi-title {
  font-size: .98rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 3px;
}
.orb-chi-desc {
  font-size: .8rem;
  color: #6c757d;
  line-height: 1.4;
}
.orb-chi-arrow {
  color: #adb5bd;
  font-size: .9rem;
  flex-shrink: 0;
}
.orb-chooser-item:hover .orb-chi-arrow { color: #495057; transform: translateX(2px); }

/* Oculta cualquier botón flotante "?" residual */
#orbHelpBtn { display: none !important; }

/* ── Popover compacto para el panel derecho (KPIs) ─────────────── */
/* Constraine ancho para garantizar que el popover quepa entre el panel y el mapa */
.driver-popover.orb-pop-rp {
  max-width: 320px !important;
  min-width: 280px !important;
}
.driver-popover.orb-pop-rp .driver-popover-description {
  font-size: .76rem !important;
  line-height: 1.35 !important;
}

/* ── Validación: el popover NUNCA rebasa el viewport ─────────────── */
/* La separación con el elemento resaltado se controla con popoverOffset en JS */
/* (driver.js calcula la posición considerando el bounding box del popover; un  */
/* margin: aquí confunde su matemática y desalinea la flecha — NO usar margin) */
.driver-popover {
  max-height: calc(100vh - 28px) !important;
  max-width: min(420px, calc(100vw - 28px)) !important;
  box-shadow: 0 10px 32px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.06) !important;
}

/* ── Progress pill (reemplaza "Paso X de Y") ────────────────────── */
/* Mantenemos el slot nativo visible (driver lo usa para hints) pero compacto */
.driver-popover-progress-text {
  font-size: .72rem !important;
  color: #6c757d !important;
  font-style: italic;
  margin-right: 8px !important;
}
/* Nuestra fila propia con la barra de avance — vive como hijo directo del popover */
#orb-progress-row {
  padding: 0 18px 8px 18px;
  margin-top: -2px;
}
.orb-progress-pill {
  font-size: 11px;
  margin-top: 6px;
  width: 100%;
}
.orb-pp-bar {
  height: 6px;
  background: #eef0f4;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
.orb-pp-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d6efd, #4dabf7);
  transition: width .35s ease;
  box-shadow: 0 0 6px rgba(13,110,253,.45);
}
.orb-progress-pill.walk .orb-pp-fill {
  background: linear-gradient(90deg, #dc3545, #ff6b7a);
  box-shadow: 0 0 6px rgba(220,53,69,.45);
}
.orb-pp-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
}
.orb-pp-label {
  color: #6c757d;
  letter-spacing: .02em;
}
.orb-pp-pct {
  color: #212529;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.orb-progress-pill.walk .orb-pp-pct { color: #b02a37; }
