/* ═══════════════════════════════════════════════════════════
   DIYA ORDER TRACKING — Premium Dark Theme
   ═══════════════════════════════════════════════════════════ */

:root {
  --primary: #E4002B;
  --primary-light: #FF3355;
  --primary-dark: #B8001F;
  --primary-glow: rgba(228, 0, 43, 0.25);

  --accent-blue: #3B82F6;
  --accent-green: #10B981;
  --accent-amber: #F59E0B;
  --accent-purple: #8B5CF6;

  --bg-primary: #0A0A0F;
  --bg-secondary: #12121A;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);

  --text-primary: #F1F1F4;
  --text-secondary: #9A9AAF;
  --text-muted: #5A5A73;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-med: 300ms var(--ease-out);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Background ── */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-particles::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse 600px 600px at 20% 20%, rgba(228, 0, 43, 0.06), transparent),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(59, 130, 246, 0.04), transparent),
    radial-gradient(ellipse 400px 400px at 60% 30%, rgba(139, 92, 246, 0.03), transparent);
  animation: bgDrift 20s ease-in-out infinite alternate;
}

@keyframes bgDrift {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  100% {
    transform: translate(-30px, 20px) rotate(3deg);
  }
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 8s ease-in-out infinite;
}

@keyframes particleFloat {

  0%,
  100% {
    opacity: 0;
    transform: translateY(0) scale(1);
  }

  50% {
    opacity: 0.4;
    transform: translateY(-80px) scale(1.5);
  }
}

/* ═══ VIEW SYSTEM ═══ */
.view {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.view.active {
  display: flex;
}

.results-view.active {
  display: block;
}

/* ═══ SEARCH VIEW ═══ */
.search-page {
  width: 100%;
  max-width: 520px;
  padding: 24px;
  text-align: center;
}

.brand-header {
  margin-bottom: 40px;
}

.brand-name {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  margin-bottom: 8px;
}

.brand-tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.search-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary-glow), transparent);
}

.search-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.search-form {
  width: 100%;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 6px 6px 6px 20px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.input-wrapper:focus-within .input-icon {
  color: var(--primary);
}

.input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  padding: 12px;
  min-width: 0;
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.track-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}

.track-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--primary-glow);
}

.track-btn:active {
  transform: translateY(0);
}

.btn-arrow {
  transition: transform var(--transition-fast);
}

.track-btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* ═══ LOADING VIEW ═══ */
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 60px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
}

.loader {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-icon {
  color: var(--primary);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.9);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.loading-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ═══ ERROR VIEW ═══ */
.error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 32px;
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  text-align: center;
  max-width: 420px;
}

.error-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 50%;
  color: #EF4444;
}

.error-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.error-message {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.retry-btn {
  margin-top: 8px;
  padding: 10px 28px;
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.retry-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ═══ RESULTS VIEW ═══ */
.results-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  position: relative;
  z-index: 1;
}

/* ── Top Bar ── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 24px;
  animation: fadeIn 0.4s var(--ease-out);
}

.top-brand {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.track-another-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.track-another-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

/* ── Customer Name ── */
.customer-section {
  margin-bottom: 24px;
  text-align: center;
  animation: slideUp 0.4s var(--ease-out);
}

.customer-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.customer-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── Status Banner ── */
.status-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.5s var(--ease-out);
}

.status-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.status-banner.status-delivered::before {
  background: linear-gradient(90deg, var(--accent-green), #34D399);
}

.status-banner.status-in-transit::before {
  background: linear-gradient(90deg, var(--accent-blue), #60A5FA);
}

.status-banner.status-out-for-delivery::before {
  background: linear-gradient(90deg, var(--accent-amber), #FBBF24);
}

.status-banner.status-pending::before {
  background: linear-gradient(90deg, var(--accent-purple), #A78BFA);
}

.status-banner.status-rto::before {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.status-banner.status-default::before {
  background: linear-gradient(90deg, var(--text-muted), var(--text-secondary));
}

.status-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-delivered .status-badge {
  background: rgba(16, 185, 129, 0.12);
  color: #34D399;
}

.status-in-transit .status-badge {
  background: rgba(59, 130, 246, 0.12);
  color: #60A5FA;
}

.status-out-for-delivery .status-badge {
  background: rgba(245, 158, 11, 0.12);
  color: #FBBF24;
}

.status-pending .status-badge {
  background: rgba(139, 92, 246, 0.12);
  color: #A78BFA;
}

.status-rto .status-badge {
  background: rgba(228, 0, 43, 0.12);
  color: var(--primary-light);
}

.status-default .status-badge {
  background: rgba(90, 90, 115, 0.12);
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.waybill-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  font-family: 'Inter', monospace;
  letter-spacing: 0.05em;
}

.status-latest {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.status-latest-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

.status-latest-info {
  flex: 1;
  min-width: 0;
}

.status-latest-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.status-latest-location {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-latest-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Details Grid ── */
.details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  animation: slideUp 0.6s var(--ease-out);
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(20px);
  transition: all var(--transition-fast);
}

.detail-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.detail-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.origin-icon {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
}

.dest-icon {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

.edd-icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.order-icon {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
}

.detail-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

/* ── Timeline ── */
.timeline-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  backdrop-filter: blur(20px);
  animation: slideUp 0.7s var(--ease-out);
}

.timeline-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.timeline-title svg {
  color: var(--primary);
}

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--border), var(--primary));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
  opacity: 0;
  transform: translateX(-10px);
  animation: timelineSlide 0.4s var(--ease-out) forwards;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

@keyframes timelineSlide {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--bg-secondary);
  z-index: 1;
  background: var(--text-muted);
}

.timeline-item:last-child .timeline-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  animation: dotBlink 1.5s ease-in-out infinite;
}

.timeline-item:last-child .timeline-status {
  animation: textBlink 1.5s ease-in-out infinite;
}

@keyframes dotBlink {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 4px var(--primary-glow);
  }

  50% {
    opacity: 0.5;
    box-shadow: 0 0 0 8px rgba(228, 0, 43, 0.1);
  }
}

@keyframes textBlink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.timeline-item.scan-delivered .timeline-dot {
  background: var(--accent-green);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.timeline-item.scan-dispatched .timeline-dot,
.timeline-item.scan-in-transit .timeline-dot {
  background: var(--accent-blue);
}

.timeline-item.scan-out-for-delivery .timeline-dot {
  background: var(--accent-amber);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.timeline-item.scan-rto .timeline-dot {
  background: var(--primary);
}

.timeline-content {
  padding: 2px 0;
}

.timeline-date-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}

.timeline-status {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ── Animations ── */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}

/* ── Footer ── */
.footer {
  padding: 28px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer strong {
  color: var(--primary);
  font-weight: 600;
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .search-page {
    padding: 20px 16px;
  }

  .brand-name {
    font-size: 2.6rem;
  }

  .search-card {
    padding: 24px 16px;
  }

  .input-wrapper {
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: 4px;
  }

  .input-wrapper input {
    padding: 14px 16px;
    text-align: center;
  }

  .input-icon {
    display: none;
  }

  .track-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    border-radius: var(--radius-md);
  }

  .results-container {
    padding: 16px 16px 32px;
  }

  .greeting-text {
    font-size: 1.4rem;
  }

  .details-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .status-top-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .timeline-section {
    padding: 18px 14px;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 2.2rem;
  }

  .details-grid {
    gap: 8px;
  }

  .detail-card {
    padding: 12px 10px;
  }
}