/* =========================================================
   IMPROVED RESPONSIVE CSS + FIXED HORIZONTAL TIMELINE
========================================================= */

/* Hide static content by default - show only when API results are not loaded */
#track-v2-results-static {
    display: none;
}

/* Hide hero section initially */
#track-v2-hero {
    display: none;
}

/* Loading container styles */
#track-v2-loading-container {
    display: none;
    padding: 60px 20px;
    text-align: center;
}

#track-v2-loading-container.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-wrapper {
    width: 100%;
    text-align: center;
}

.loading-wrapper p {
    margin-top: 20px;
    font-size: 16px;
    color: #666;
}

/* Always show help-section and feature-grid */
#help-section,
#feature-grid {
    display: block;
    margin-bottom: 28px;
}

.help-section,
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Loading indicator styles */
.track-v2-loading {
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary);
}

.track-v2-loading.active {
    display: block;
}

.track-v2-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* Error message styles */
.track-v2-error {
    background: var(--white);
    border-radius: 28px;
    padding: 34px;
    box-shadow: 0 10px 35px rgba(15, 43, 107, 0.05);
    text-align: center;
    margin-bottom: 30px;
}

.track-v2-error-title {
    color: var(--heading);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.track-v2-error-message {
    color: var(--secondary);
    font-size: 15px;
}

.loading-container {
    position: fixed;
    left: 50%;
    bottom: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 75px;
    height: 75px;
    z-index: 1001;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --heading: #0f2b6b;
  --body: #334155;
  --secondary: #64748b;
  --success: #16a34a;
  --primary: #1d4ed8;
  --disabled: #94a3b8;
  --white: #ffffff;
  --bg: #f5f7fb;
  --border: #e2e8f0;
}

html {
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--body);
  overflow-x: hidden;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: auto;
  padding-inline: 20px;
}

/* =========================================================
   HEADER
========================================================= */

.header {
  width: 100%;
  padding: 10px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 999;
  margin-bottom: 10px;
}

.navbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.logo img {
  width: 78px;
  object-fit: contain;
}

.menu {
  display: flex;
  align-items: center;
  gap: 34px;
  flex-wrap: wrap;
}

.menu a {
  font-size: 15px;
  font-weight: 600;
  color: var(--body);
  position: relative;
  transition: 0.3s;
  white-space: nowrap;
}

.menu a:hover {
  color: var(--primary);
}

.menu a.active {
  color: var(--primary);
}

.menu a.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -29px;
  width: 100%;
  height: 3px;
  border-radius: 50px;
  background: var(--primary);
}

/* =========================================================
   HERO
========================================================= */

.hero {
  padding: 70px 0 40px;
}

.hero-content {
  text-align: center;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 54px);
  color: var(--heading);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  text-align: center;
}

.hero p {
  color: var(--secondary);
  font-size: 16px;
  max-width: 760px;
  margin: auto;
  text-align: center;
}

.tracking-box {
  width: 100%;
  max-width: 760px;
  margin: 34px auto 0;
  background: var(--white);
  border-radius: 22px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 15px 40px rgba(15, 43, 107, 0.08);
}

.tracking-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 16px;
  font-size: 16px;
  color: var(--body);
}

.tracking-box button {
  border: none;
  background: var(--primary);
  color: var(--white);
  border-radius: 16px;
  padding: 16px 34px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
  flex-shrink: 0;
}

.tracking-box button:hover {
  opacity: 0.9;
}

/* =========================================================
   CARD
========================================================= */

.card {
  background: var(--white);
  border-radius: 28px;
  padding: 34px;
  box-shadow: 0 10px 35px rgba(15, 43, 107, 0.05);
  margin-bottom: 28px;
}

.section-title {
  font-size: clamp(24px, 3vw, 34px);
  color: var(--heading);
  margin-bottom: 28px;
  font-weight: 800;
}

/* =========================================================
   SHIPPING INFO
========================================================= */

.shipping-info {
  display: grid;
  grid-template-columns: 110px 1fr 320px;
  gap: 28px;
  align-items: center;
}

.shipping-icon {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 40px;
}

.shipping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.label {
  color: var(--secondary);
  font-size: 14px;
  margin-bottom: 6px;
}

.value {
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  word-break: break-word;
}

.status-box {
  background: #f0fdf4;
  border-radius: 22px;
  padding: 28px;
  width: 100%;
}

.status-box p {
  color: var(--secondary);
  font-size: 14px;
}

.status-box h3 {
  color: var(--success);
  font-size: clamp(24px, 3vw, 34px);
  margin: 8px 0 16px;
}

/* =========================================================
   FIXED HORIZONTAL TIMELINE
========================================================= */

.step-wrapper {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 50px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;

  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.step-wrapper::-webkit-scrollbar {
  height: 4px;
}

.step-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 20px;
}

.step-wrapper::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 70px;
  right: 70px;
  height: 4px;
  background: #dbeafe;
  z-index: 1;
  border-radius: 20px;
}

.step {
  position: relative;
  z-index: 2;
  min-width: 180px;

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  flex-shrink: 0;
}

.step .circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;

  background: #dbeafe;
  color: var(--primary);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 22px;

  margin-bottom: 12px;

  transition: 0.3s ease;
}

.step.active .circle {
  background: var(--primary);
  color: var(--white);
}

.step.done .circle {
  background: var(--success);
  color: var(--white);
}

.step h4 {
  color: var(--heading);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
}

.step p {
  color: var(--secondary);
  font-size: 14px;
  white-space: nowrap;
}

/* =========================================================
   HISTORY
========================================================= */

.history-list {
  position: relative;
  padding-left: 45px;
}

.history-list::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 0;
  width: 3px;
  height: 100%;
  background:#cbd5e1;
  z-index: 1;
}

.history-item {
  position: relative;
  display: flex;
  gap: 18px;
  background: #f8fafc;
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 24px;
}

.history-item::before {
  content: "";
  position: absolute;
  left: -38px;
  top: 32px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 4px solid var(--white);
  z-index: 2;
}

/* Active history item - blue/primary colors */
.history-item.active {
  background: #f8fafc;
}

.history-item.active::before {
  background: var(--primary);
  border: 4px solid var(--white);
}

.history-item.active .history-icon {
  background: var(--white);
  color: var(--primary);
}

.history-item.active .history-content h4 {
  color: var(--heading);
}

.history-item.active .location {
  color: var(--primary);
}

/* Inactive history item - gray colors */
.history-item.inactive {
  background: #e2e8f0;
  opacity: 0.5;
}

.history-item.inactive::before {
  background: var(--disabled);
  border: 4px solid var(--white);
}

.history-item.inactive .history-icon {
  background: #e2e8f0;
  color: var(--disabled);
}

.history-item.inactive .history-content h4 {
  color: var(--secondary);
}

.history-item.inactive .location {
  color: var(--disabled);
}

.history-item.inactive .date {
  color: var(--secondary);
}

.history-icon {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 18px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 24px;
}

.history-content {
  width: 100%;
  min-width: 0;
}

.history-content h4 {
  color: var(--heading);
  font-size: 18px;
  margin-bottom: 6px;
}

.location {
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.date {
  color: var(--secondary);
  font-size: 14px;
}

/* =========================================================
   HELP SECTION
========================================================= */

.help-section {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.help-card {
  background: var(--white);
  border-radius: 22px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 110px;
}

.help-card i {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 22px;
  flex-shrink: 0;
}

.help-card h4 {
  color: var(--heading);
  margin-bottom: 4px;
}

.help-card p {
  color: var(--secondary);
  font-size: 14px;
}

/* =========================================================
   FEATURE
========================================================= */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.feature-item {
  background: var(--white);
  border-radius: 22px;
  padding: 28px 22px;
  text-align: center;
}

.feature-item i {
  font-size: 30px;
  color: var(--primary);
  margin-bottom: 14px;
}

.feature-item h4 {
  color: var(--heading);
  margin-bottom: 8px;
}

.feature-item p {
  color: var(--secondary);
  font-size: 14px;
}

/* =========================================================
   FOOTER
========================================================= */

.footer {
  background: var(--heading);
  margin-top: 60px;
  margin-bottom: 0;
  color: var(--white);
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.footer-content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: 20px;
  padding-block: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* =========================================================
   LARGE TABLET
========================================================= */

@media (max-width: 1100px) {
  .shipping-info {
    grid-template-columns: 1fr;
  }

  .shipping-icon {
    margin: auto;
  }

  .status-box {
    max-width: 100%;
  }

  .help-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 768px) {
  .container {
    padding-inline: 16px;
  }

  .navbar {
    justify-content: center;
    text-align: center;
  }

  .menu {
    justify-content: center;
    gap: 18px;
  }

  .menu a.active::after {
    display: none;
  }

  .hero {
    padding: 50px 0 30px;
  }

  .tracking-box {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .tracking-box input {
    width: 100%;
    padding: 14px 16px;
  }

  .tracking-box button {
    width: 100%;
  }

  .card {
    padding: 24px;
    border-radius: 24px;
  }

  .shipping-grid {
    grid-template-columns: 1fr;
  }

  /* TIMELINE tetap horizontal */

  .step-wrapper {
    gap: 20px;
    padding-inline: 10px;
  }

  .step {
    min-width: 150px;
  }

  .step .circle {
    width: 52px;
    height: 52px;
    font-size: 20px;
  }

  .step h4 {
    font-size: 16px;
  }

  .step p {
    font-size: 13px;
  }

  .step-wrapper::before {
    top: 25px;
    left: 60px;
    right: 60px;
  }

  .history-list {
    padding-left: 30px;
  }

  .history-item::before {
    left: -24px;
  }

  .help-section {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 480px) {
  .loading-container {
    width: 100px;
    height: 100px;
  }

  .container {
    padding-inline: 14px;
  }

  .hero h1 {
    font-size: 28px;
    text-align: center;
  }

  .hero p {
    font-size: 14px;
    text-align: center;
  }

  .card {
    padding: 18px;
    border-radius: 20px;
  }

  .section-title {
    margin-bottom: 20px;
  }

  .shipping-icon {
    width: 90px;
    height: 90px;
    font-size: 32px;
  }

  .value {
    font-size: 17px;
  }

  .status-box {
    padding: 22px;
  }

  /* TIMELINE tetap horizontal */

  .step-wrapper {
    gap: 18px;
    padding-inline: 5px;
  }

  .step {
    min-width: 130px;
  }

  .step .circle {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .step h4 {
    font-size: 15px;
  }

  .step p {
    font-size: 12px;
  }

  .step-wrapper::before {
    top: 23px;
    left: 50px;
    right: -180px;
  }

  .history-item {
    padding: 18px;
    border-radius: 18px;
    flex-direction: column;
  }

  .history-icon {
    width: 54px;
    height: 54px;
    font-size: 20px;
  }

  .history-content h4 {
    font-size: 15px;
  }

  .help-card {
    padding: 18px;
  }

  .feature-item {
    padding: 22px 18px;
  }

  .footer-links {
    justify-content: center;
  }
}

/* =========================================================
   ANIMATIONS
========================================================= */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}