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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #ca8a04;
  --error: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

header p {
  color: var(--gray-500);
}

main {
  flex: 1;
}

.tracking-form {
  margin-bottom: 1.5rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 0.5rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--primary);
}

.input-group button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}

.input-group button:hover {
  background: var(--primary-dark);
}

.input-group button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.error {
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  color: var(--error);
  margin-bottom: 1.5rem;
}

.result {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.shipment-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.tracking-info .label {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tracking-info .value {
  font-size: 1.125rem;
  font-weight: 600;
  font-family: monospace;
}

.status-badge {
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.pending { background: var(--gray-100); color: var(--gray-700); }
.status-badge.picked_up { background: #dbeafe; color: #1e40af; }
.status-badge.in_transit { background: #fef3c7; color: #92400e; }
.status-badge.out_for_delivery { background: #d1fae5; color: #065f46; }
.status-badge.delivered { background: #dcfce7; color: var(--success); }
.status-badge.exception { background: #fee2e2; color: var(--error); }
.status-badge.cancelled { background: var(--gray-200); color: var(--gray-700); }

.timeline {
  padding: 1.25rem;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.5rem;
  position: relative;
}

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

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 1.5rem;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.timeline-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.timeline-item:not(:first-child) .timeline-dot {
  background: var(--gray-300);
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-status {
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 0.25rem;
}

.timeline-description {
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.timeline-meta {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.timeline-location {
  margin-right: 1rem;
}

.no-events {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
}

footer {
  text-align: center;
  padding-top: 2rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

@media (max-width: 480px) {
  .input-group {
    flex-direction: column;
  }

  .input-group button {
    width: 100%;
  }

  .shipment-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
