/* ===========================================================
   OnRoute — "Cómo funciona" dynamic step cards
   =========================================================== */

.proc-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: stretch;
}

.proc-card {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px 22px 22px;
  display: flex; flex-direction: column;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease), background .3s var(--ease);
}
.proc-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.proc-card.is-active {
  border-color: var(--green); box-shadow: var(--shadow-lg); transform: translateY(-4px);
}

/* progress bar (top) */
.proc-prog { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: transparent; }
.proc-prog-fill { display: block; height: 100%; width: 0; background: var(--green); }
.proc-card.is-active .proc-prog-fill { width: 100%; transition: width var(--proc-dwell, 4200ms) linear; }
@media (prefers-reduced-motion: reduce) {
  .proc-card.is-active .proc-prog-fill { transition: none; width: 100%; }
}

.proc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.proc-n {
  font-family: 'Geist Mono', monospace; font-size: 13px; font-weight: 500; letter-spacing: .04em;
  color: var(--text-3); transition: color .3s;
}
.proc-card.is-active .proc-n { color: var(--green); }
.proc-ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2);
  transition: background .3s var(--ease), color .3s var(--ease);
}
.proc-card.is-active .proc-ic { background: var(--ink-green); color: #fff; }
[data-theme="dark"] .proc-card.is-active .proc-ic { background: var(--green); color: #08110b; }
.proc-ic svg { width: 22px; height: 22px; }

.proc-card h3 { font-size: 19px; letter-spacing: -.02em; }
.proc-card > p { color: var(--text-2); font-size: 14.5px; margin-top: 9px; }

/* visual area */
.proc-visual {
  margin-top: auto; padding-top: 18px; position: relative; min-height: 92px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
}

/* —— Step 1: quote (mini map + price) —— */
.pv-map {
  position: relative; height: 60px; border-radius: 11px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(0,0,0,.04) 18px 19px),
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(0,0,0,.04) 18px 19px),
    linear-gradient(135deg, #e7efd9, #dbe8c9);
  border: 1px solid var(--border);
}
[data-theme="dark"] .pv-map { background: linear-gradient(135deg, #1c241b, #232c22); }
.pv-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pv-pin {
  position: absolute; left: 74%; top: 30%; width: 16px; height: 16px; z-index: 2;
  transform: translate(-50%,-100%);
}
.pv-pin::after { content:''; position:absolute; inset:0; background: var(--green); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 3px 6px rgba(0,0,0,.3); }
.proc-card.is-active .pv-pin { animation: pinDrop .6s var(--ease) both; }
@keyframes pinDrop { 0% { transform: translate(-50%,-160%); opacity: 0; } 60% { transform: translate(-50%,-92%); } 100% { transform: translate(-50%,-100%); opacity: 1; } }
.pv-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.pv-zone { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--text-3); }
.pv-chip b { color: var(--green); font-size: 16px; letter-spacing: -.02em; }

/* —— Step 2: booking (order + lines) —— */
.pv-order { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pv-id { font-family: 'Geist Mono', monospace; font-weight: 600; font-size: 13px; }
.pv-line { height: 9px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); }
.pv-line.short { width: 58%; }
.proc-card.is-active .pv-book .badge { animation: popIn .5s var(--ease) .15s both; }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* —— Step 3: route —— */
.pv-route { position: relative; height: 70px; }
.pv-route svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pv-fill { stroke-dasharray: 240; stroke-dashoffset: 240; }
.proc-card.is-active .pv-fill { animation: drawRoute 1.6s var(--ease) forwards; }
@keyframes drawRoute { to { stroke-dashoffset: 0; } }
.pv-truck { position: absolute; left: 0; top: 38%; color: var(--ink-green); }
[data-theme="dark"] .pv-truck { color: var(--green); }
.pv-truck svg { width: 22px; height: 22px; position: static; }
.proc-card.is-active .pv-truck { animation: drive 1.6s var(--ease) forwards; }
@keyframes drive { 0% { left: 2%; top: 64%; } 50% { top: 8%; } 100% { left: 86%; top: 30%; } }
.pv-eta {
  position: absolute; right: 4px; top: 2px; font-size: 11px; font-weight: 600;
  background: var(--ink-green); color: #fff; padding: 4px 9px; border-radius: 999px;
}
[data-theme="dark"] .pv-eta { color: #08110b; background: var(--green); }

/* —— Step 4: tracking + paid —— */
.pv-steps { display: flex; gap: 6px; }
.pv-steps span { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.proc-card.is-active .pv-steps span { background: var(--green); border-color: var(--green); }
.proc-card.is-active .pv-steps .s1 { animation: fillStep .4s var(--ease) .1s both; }
.proc-card.is-active .pv-steps .s2 { animation: fillStep .4s var(--ease) .4s both; }
.proc-card.is-active .pv-steps .s3 { animation: fillStep .4s var(--ease) .7s both; }
@keyframes fillStep { from { transform: scaleX(0); transform-origin: left; opacity: .3; } to { transform: scaleX(1); opacity: 1; } }
.pv-paid { color: var(--green); font-size: 13px; font-weight: 700; }

/* responsive */
@media (max-width: 900px) {
  .proc-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .proc-cards { grid-template-columns: 1fr; gap: 14px; }
  .proc-visual { min-height: 0; }
}
