/* ============================================================
   XIXA — Giao diện hành trình vận đơn Viettel Post (DÙNG CHUNG)
   Dùng bởi: tra-cuu-don-hang.html + tai-khoan.html
   Markup do /js/vtp-timeline.js sinh ra (window.XixaVtp.render).
   ============================================================ */

/* ---------- Khung trang tra cứu ---------- */
.track-wrap { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }

/* Ô nhập mã vận đơn */
.track-box {
  background: #fff;
  border: 1px solid var(--green-soft, #e6f4d2);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 10px 30px rgba(47, 125, 50, 0.08);
}
.track-box h2 {
  font-size: 20px; font-weight: 800; color: var(--green-deep, #006600);
  margin: 0 0 6px; text-align: left;
}
.track-box p.sub { margin: 0 0 18px; color: #6b7280; font-size: 14px; text-align: left; }
.track-form { display: flex; gap: 10px; flex-wrap: wrap; }
.track-input {
  flex: 1 1 240px; min-width: 0;
  border: 1.5px solid #d7e3c8; border-radius: 12px;
  padding: 14px 16px; font-size: 15px; font-family: inherit;
  transition: border-color .18s, box-shadow .18s; outline: none;
}
.track-input:focus { border-color: var(--green, #2f7d32); box-shadow: 0 0 0 3px rgba(47,125,50,.12); }
.track-btn {
  flex: 0 0 auto; border: none; cursor: pointer;
  background: var(--green, #2f7d32); color: #fff; font-weight: 700; font-size: 15px;
  font-family: inherit; padding: 14px 26px; border-radius: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: filter .18s, transform .06s;
}
.track-btn:hover { filter: brightness(1.06); }
.track-btn:active { transform: translateY(1px); }
.track-btn[disabled] { opacity: .6; cursor: default; }
.track-btn svg { width: 17px; height: 17px; }

/* Thông báo lỗi / cảnh báo */
.track-note {
  margin-top: 16px; border-radius: 12px; padding: 12px 14px;
  font-size: 13.5px; display: none; gap: 8px; align-items: flex-start; text-align: left;
}
.track-note svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.track-note.show { display: flex; }
.track-note.err  { background: #fdecec; color: #b42318; }
.track-note.warn { background: #fff7e6; color: #9a6a00; }

/* Kết quả + trạng thái rỗng + skeleton */
.track-result { margin-top: 24px; display: none; }
.track-result.show { display: block; }
.track-empty { text-align: center; color: #9aa4ad; padding: 40px 0 0; }
.track-empty img { width: 96px; opacity: .35; margin-bottom: 12px; }
.track-loading { display: none; margin-top: 24px; }
.track-loading.show { display: block; }
.sk { background: linear-gradient(90deg,#eef2ea 25%,#f7faf3 37%,#eef2ea 63%); background-size: 400% 100%; animation: skpulse 1.3s ease infinite; border-radius: 10px; }
@keyframes skpulse { 0%{background-position:100% 0} 100%{background-position:0 0} }

/* ============================================================
   Component hành trình (.vtpx) — sinh bởi XixaVtp.render()
   ============================================================ */
.vtpx { text-align: left; }

/* ---------- Thẻ trạng thái hiện tại (đổi màu theo giai đoạn) ---------- */
.vtpx-card {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 22px 24px; margin-bottom: 16px;
  color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.vtpx-card::before { /* vòng tròn trang trí */
  content: ""; position: absolute; right: -46px; top: -46px;
  width: 170px; height: 170px; border-radius: 50%; background: rgba(255,255,255,.13);
}
.vtpx-card::after {
  content: ""; position: absolute; right: 60px; bottom: -70px;
  width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.08);
}
.vtpx-card.stage-delivered { background: linear-gradient(135deg, #2f7d32, #43a047); box-shadow: 0 12px 26px rgba(47,125,50,.24); }
.vtpx-card.stage-picked    { background: linear-gradient(135deg, #1565c0, #2196f3); box-shadow: 0 12px 26px rgba(21,101,192,.24); }
.vtpx-card.stage-created   { background: linear-gradient(135deg, #d97706, #f59e0b); box-shadow: 0 12px 26px rgba(217,119,6,.24); }
.vtpx-card.stage-returning { background: linear-gradient(135deg, #c2410c, #f97316); box-shadow: 0 12px 26px rgba(194,65,12,.24); }
.vtpx-card.stage-cancelled { background: linear-gradient(135deg, #b91c1c, #ef4444); box-shadow: 0 12px 26px rgba(185,28,28,.24); }
.vtpx-card.stage-unknown   { background: linear-gradient(135deg, #475569, #64748b); box-shadow: 0 12px 26px rgba(71,85,105,.24); }

.vtpx-card-main { position: relative; z-index: 1; min-width: 0; }
.vtpx-code {
  font-size: 12.5px; opacity: .92; letter-spacing: .3px;
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.vtpx-code b { font-size: 13.5px; letter-spacing: .6px; font-weight: 800; }
.vtpx-copy {
  border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.14);
  color: #fff; border-radius: 8px; padding: 3px 8px; font-size: 11px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-family: inherit;
  transition: background .15s;
}
.vtpx-copy:hover { background: rgba(255,255,255,.26); }
.vtpx-copy svg { width: 12px; height: 12px; }
.vtpx-status { font-size: 22px; font-weight: 800; margin: 8px 0 6px; line-height: 1.25; }
.vtpx-meta { font-size: 13.5px; opacity: .95; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.vtpx-meta span { display: inline-flex; align-items: flex-start; gap: 6px; min-width: 0; }
.vtpx-meta svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.vtpx-hero-ic {
  position: relative; z-index: 1; flex: 0 0 auto;
  width: 62px; height: 62px; border-radius: 50%;
  background: rgba(255,255,255,.18); border: 1.5px solid rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
}
.vtpx-hero-ic svg { width: 30px; height: 30px; stroke: #fff; }

/* ---------- Thanh tiến trình 4 bước ---------- */
.vtpx-steps { display: flex; margin: 20px 2px 22px; }
.vtpx-step { flex: 1; text-align: center; position: relative; min-width: 0; }
.vtpx-step::before {
  content: ""; position: absolute; top: 16px; left: -50%; width: 100%; height: 3px;
  border-radius: 2px; background: #e2e8f0; z-index: 0;
}
.vtpx-step:first-child::before { display: none; }
.vtpx-step.reached::before { background: var(--green, #2f7d32); }
.vtpx-step-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: #eef2f7; color: #94a3b8;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; z-index: 1; border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(15,23,42,.08);
  transition: background .2s;
}
.vtpx-step-dot svg { width: 16px; height: 16px; stroke: currentColor; }
.vtpx-step.reached .vtpx-step-dot { background: var(--green, #2f7d32); color: #fff; }
.vtpx-step.current .vtpx-step-dot { box-shadow: 0 0 0 4px rgba(47,125,50,.18); }
.vtpx-step-label { font-size: 12px; font-weight: 700; color: #94a3b8; margin-top: 7px; line-height: 1.3; }
.vtpx-step.reached .vtpx-step-label { color: var(--green-deep, #1b5e20); }

/* ---------- Nhóm hành trình (accordion) ---------- */
.vtpx-groups {
  border: 1px solid #e5efdd; border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 4px 16px rgba(15,23,42,.04);
}
.vtpx-group + .vtpx-group { border-top: 1px solid #f1f5f9; }
.vtpx-group-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; background: #fbfdf9; cursor: pointer; user-select: none;
  transition: background .18s;
}
.vtpx-group-header:hover { background: #f4f9ee; }
.vtpx-group-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.vtpx-group-ic {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px;
  background: #e9f5e0; color: var(--green, #2f7d32);
  display: inline-flex; align-items: center; justify-content: center;
}
.vtpx-group-ic svg { width: 17px; height: 17px; stroke: currentColor; }
.vtpx-group-name {
  flex: 1; min-width: 0; font-weight: 700; font-size: 14px; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.vtpx-group-count {
  flex: 0 0 auto; font-size: 11px; background: #e2e8f0; color: #475569;
  padding: 2px 9px; border-radius: 999px; font-weight: 700; white-space: nowrap;
}
.vtpx-group-arrow { flex: 0 0 auto; color: #94a3b8; display: inline-flex; transition: transform .25s; }
.vtpx-group-arrow svg { width: 15px; height: 15px; }
.vtpx-group.collapsed .vtpx-group-arrow { transform: rotate(-90deg); }
.vtpx-group-content { padding: 16px 18px 14px 20px; }
.vtpx-group.collapsed .vtpx-group-content { display: none; }

/* ---------- Timeline từng mốc ---------- */
.vtpx-tl { position: relative; }
.vtpx-tl-item { position: relative; padding: 0 0 20px 30px; }
.vtpx-tl-item::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: -6px;
  width: 2px; background: #dcebd0;
}
.vtpx-tl-item:last-child { padding-bottom: 2px; }
.vtpx-tl-item:last-child::before { display: none; }
.vtpx-tl-dot {
  position: absolute; left: 1px; top: 5px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; border: 3px solid #cdd9c1; z-index: 1;
}
.vtpx-tl-item.active .vtpx-tl-dot {
  border-color: var(--green, #2f7d32);
  box-shadow: 0 0 0 4px rgba(47,125,50,.14);
}
.vtpx-tl-status { font-size: 14.5px; font-weight: 700; color: #2b3a2b; line-height: 1.35; }
.vtpx-tl-item.active .vtpx-tl-status { color: var(--green-deep, #006600); }
.vtpx-tl-loc {
  font-size: 13px; color: #4b5563; margin-top: 3px;
  display: flex; align-items: flex-start; gap: 5px;
}
.vtpx-tl-loc svg { width: 13px; height: 13px; flex: 0 0 auto; margin-top: 2px; color: #94a3b8; }
.vtpx-tl-note { font-size: 12.5px; color: #6b7280; margin-top: 2px; font-style: italic; }
.vtpx-tl-time { font-size: 12px; color: #94a3b8; margin-top: 4px; font-weight: 600; }

/* Link tra cứu chính thức VTP */
.vtpx-ext {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  font-size: 12.5px; font-weight: 700; color: var(--green, #2f7d32); text-decoration: none;
}
.vtpx-ext:hover { text-decoration: underline; }
.vtpx-ext svg { width: 13px; height: 13px; }

/* ---------- Bản gọn (nhúng trong đơn ở trang tài khoản) ---------- */
.vtpx.compact .vtpx-card { padding: 16px 18px; border-radius: 14px; margin-bottom: 12px; }
.vtpx.compact .vtpx-status { font-size: 17px; margin: 6px 0 4px; }
.vtpx.compact .vtpx-hero-ic { width: 48px; height: 48px; }
.vtpx.compact .vtpx-hero-ic svg { width: 23px; height: 23px; }
.vtpx.compact .vtpx-steps { margin: 14px 2px 16px; }
.vtpx.compact .vtpx-step-dot { width: 30px; height: 30px; }
.vtpx.compact .vtpx-step-dot svg { width: 14px; height: 14px; }
.vtpx.compact .vtpx-step::before { top: 14px; }
.vtpx.compact .vtpx-step-label { font-size: 11px; }
.vtpx.compact .vtpx-group-content { padding: 14px 14px 12px 16px; }
.vtpx.compact .vtpx-tl-status { font-size: 13.5px; }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .track-wrap { padding: 24px 14px 60px; }
  .track-box { padding: 20px 16px; border-radius: 16px; }
  .track-btn { flex: 1 1 100%; justify-content: center; }

  .vtpx-card { padding: 18px 16px; border-radius: 16px; }
  .vtpx-status { font-size: 18px; }
  .vtpx-hero-ic { width: 48px; height: 48px; }
  .vtpx-hero-ic svg { width: 23px; height: 23px; }
  .vtpx-meta { font-size: 12.5px; gap: 3px 12px; }

  .vtpx-steps { margin: 16px 0 18px; }
  .vtpx-step-dot { width: 30px; height: 30px; }
  .vtpx-step-dot svg { width: 14px; height: 14px; }
  .vtpx-step::before { top: 14px; }
  .vtpx-step-label { font-size: 10.5px; }

  .vtpx-group-header { padding: 11px 12px; }
  .vtpx-group-name { font-size: 13px; }
  .vtpx-group-content { padding: 14px 12px 12px 14px; }
  .vtpx-tl-status { font-size: 13.5px; }
  .vtpx-tl-loc { font-size: 12.5px; }
}
