/* Rastreio — layout premium (tracking-page) */

body.trk-body .main {
  background: #f5f7fb;
}

.trk-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1440px;
}

.trk-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  border: 1px solid #e5e7eb;
}

.trk-card--main {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* —— Header —— */
.trk-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.trk-header__left {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  min-width: 0;
}

.trk-header__icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
}

.trk-header__icon svg {
  width: 28px;
  height: 28px;
}

.trk-order {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.trk-order strong {
  color: #64748b;
  font-weight: 800;
}

.trk-headline {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
}

.trk-desc {
  margin: 8px 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #475569;
  max-width: 36rem;
}

.trk-header__right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.trk-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.trk-badge svg {
  width: 16px;
  height: 16px;
}

.trk-badge--green {
  background: #ecfdf5;
  color: #16a34a;
}

.trk-updated {
  margin: 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* —— Timeline horizontal —— */
.trk-timeline {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.trk-timeline::-webkit-scrollbar {
  display: none;
}

.trk-timeline__step {
  position: relative;
  flex: 1 1 0;
  min-width: 7.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 8px;
}

.trk-timeline__step:not(.is-last)::before {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 22px);
  right: calc(-50% + 22px);
  height: 3px;
  background: #e2e8f0;
  z-index: 0;
  border-radius: 2px;
}

.trk-timeline__step.is-done:not(.is-last)::before {
  background: #22c55e;
}

.trk-timeline__icon {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #e2e8f0;
  color: #94a3b8;
}

.trk-timeline__icon svg {
  width: 18px;
  height: 18px;
}

.trk-timeline__step.is-done .trk-timeline__icon {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.trk-timeline__step.is-current .trk-timeline__icon {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.15);
  width: 40px;
  height: 40px;
}

.trk-timeline__step.is-current .trk-timeline__icon svg {
  width: 20px;
  height: 20px;
}

.trk-timeline__title {
  margin: 10px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  color: #94a3b8;
}

.trk-timeline__step.is-done .trk-timeline__title {
  color: #475569;
}

.trk-timeline__step.is-current .trk-timeline__title {
  color: #2563eb;
}

.trk-timeline__date {
  margin: 4px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #94a3b8;
}

.trk-timeline__step.is-done .trk-timeline__date,
.trk-timeline__step.is-current .trk-timeline__date {
  color: #64748b;
}

.trk-timeline__pending {
  margin: 4px 0 0;
  font-size: 0.68rem;
  color: #cbd5e1;
  font-style: italic;
}

/* —— Info grid —— */
.trk-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.trk-info-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px 16px;
  min-width: 0;
}

.trk-info-card__label {
  display: block;
  margin: 0 0 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.trk-info-card__value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}

.trk-carrier {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trk-carrier__img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: #f8fafc;
}

.trk-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trk-code-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  word-break: break-all;
}

.trk-copy-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.trk-copy-btn:hover {
  background: #dbeafe;
}

.trk-copy-btn svg {
  width: 16px;
  height: 16px;
}

.trk-copy-toast {
  display: none;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #16a34a;
}

.trk-copy-toast.is-visible {
  display: block;
}

.trk-date-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.trk-date-row svg {
  width: 18px;
  height: 18px;
  color: #2563eb;
  flex-shrink: 0;
  margin-top: 2px;
}

.trk-estimate-sub {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

/* —— Actions —— */
.trk-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.trk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.trk-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.trk-btn--primary {
  background: #2563eb;
  color: #fff !important;
}

.trk-btn--primary:hover {
  background: #1d4ed8;
}

.trk-btn--secondary {
  background: #fff;
  color: #475569 !important;
  border: 1px solid #e5e7eb;
}

.trk-btn--secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.trk-btn__chevron {
  margin-left: auto;
}

/* —— Bottom: history + help —— */
.trk-bottom {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}

.trk-history {
  padding: 28px 32px;
}

.trk-history__title {
  margin: 0 0 20px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.trk-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.trk-history__item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 0 16px;
  padding-bottom: 20px;
  position: relative;
}

.trk-history__item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.trk-history__item.is-done:not(:last-child)::before {
  background: #bbf7d0;
}

.trk-history__dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #fff;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.trk-history__item.is-done .trk-history__dot {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.trk-history__item.is-current .trk-history__dot {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.trk-history__dot svg {
  width: 10px;
  height: 10px;
}

.trk-history__date {
  margin: 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.trk-history__event-title {
  margin: 2px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.trk-history__event-desc {
  margin: 4px 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #64748b;
}

/* —— Help (compact) —— */
.trk-help {
  padding: 20px;
}

.trk-help__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.trk-help__head svg {
  width: 20px;
  height: 20px;
  color: #2563eb;
}

.trk-help__title {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
}

.trk-help__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trk-help__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  text-decoration: none !important;
  color: inherit;
  transition: background 0.15s ease;
}

.trk-help__link:hover {
  background: #f1f5f9;
}

.trk-help__ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trk-help__ico svg {
  width: 16px;
  height: 16px;
}

.trk-help__ico--wa {
  background: #dcfce7;
  color: #16a34a;
}

.trk-help__ico--mail {
  background: #eff6ff;
  color: #2563eb;
}

.trk-help__ico--phone {
  background: #f3e8ff;
  color: #7c3aed;
}

.trk-help__ico--ticket {
  background: #ede9fe;
  color: #6d28d9;
}

.trk-help__text strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

.trk-help__text span {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 1px;
}

/* —— Empty —— */
.trk-empty {
  padding: 32px;
  text-align: center;
}

.trk-empty__title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.trk-empty__msg {
  margin: 0;
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.55;
}

/* —— Responsive —— */
@media (max-width: 1024px) {
  .trk-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trk-bottom {
    grid-template-columns: 1fr;
  }

  .trk-help {
    max-width: 100%;
  }
}

.trk-sync-meta {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: #64748b;
}

.trk-location-banner {
  margin: 10px 0 0;
  padding: 10px 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 12px;
  font-size: 0.88rem;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.trk-location-banner strong {
  font-weight: 700;
  color: #1d4ed8;
}

.trk-history__item.is-current .trk-history__dot {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.trk-history__item.is-current .trk-history__dot svg {
  width: 14px;
  height: 14px;
}

.trk-sync-meta--warn {
  color: #b45309;
}

.trk-live-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  z-index: 9999;
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}

.trk-live-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.trk-timeline__step.trk-pulse .trk-timeline__icon {
  animation: trk-pulse 0.9s ease 2;
}

@keyframes trk-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }
}

@media (max-width: 720px) {
  .trk-card--main {
    padding: 20px;
    gap: 22px;
  }

  .trk-header {
    flex-direction: column;
  }

  .trk-header__right {
    align-items: flex-start;
  }

  .trk-info-grid {
    grid-template-columns: 1fr;
  }

  .trk-actions {
    grid-template-columns: 1fr;
  }

  .trk-history {
    padding: 20px;
  }

  .trk-timeline__step {
    min-width: 6.5rem;
  }
}
