/* ═══════════════════════════════════════════════════
   SHARED STYLES – Order Tracking App
   ═══════════════════════════════════════════════════ */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #ea580c;
  --warning-light: #fff7ed;
  --info: #0284c7;
  --info-light: #e0f2fe;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Navbar ─── */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .brand {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.navbar nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  margin-left: 1.5rem;
  font-weight: 500;
  transition: color .2s;
}
.navbar nav a:hover,
.navbar nav a.active { color: #fff; }

/* ─── Container ─── */
.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ─── Card ─── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.card-header {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Form Elements ─── */
label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--gray-700);
  font-size: .9rem;
}
input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
textarea { resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-group { margin-bottom: 1rem; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s, transform .1s;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover { border-color: var(--gray-400); background: var(--gray-50); }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }

/* ─── Table ─── */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: .9rem;
}
th {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .5px;
}
tr:hover { background: var(--gray-50); }

/* ─── Status Badges ─── */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.badge-packaging    { background: var(--info-light); color: var(--info); }
.badge-labeling     { background: #dbeafe; color: #0ea5e9; }
.badge-despatched   { background: #fed7aa; color: #c2410c; }
.badge-in-transit   { background: var(--warning-light); color: var(--warning); }
.badge-delivered    { background: var(--success-light); color: var(--success); }

/* ─── Toast / Alert ─── */
.toast-container {
  position: fixed;
  top: 75px;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  padding: .75rem 1.25rem;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease;
  max-width: 380px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  animation: fadeUp .25s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal h2 { margin-bottom: 1.25rem; font-size: 1.2rem; }

/* ─── Tracking Hero (client) ─── */
.hero {
  text-align: center;
  padding: 4rem 1rem 2rem;
}
.hero h1 { font-size: 2.2rem; margin-bottom: .5rem; color: var(--gray-900); }
.hero p { color: var(--gray-500); font-size: 1.05rem; margin-bottom: 2rem; }
.search-box {
  display: flex;
  max-width: 520px;
  margin: 0 auto;
}
.search-box input {
  flex: 1;
  padding: .75rem 1rem;
  font-size: 1.05rem;
  border-radius: 8px 0 0 8px;
  border: 2px solid var(--primary);
  border-right: none;
}
.search-box input:focus { box-shadow: none; }
.search-box button {
  padding: .75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid var(--primary);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background .2s;
}
.search-box button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

/* ─── Timeline (client tracking) ─── */
.timeline { position: relative; padding-left: 2rem; margin: 1.5rem 0; }
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gray-200);
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  margin-bottom: 1.2rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--primary-light);
}
.timeline-item.active::before {
  background: var(--success);
  border-color: var(--success-light);
}
.timeline-status { font-weight: 700; color: var(--gray-800); }
.timeline-date { font-size: .82rem; color: var(--gray-400); }

/* ─── Tracking Result ─── */
.tracking-result { display: none; }
.tracking-result.show { display: block; }
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 2rem;
}
.info-item label { font-size: .8rem; color: var(--gray-400); margin-bottom: .15rem; }
.info-item span { font-weight: 600; color: var(--gray-800); }

/* ─── Products List (admin) ─── */
.products-list { margin-bottom: 1rem; }
.product-row {
  display: flex;
  gap: .5rem;
  margin-bottom: .5rem;
  align-items: center;
}
.product-row input[type="text"]  { flex: 3; }
.product-row input[type="number"]{ flex: 1; min-width: 70px; }
.product-row .btn { flex-shrink: 0; }

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}
.empty-state svg { width: 64px; margin-bottom: 1rem; opacity: .5; }

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 1rem; }
  .container { padding: 0 1rem; }
  .modal { padding: 1.25rem; }
}
