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

:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #f56565;
  --text-dark: #1a202c;
  --text-light: #718096;
  --bg-light: #f7fafc;
  --border: #e2e8f0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1.5rem 0;
  margin-bottom: 3rem;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  font-size: 1.5rem;
  color: var(--primary);
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: var(--text-light);
  font-weight: 500;
  transition: color 0.2s;
}

nav a:hover,
nav a.active {
  color: var(--primary);
}

/* Main Content */
main {
  flex: 1;
  padding: 2rem 0;
}

.track-section {
  background: white;
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.track-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.track-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.track-header p {
  color: var(--text-light);
  font-size: 1.1rem;
}

/* Form */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

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

.help-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: var(--text-light);
  cursor: not-allowed;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error Message */
.error-message {
  background: #fee;
  border: 2px solid var(--danger);
  color: var(--danger);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  text-align: center;
  font-weight: 500;
}

/* Order Details */
.order-details {
  background: white;
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.order-header h2 {
  font-size: 1.75rem;
  color: var(--text-dark);
}

.status-badge {
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-shipped { background: #e9d5ff; color: #6b21a8; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.section {
  margin-bottom: 2.5rem;
}

.section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.info-item {
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
}

.info-item label {
  display: block;
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item .value {
  font-size: 1.1rem;
  color: var(--text-dark);
  font-weight: 500;
}

/* Boards Table */
.boards-grid {
  display: grid;
  gap: 1rem;
}

.board-card {
  background: var(--bg-light);
  padding: 1.25rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--success);
}

.board-id {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.board-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.online-indicator {
  font-size: 1.5rem;
  line-height: 1;
}

.online {
  color: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.offline {
  color: var(--text-light);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.board-meta {
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Tracking Info */
.tracking-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.tracking-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: -1.625rem;
  top: 1.25rem;
  width: 2px;
  height: calc(100% - 1rem);
  background: var(--border);
}

.timeline-item:last-child::after {
  display: none;
}

.timeline-date {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.timeline-event {
  font-weight: 600;
  color: var(--text-dark);
}

.timeline-description {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Footer */
footer {
  background: white;
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-light);
}

footer a {
  color: var(--primary);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .track-section {
    padding: 1.5rem 1rem;
  }

  .order-details {
    padding: 1.5rem 1rem;
  }

  .track-header h2 {
    font-size: 1.5rem;
  }

  .track-header p {
    font-size: 1rem;
  }

  .order-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .order-header h2 {
    font-size: 1.5rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .board-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .board-status {
    width: 100%;
    justify-content: space-between;
  }

  /* Larger touch targets */
  .form-group input,
  .btn-primary {
    min-height: 48px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .btn-primary {
    padding: 1rem;
    font-size: 1rem;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .section h3 {
    font-size: 1.1rem;
  }
}

@media (max-width: 375px) {
  .track-section, .order-details {
    padding: 1.25rem 0.75rem;
  }

  .track-header h2 {
    font-size: 1.35rem;
  }

  .status-badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.875rem;
  }

  .board-id {
    font-size: 0.95rem;
  }
}
