/**
 * Timeline element styles for DXPR Builder.
 *
 * Markup inspired by:
 * "Bootstrap 5 Order Tracking Vertical Timeline"
 * https://codehim.com/bootstrap/bootstrap-5-order-tracking-vertical/
 *
 * Styles are scoped to `.uniandes-timeline` to avoid leaking into other components.
 */

.uniandes-timeline .tracking-list {
  position: relative;
  margin: 0;
  padding: 0;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  overflow-x: auto;
  overflow-y: visible;
  align-items: stretch;
}

.uniandes-timeline .tracking-item,
.uniandes-timeline .tracking-item-pending {
  position: relative;
  margin-left: 1rem;
  padding: 0 0 1.75rem 2.5rem;
  border-left: 2px solid #dee2e6;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-item,
.uniandes-timeline.uniandes-timeline--horizontal .tracking-item-pending {
  
  margin-left: 0;
  /* space for date (top) + line + icon */
  padding: calc(var(--uniandes-h-line-y, 3.1rem) + 1.6rem) 1.25rem 1rem 1.25rem;
  border-left: 0;
  border-top: 0;
  flex: 1 1 0;
  min-width: 240px;
  margin-top: 1.5rem;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-item::before,
.uniandes-timeline.uniandes-timeline--horizontal .tracking-item-pending::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--uniandes-h-line-y, 3.1rem);
  height: 2px;
  background: #dee2e6;
  pointer-events: none;
}

.uniandes-timeline .tracking-item:last-child,
.uniandes-timeline .tracking-item-pending:last-child {
  padding-bottom: 0;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-item:last-child,
.uniandes-timeline.uniandes-timeline--horizontal .tracking-item-pending:last-child {
  padding-bottom: 0.75rem;
}

.uniandes-timeline .tracking-icon {
  position: absolute;
  left: -0.85rem;
  top: 0.15rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #fff;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-icon {
  left: 1rem;
  top: calc(var(--uniandes-h-line-y, 3.1rem) - 0.85rem);
  z-index:1;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-date {
  position: absolute;
  left: 0.75rem;
  top: -0.65rem;
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  color: #000;
  font-weight: 700;
  margin: 0;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-date > span {
  margin-top: 0;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-date__day {
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-date__monthyear {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  font-weight: 700;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-date__month {
  font-size: 1.05rem;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-date__year {
  font-size: 0.95rem;
  font-weight: 600;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-date__time {
  display: block;
  margin-left: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #343a40;
}

.uniandes-timeline .tracking-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: currentColor;
}

.uniandes-timeline .tracking-fa-icon {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  color: currentColor;
}

.uniandes-timeline .tracking-date {
  margin-bottom: 0.25rem;
  color: #6c757d;
  font-size: 0.875rem;
  line-height: 1.2;
}

.uniandes-timeline .tracking-date > span {
  display: block;
  margin-top: 0.25rem;
}

.uniandes-timeline .tracking-content {
  font-weight: 600;
  line-height: 1.25;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-weight: 700;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-subtitle {
  font-weight: 400;
}

.uniandes-timeline .tracking-content > span {
  display: block;
  margin-top: 0.25rem;
  font-weight: 400;
  color: #6c757d;
  font-size: 0.875rem;
  line-height: 1.2;
}

.uniandes-timeline .status-intransit {
  color: #0d6efd; /* Bootstrap primary */
}

.uniandes-timeline .status-current {
  color: #198754; /* Bootstrap success */
}

.uniandes-timeline .status-completed {
  color: #198754; /* Bootstrap success */
}

.uniandes-timeline .status-pending {
  color: #adb5bd; /* Bootstrap gray-500 */
}

.uniandes-timeline .tracking-item-pending {
  opacity: 0.85;
}

.uniandes-timeline .tracking-link {
  display: block;
  margin-top: 0.35rem;
  font-weight: 400;
  font-size: 0.875rem;
}

.uniandes-timeline .tracking-link a {
  color: inherit;
  text-decoration: underline;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-link {
  margin-top: auto;
  padding-top: 0.75rem;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-link a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--bs-primary, #0d6efd);
  color: var(--bs-primary, #0d6efd);
  background: transparent;
  border-radius: 0.25rem;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.1;
}

.uniandes-timeline.uniandes-timeline--horizontal .tracking-link a:hover,
.uniandes-timeline.uniandes-timeline--horizontal .tracking-link a:focus {
  background: rgba(13, 110, 253, 0.06);
  text-decoration: none;
}

.uniandes-timeline .tracking-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
  border-radius: 999px;
}

.uniandes-timeline .tracking-badge--alert {
  background: #dc3545; /* Bootstrap danger */
  color: #fff;
}

.uniandes-timeline .blinker .tracking-dot {
  animation: uniandesTimelinePulse 1.25s infinite ease-in-out;
}

@keyframes uniandesTimelinePulse {
  0% {
    transform: scale(0.85);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(0.85);
    opacity: 0.65;
  }
}

@media (min-width: 992px) {
  .uniandes-timeline .tracking-item,
  .uniandes-timeline .tracking-item-pending {
    padding-left: 3.25rem;
  }

  .uniandes-timeline:not(.uniandes-timeline--horizontal) .tracking-date {
    position: absolute;
    left: -9.5rem;
    top: 0;
    width: 8.5rem;
    margin: 0;
    text-align: right;
  }

  .uniandes-timeline.uniandes-timeline--horizontal .tracking-item,
  .uniandes-timeline.uniandes-timeline--horizontal .tracking-item-pending {
    padding-left: 1rem;
  }
}

/* Automatic (progress-bar) horizontal mode */
.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item,
.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item-pending {
  border-top: 0;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item::before,
.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item-pending::before {
  content: none;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-list {
  position: relative;
  flex-wrap: wrap;
  overflow-x: visible;
}

/* In auto+horizontal we render progress per wrapped row via JS-inserted layer. */
.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-list::before,
.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-list::after {
  content: none;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-progress-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-progress-row {
  position: absolute;
  height: 2px;
  background: #dee2e6;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-progress-row-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 2px;
  background: #198754;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item,
.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item-pending {
  z-index: 1;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-today-marker {
  position: absolute;
  left: var(--uniandes-today-x, var(--uniandes-progress-fill-x, 0px));
  top: var(--uniandes-today-y, var(--uniandes-progress-y, 0px));
  transform: translate(-55%, -145%);
  pointer-events: none;
  z-index: 2;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-today-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100%);
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #198754;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-today-marker__top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-today-marker__flag {
  font-size: 0.9rem;
  line-height: 1;
  color: #000;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-today-marker__label {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #198754;
  color: #198754;
  white-space: nowrap;
}

.uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-today-marker__meta {
  margin-top: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  border-radius: 0.6rem;
  background: #fff;
  border: 1px solid #dee2e6;
  color: #6c757d;
  text-align: center;
  max-width: 260px;
  white-space: nowrap;
}

/* Auto horizontal: keep the wrapped horizontal layout on small screens too (no forced vertical). */
@media (max-width: 767.98px) {
  .uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item,
  .uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-item-pending {
    min-width: 200px;
  }

  .uniandes-timeline.uniandes-timeline--auto.uniandes-timeline--horizontal .tracking-today-marker {
    transform: translate(-55%, -165%);
  }
}


