/* CourierLab — professional tracking & ops */

/* Keep site header above Leaflet map panes / scrolled track widgets */
.header-top {
  z-index: 1100 !important;
}

.header,
.header.fixed-header {
  z-index: 1090 !important;
}

.tracking,
.track-form,
.track-result-card {
  position: relative;
  z-index: 1;
}

.track-map-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
}

.track-map,
.track-map .leaflet-container {
  position: relative !important;
  z-index: 1 !important;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
}

.badge-enabled,
.badge-paid {
  color: #0f9f6e;
  border-color: rgba(15, 159, 110, .35);
  background: rgba(15, 159, 110, .08);
}

.badge-disabled,
.badge-unpaid {
  color: #e11d48;
  border-color: rgba(225, 29, 72, .35);
  background: rgba(225, 29, 72, .08);
}

.badge-sent {
  color: #c2410c;
  border-color: rgba(194, 65, 12, .35);
  background: rgba(194, 65, 12, .08);
}

.badge-received {
  color: #0369a1;
  border-color: rgba(3, 105, 161, .35);
  background: rgba(3, 105, 161, .08);
}

.track-form {
  max-width: 680px;
  margin: 0 auto;
}

.track-form-icon {
  background: hsl(var(--base) / .08) !important;
  border: 1px solid hsl(var(--base) / .15) !important;
  color: hsl(var(--base));
  font-size: 1.25rem;
}

.track-result-card {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
  background: hsl(var(--white));
  border: 1px solid hsl(var(--base) / .1);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .07);
}

.track-result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 36px;
  padding-bottom: 22px;
  border-bottom: 1px solid hsl(var(--base) / .1);
}

.track-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: hsl(var(--body-color) / .55);
  font-weight: 600;
  margin-bottom: 6px;
}

.track-code {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: .06em;
  color: hsl(var(--heading-color));
  line-height: 1.15;
}

.track-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-top: 10px;
  font-size: 13.5px;
  color: hsl(var(--body-color) / .75);
}

.track-meta-row i {
  color: hsl(var(--base));
  margin-right: 4px;
}

.track-empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--base) / .06);
  color: #9ca3af;
  font-size: 36px;
}

/* Journey progress with icons */
.track-journey {
  position: relative;
  margin: 8px 0 40px;
  padding: 0 8px;
}

.track-journey-line {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 28px;
  height: 4px;
  border-radius: 999px;
  background: hsl(var(--base) / .12);
  z-index: 0;
}

.track-journey-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--base)), #22c55e);
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
  position: relative;
}

.track-journey-fill::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .2);
}

.track-journey-steps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.track-journey-step {
  text-align: center;
}

.track-journey-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #fff;
  border: 3px solid hsl(var(--base) / .18);
  color: hsl(var(--body-color) / .45);
  transition: all .3s ease;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.track-journey-step.is-done .track-journey-icon,
.track-journey-step.is-current .track-journey-icon {
  border-color: hsl(var(--base));
  background: hsl(var(--base));
  color: #fff;
}

.track-journey-step.is-current .track-journey-icon {
  animation: trackPulse 1.8s ease infinite;
}

.track-journey-label {
  font-size: 14px;
  font-weight: 700;
  color: hsl(var(--body-color) / .55);
}

.track-journey-desc {
  font-size: 12px;
  color: hsl(var(--body-color) / .45);
  margin-top: 2px;
}

.track-journey-step.is-done .track-journey-label,
.track-journey-step.is-current .track-journey-label {
  color: hsl(var(--heading-color));
}

.track-info-box {
  background: linear-gradient(180deg, hsl(var(--base) / .04), hsl(var(--base) / .02));
  border: 1px solid hsl(var(--base) / .08);
  border-radius: 14px;
  padding: 18px;
  height: auto;
}

.track-info-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: hsl(var(--body-color) / .6);
  font-weight: 700;
  margin-bottom: 10px;
}

.track-info-label i {
  color: hsl(var(--base));
  margin-right: 4px;
}

.track-item-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.track-item-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed hsl(var(--base) / .1);
  font-size: 14px;
}

.track-item-total {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  padding-top: 4px;
}

/* Map */
.track-map-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  border: 1px solid hsl(var(--base) / .1);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.track-map-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid hsl(var(--base) / .08);
}

.track-map-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.track-map-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  background: rgba(220, 38, 38, .08);
  padding: 5px 12px;
  border-radius: 999px;
  line-height: 1;
}

.track-map-pulse i {
  flex-shrink: 0;
  font-size: 14px;
}

.track-map {
  width: 100%;
  height: 320px;
  background: #e8eef5;
  min-height: 280px;
  position: relative;
  z-index: 1;
}

.track-map .leaflet-container {
  z-index: 1 !important;
}

.track-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 16px;
  font-size: 12px;
  color: hsl(var(--body-color) / .7);
  border-top: 1px solid hsl(var(--base) / .08);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-origin { background: #0ea5e9; }
.legend-current { background: #f59e0b; }
.legend-dest { background: #22c55e; }

.track-history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.track-history-head h5 i {
  color: hsl(var(--base));
}

.track-timeline {
  position: relative;
  padding-left: 4px;
}

.track-timeline-item {
  position: relative;
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
}

.track-timeline-item:last-child {
  padding-bottom: 0;
}

.track-timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 42px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, hsl(var(--base) / .35), hsl(var(--base) / .05));
}

.track-timeline-icon,
.track-timeline-dot {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--base));
  color: #fff;
  font-size: 18px;
  box-shadow: 0 8px 18px hsl(var(--base) / .25);
}

.track-timeline-body {
  flex: 1;
  min-width: 0;
  background: hsl(var(--base) / .03);
  border: 1px solid hsl(var(--base) / .07);
  border-radius: 12px;
  padding: 14px 16px;
}

.track-timeline-body p {
  margin-bottom: .4rem;
  color: hsl(var(--body-color) / .85);
}

.track-location-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--base));
  background: hsl(var(--base) / .08);
  padding: 3px 10px;
  border-radius: 999px;
}

@keyframes trackPulse {
  0%, 100% { box-shadow: 0 0 0 0 hsl(var(--base) / .35); }
  50% { box-shadow: 0 0 0 10px hsl(var(--base) / 0); }
}

@media (max-width: 767px) {
  .track-result-card {
    padding: 20px 16px 24px;
  }

  .track-code {
    font-size: 1.3rem;
  }

  .track-result-head {
    flex-direction: column;
  }

  .track-status-stack {
    text-align: left !important;
    width: 100%;
  }

  .track-invoice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .track-map-head {
    flex-wrap: nowrap;
    align-items: flex-start;
  }

  .track-map-pulse {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .track-journey-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .track-journey-label {
    font-size: 11px;
  }

  .track-journey-desc {
    display: none;
  }

  .track-map {
    height: 260px;
  }
}

/* Payment flow */
.pay-option-card {
  display: block;
  cursor: pointer;
  margin: 0;
}

.pay-option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pay-option-body {
  border: 1.5px solid hsl(var(--base) / .15);
  border-radius: 14px;
  padding: 16px;
  height: 100%;
  transition: all .2s ease;
  background: #fff;
}

.pay-option-card input:checked + .pay-option-body {
  border-color: hsl(var(--base));
  box-shadow: 0 0 0 3px hsl(var(--base) / .12);
  background: hsl(var(--base) / .04);
}

.pay-details-box {
  border: 1px solid hsl(var(--base) / .12);
  border-radius: 14px;
  padding: 20px;
  background: hsl(var(--base) / .03);
}

.pay-checkout-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.pay-change-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  align-self: flex-start;
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
  color: #fff !important;
  background: hsl(var(--base));
  text-decoration: none !important;
  height: auto;
}

.pay-change-btn:hover {
  opacity: .92;
  color: #fff !important;
}

.pay-copy-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed hsl(var(--base) / .12);
}

.pay-copy-row:last-child {
  border-bottom: 0;
}

.pay-copy-info {
  min-width: 0;
  flex: 1 1 auto;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: hsl(var(--base));
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

.copy-btn i {
  font-size: 14px;
  transition: transform .2s ease;
}

.copy-btn.is-copied {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .18);
  animation: copyPop .35s ease;
}

.copy-btn.is-copied i {
  transform: scale(1.15);
}

@keyframes copyPop {
  0% { transform: scale(.92); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.pay-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pay-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid hsl(var(--base) / .1);
  border-radius: 12px;
  background: #fff;
}

.pay-history-main {
  min-width: 0;
  flex: 1 1 auto;
}

.pay-history-ref {
  font-weight: 700;
  word-break: break-all;
  margin-bottom: 2px;
}

.pay-history-meta {
  font-size: 13px;
  color: hsl(var(--body-color) / .7);
}

.pay-history-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

@media (max-width: 575px) {
  .copy-btn span {
    display: none;
  }

  .copy-btn {
    width: 36px;
    height: 36px;
    padding: 0;
  }

  .copy-btn.is-copied {
    width: auto;
    min-width: 36px;
    padding: 0 10px;
  }

  .copy-btn.is-copied span {
    display: inline;
  }

  .pay-history-item {
    flex-wrap: wrap;
  }

  .pay-history-actions {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}