/* =========================================================
   Phoenix4 · Demos animadas (OBC y Hot Shot)
   Se activan solo si js/demos.js corre; sin JS la página queda igual.
   ========================================================= */

.p4d-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-orange);
  border: 1px solid rgba(245, 121, 10, 0.45);
  border-radius: 999px;
  padding: 3px 12px;
  margin: 0 0 14px;
}
.p4d-tag-wrap { text-align: center; }

.p4d-live {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.p4d-live::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fbf71;
  animation: p4d-blink 1.4s infinite;
}
@keyframes p4d-blink { 50% { opacity: 0.25; } }

/* ---------- OBC: stepper en vivo ---------- */
.process-stepper.p4d-track { position: relative; }
.p4d-track .process-icon { transition: background 0.4s, color 0.4s, border-color 0.4s, box-shadow 0.4s; position: relative; }
.p4d-track .process-step.p4d-on .process-icon {
  background: var(--color-orange);
  color: #111;
  border-color: var(--color-orange);
  box-shadow: 0 0 0 6px rgba(245, 121, 10, 0.18);
}
.p4d-track .process-step.p4d-now .process-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--color-orange);
  animation: p4d-pulse 1.2s ease-out infinite;
}
@keyframes p4d-pulse { to { inset: -18px; opacity: 0; } }
.p4d-track .process-chevron {
  background: var(--color-border);
  position: relative;
  overflow: hidden;
}
.p4d-track .process-chevron::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s cubic-bezier(0.5, 0, 0.3, 1);
}
.p4d-track .process-chevron.p4d-on::after { transform: scaleX(1); }
.p4d-meta { display: block; }
.p4d-time {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-orange);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s, transform 0.4s;
}
.p4d-note {
  display: block;
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.35;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.4s 0.15s;
}
.p4d-on .p4d-time { opacity: 1; transform: none; }
.p4d-on .p4d-note { opacity: 1; }
@media (max-width: 760px) {
  .p4d-track .process-chevron::after { transform: scaleY(0); transform-origin: top; }
  .p4d-track .process-chevron.p4d-on::after { transform: scaleY(1); }
  .p4d-track { padding-top: 40px; }
}

.p4d-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 0;
  background: #0f1a13;
  border: 1px solid rgba(47, 191, 113, 0.5);
  border-radius: 999px;
  padding: 10px 20px 10px 12px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition: opacity 0.45s, transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.p4d-toast.p4d-ver { opacity: 1; transform: none; }
.p4d-toast i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2fbf71;
  display: grid;
  place-items: center;
  flex: none;
}
.p4d-toast i svg { width: 16px; height: 16px; stroke: #0b0b0b; stroke-width: 3; fill: none; }
.p4d-toast span { font-weight: 400; color: var(--color-text-muted); }

/* ---------- Hot Shot: carretera con GPS ---------- */
.p4d-road-wrap { margin-top: 48px; }
.p4d-roadbox {
  position: relative;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 46px clamp(14px, 3vw, 34px) 24px;
}
.p4d-unit {
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  background: #232323;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 3px 10px;
}
.p4d-road {
  position: relative;
  height: 64px;
  margin: 0 4% 8px;
  background: #101010;
  border: 1px solid #232323;
  border-radius: 12px;
  overflow: hidden;
}
.p4d-road::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: repeating-linear-gradient(90deg, #3a3a3a 0 22px, transparent 22px 40px);
  animation: p4d-lane 0.7s linear infinite paused;
}
.p4d-roadbox.p4d-moving .p4d-road::before { animation-play-state: running; }
@keyframes p4d-lane { to { background-position: -40px 0; } }
.p4d-done {
  position: absolute;
  left: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  width: 0;
  background: var(--gradient-brand);
  box-shadow: 0 0 12px rgba(245, 121, 10, 0.7);
  transition: width 1.6s cubic-bezier(0.45, 0, 0.35, 1);
}
.p4d-border {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 60%;
  border-left: 2px dashed rgba(255, 255, 255, 0.25);
}
.p4d-border span {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.p4d-truck {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 54px;
  height: 34px;
  margin-top: -22px;
  transition: left 1.6s cubic-bezier(0.45, 0, 0.35, 1);
}
.p4d-truck svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 10px rgba(245, 121, 10, 0.45)); }
.p4d-truck::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -10px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: #2fbf71;
  animation: p4d-gps 1.3s infinite;
}
@keyframes p4d-gps {
  from { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.6); }
  to { box-shadow: 0 0 0 12px rgba(47, 191, 113, 0); }
}
.p4d-stops {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 4%;
}
.p4d-stop {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-muted);
  transition: color 0.4s;
}
.p4d-stop .p4d-dot {
  width: 14px;
  height: 14px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 2px solid rgba(245, 121, 10, 0.45);
  background: var(--color-card);
  transition: all 0.4s;
}
.p4d-stop.p4d-on { color: #fff; }
.p4d-stop.p4d-on .p4d-dot {
  background: var(--color-orange);
  border-color: var(--color-orange);
  box-shadow: 0 0 0 5px rgba(245, 121, 10, 0.2);
}
@media (max-width: 700px) {
  .p4d-road { margin: 0 0 10px; }
  .p4d-stops { margin: 0; grid-template-columns: 1fr; gap: 0; }
  .p4d-stop {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    column-gap: 12px;
    text-align: left;
    padding: 7px 0;
  }
  .p4d-stop .p4d-dot { margin: 4px 0 0; grid-row: span 3; }
  .p4d-unit { position: static; display: inline-block; margin-bottom: 12px; }
  .p4d-roadbox { padding-top: 40px; }
}

/* ---------- Formulario que se llena solo (OBC y Hot Shot) ---------- */
.activate-card.p4d-card { transition: border-color 0.3s, box-shadow 0.3s; position: relative; }
.activate-card.p4d-focus { border-color: var(--color-orange); box-shadow: 0 0 0 3px rgba(245, 121, 10, 0.18); }
.activate-card.p4d-filled { border-color: rgba(47, 191, 113, 0.55); }
.activate-card.p4d-filled::after {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 14px;
  color: #2fbf71;
  font-weight: 800;
}
.p4d-val {
  display: block;
  min-height: 1.4em;
  margin-top: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
}
.p4d-val:empty { display: none; }
.p4d-card.p4d-typing .activate-card-example { display: none; }
.p4d-card.p4d-filled .activate-card-example { display: none; }
.p4d-cur {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--color-orange);
  margin-left: 1px;
  vertical-align: -2px;
  animation: p4d-blink 1s steps(1) infinite;
}
.p4d-units { margin: -4px 0 18px; }
.p4d-units p { margin: 0 0 8px; font-size: 0.78rem; font-weight: 700; color: var(--color-text-muted); }
.p4d-units div { display: flex; flex-wrap: wrap; gap: 8px; }
.p4d-units span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
  transition: all 0.35s;
}
.p4d-units span.p4d-scan { border-color: rgba(245, 121, 10, 0.6); color: #fff; }
.p4d-units span.p4d-pick {
  background: var(--color-orange);
  border-color: var(--color-orange);
  color: #111;
  transform: scale(1.06);
  box-shadow: 0 0 18px rgba(245, 121, 10, 0.5);
}
.p4d-units span.p4d-out { opacity: 0.35; }
.p4d-typingdots {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 0.84rem;
  color: var(--color-text-muted);
}
.p4d-typingdots.p4d-ver { display: flex; }
.p4d-typingdots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-orange);
  animation: p4d-hop 1s infinite;
}
.p4d-typingdots i:nth-child(2) { animation-delay: 0.15s; }
.p4d-typingdots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes p4d-hop { 40% { transform: translateY(-5px); opacity: 0.5; } }
.p4d-resp {
  display: none;
  margin: 0 0 18px;
  background: #141414;
  border: 1px solid rgba(245, 121, 10, 0.55);
  border-radius: 12px;
  padding: 14px 16px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s, transform 0.5s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.p4d-resp.p4d-show { display: block; }
.p4d-resp.p4d-ver { opacity: 1; transform: none; }
.p4d-resp header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}
.p4d-resp header em { font-style: normal; font-size: 0.76rem; color: #2fbf71; font-weight: 700; white-space: nowrap; }
.p4d-resp ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.84rem; color: var(--color-text-muted); }
.p4d-resp li b { color: #fff; font-weight: 700; }
.btn.p4d-glow { animation: p4d-glow 1.4s ease-in-out 2; }
@keyframes p4d-glow {
  50% { box-shadow: 0 0 0 8px rgba(245, 121, 10, 0.25), 0 0 28px rgba(245, 121, 10, 0.6); transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  .p4d-track *, .p4d-roadbox *, .p4d-roadbox, .p4d-card, .p4d-resp, .p4d-toast, .p4d-units span, .btn.p4d-glow, .p4d-live::before {
    animation: none !important;
    transition: none !important;
  }
}

.activate-banner-right > .p4d-tag { align-self: flex-start; }
