@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
  background: #060911;
  color: #f3f4f6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* ================= BACKGROUND ANIMATIONS ================= */

/* --- Option 1: Radar Sweep --- */
body.bg-radar::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 700px;
  height: 700px;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg, transparent 0deg, transparent 300deg, rgba(59, 130, 246, 0.18) 360deg);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.04);
  animation: radarSweep 6s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes radarSweep {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Option 2: Floating Orbs --- */
.bg-orb-container { display: none; }
body.bg-orbs .bg-orb-container { display: block; }

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
  animation: floatOrb 12s infinite alternate ease-in-out;
}

.orb-1 { width: 320px; height: 320px; background: #3b82f6; top: 10%; left: 10%; }
.orb-2 { width: 280px; height: 280px; background: #06b6d4; bottom: 15%; right: 15%; animation-delay: -4s; }
.orb-3 { width: 220px; height: 220px; background: #6366f1; top: 45%; left: 55%; animation-delay: -8s; }

@keyframes floatOrb {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-50px) scale(1.15); }
}

/* --- Option 3: Speed Streaks --- */
.bg-streaks-container { display: none; }
body.bg-streaks .bg-streaks-container { display: block; }

.streak {
  position: fixed;
  height: 2px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
  opacity: 0.4;
  width: 100%;
  z-index: 0;
  pointer-events: none;
  animation: moveStreak 4s linear infinite;
}

.s1 { top: 25%; animation-duration: 3s; }
.s2 { top: 55%; animation-duration: 5s; animation-delay: -2s; }
.s3 { top: 80%; animation-duration: 4s; animation-delay: -1s; }

@keyframes moveStreak {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- Option 4: Cosmic Stars --- */
.bg-stars-container { display: none; }
body.bg-stars .bg-stars-container { display: block; }

.star {
  position: fixed;
  width: 3px;
  height: 3px;
  background: #60a5fa;
  border-radius: 50%;
  box-shadow: 0 0 8px #60a5fa;
  z-index: 0;
  pointer-events: none;
  animation: floatUp 8s infinite linear;
}

.star:nth-child(1) { left: 15%; animation-delay: 0s; }
.star:nth-child(2) { left: 35%; animation-delay: -2s; }
.star:nth-child(3) { left: 60%; animation-delay: -4s; }
.star:nth-child(4) { left: 80%; animation-delay: -1s; }
.star:nth-child(5) { left: 90%; animation-delay: -5s; }

@keyframes floatUp {
  from { transform: translateY(100vh); opacity: 0; }
  50% { opacity: 0.8; }
  to { transform: translateY(-10vh); opacity: 0; }
}

/* ================= PAGE LAYOUT & UI ================= */

.navbar {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 800;
  color: #ffffff;
  font-size: 1.25rem;
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-brand span {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 10px;
  transition: all 0.25s ease;
}

.nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.container {
  width: 100%;
  max-width: 820px;
  margin: 40px auto;
  padding: 36px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 10;
}

h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: #ffffff;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrapper {
  display: flex;
  gap: 12px;
  background: rgba(30, 41, 59, 0.5);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s;
}

.search-wrapper:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 16px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
}

input[type="text"]::placeholder {
  color: #64748b;
}

.btn-search {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  padding: 0 28px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.btn-search:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

#tracking-result {
  display: none;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#tracking-result.show {
  display: block !important;
  opacity: 1;
  transform: translateY(0);
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.tracking-id-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.badge-status {
  padding: 6px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.3px;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 40px 0 36px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  z-index: 1;
}

.timeline-progress {
  position: absolute;
  top: 18px;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
  border-radius: 4px;
  z-index: 1;
  width: 0%;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.step {
  position: relative;
  z-index: 2;
  text-align: center;
  flex: 1;
}

.step-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  transition: all 0.3s ease;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.step.active .step-icon {
  background: #2563eb !important;
  border-color: #93c5fd !important;
  color: #ffffff !important;
  animation: pulseGlow 2s infinite;
}

.step-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.step.active .step-label {
  color: #f8fafc;
  font-weight: 700;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: rgba(30, 41, 59, 0.35);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item {
  font-size: 0.95rem;
  color: #f1f5f9;
}

.detail-item span {
  color: #64748b;
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* Chat Floating Button */
#chat-widget-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-box {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 360px;
  height: 440px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95) translateY(15px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#chat-box.show {
  display: flex !important;
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* BG Switcher Controls Style */
.bg-switcher {
  position: fixed;
  top: 80px;
  right: 20px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 12px;
  border-radius: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.bg-switcher select {
  background: #1e293b;
  color: #fff;
  border: 1px solid #334155;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  font-size: 0.8rem;
}

/* =========================================================
   MOBILE & TABLET RESPONSIVE MEDIA QUERIES
   ========================================================= */

@media screen and (max-width: 768px) {
  /* Navbar Adjustments */
  .navbar {
    padding: 12px 16px;
    flex-direction: column;
    gap: 12px;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }

  .nav-link {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  /* Container Adjustment */
  .container {
    width: 92%;
    margin: 20px auto;
    padding: 20px;
    border-radius: 16px;
  }

  h2 {
    font-size: 1.3rem;
  }

  /* Search Input & Button Stacking */
  .search-wrapper {
    flex-direction: column;
    background: transparent;
    border: none;
    padding: 0;
    gap: 10px;
  }

  .search-wrapper:focus-within {
    box-shadow: none;
  }

  input[type="text"] {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 100%;
    padding: 14px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .btn-search {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
  }

  /* Status Header Adjustments */
  .status-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .tracking-id-title {
    font-size: 1.25rem;
  }

  /* Details Grid Single Column */
  .details-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  /* Horizontal to Vertical Timeline Conversion */
  .timeline {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    margin: 24px 0 24px 10px;
    padding-left: 20px;
  }

  .timeline::before {
    top: 0;
    left: 18px;
    width: 4px;
    height: 100%;
  }

  .timeline-progress {
    top: 0;
    left: 18px;
    width: 4px !important;
    height: 0%;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  .step {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    width: 100%;
  }

  .step-icon {
    margin: 0;
    flex-shrink: 0;
  }

  /* BG Switcher Position Adjustment */
  .bg-switcher {
    top: auto;
    bottom: 20px;
    left: 16px;
    right: auto;
  }

  /* Chat Box Mobile Size */
  #chat-box {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 90px;
    height: 60vh;
  }

  #chat-widget-btn {
    bottom: 20px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}

@media screen and (max-width: 480px) {
  .container {
    width: 95%;
    padding: 16px;
  }

  .nav-brand {
    font-size: 1.1rem;
  }
}