/* SwiftDeliver — Logistics Theme System */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:          #0a0c10;
  --bg2:         #111318;
  --bg3:         #1a1d24;
  --border:      #2a2d35;
  --text:        #e8eaf0;
  --muted:       #6b7280;
  --accent:      #f59e0b;
  --accent2:     #10b981;
  --danger:      #ef4444;
  --info:        #3b82f6;
  --pending:     #6366f1;
  --on-way:      #f59e0b;
  --delivered:   #3b82f6;
  --received:    #10b981;
  --radius:      10px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
}

[data-theme="light"] {
  --bg:          #f6f8fc;
  --bg2:         #ffffff;
  --bg3:         #eef2f7;
  --border:      #d8e0eb;
  --text:        #162031;
  --muted:       #607088;
  --accent:      #f59e0b;
  --accent2:     #0f9d77;
  --danger:      #dc2626;
  --info:        #2563eb;
  --pending:     #4f46e5;
  --on-way:      #d97706;
  --delivered:   #2563eb;
  --received:    #0f9d77;
  --shadow:      0 6px 20px rgba(16,24,40,.08);
}

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

html { font-size: 15px; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }

/* ─── Typography ─────────────────────────────── */
h1,h2,h3,h4 { font-weight: 700; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
code, .mono { font-family: 'JetBrains Mono', monospace; }
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 1.2rem;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout Shell (mobile first) ────────────── */
.shell { display: flex; min-height: 100vh; }
body.sidebar-open { overflow: hidden; }

.sidebar {
  width: min(82vw, 280px);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .25s ease, width .22s ease;
}
.sidebar.open { transform: translateX(0); }
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 95;
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-logo .logo-mark {
  width: 42px; height: 42px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text);
}
.sidebar-logo .logo-sub {
  font-size: .7rem; color: var(--muted); font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section { margin-bottom: 1.5rem; }
.nav-label {
  font-size: .65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); padding: .5rem 1.25rem;
}
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.25rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem; font-weight: 500;
  transition: all .15s;
  border-left: 3px solid transparent;
  position: relative;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(245,158,11,.06); }
.nav-item .nav-icon { width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700;
  padding: .1rem .45rem; border-radius: 999px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex; align-items: center; gap: .75rem;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--border);
  display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; color: var(--accent);
  flex-shrink: 0;
}
.user-name { font-size: .85rem; font-weight: 600; }
.user-role { font-size: .7rem; color: var(--muted); text-transform: capitalize; }
.logout-link { margin-left: auto; color: var(--muted); font-size: .8rem; text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* ─── Main Content ───────────────────────────── */
.main { margin-left: 0; flex: 1; display: flex; flex-direction: column; min-width: 0; transition: margin-left .22s ease; }

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: .65rem .8rem;
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title {
  font-size: .98rem;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.icon-btn { padding: .4rem .55rem; }

.page { padding: .85rem; }
.powered-by {
  margin-top: 1rem;
  text-align: center;
  font-size: .72rem;
  color: var(--muted);
}
.powered-by a {
  color: var(--text);
  text-underline-offset: 2px;
  text-decoration-color: rgba(245,158,11,.45);
}
.powered-by a:hover {
  color: var(--accent);
}
.powered-by-app {
  margin-top: 1.5rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border);
}

/* ─── Cards / Stat Cards ─────────────────────── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .95rem; }

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.total::before    { background: var(--info); }
.stat-card.pending::before  { background: var(--pending); }
.stat-card.on-way::before   { background: var(--on-way); }
.stat-card.delivered::before{ background: var(--delivered); }
.stat-card.received::before { background: var(--received); }

.stat-label { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stat-value { font-size: 2.25rem; font-weight: 700; margin: .25rem 0; }
.stat-icon  { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-size: 2.3rem; opacity: .12; }

/* ─── Table ──────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card-header {
  padding: .85rem .95rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem;
}
.card-header h3 { flex: 1; display: inline-flex; align-items: center; gap: .4rem; }
.card-body { padding: .9rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: .72rem .75rem; border-bottom: 1px solid rgba(255,255,255,.04); font-size: .85rem; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Status Badges ──────────────────────────── */
.badge {
  display: inline-block; padding: .25rem .65rem;
  border-radius: 999px; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.badge-pending  { background: rgba(99,102,241,.15);  color: #818cf8; }
.badge-on_the_way { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-delivered  { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-received   { background: rgba(16,185,129,.15); color: #34d399; }

/* ─── Forms ──────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .4rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .65rem .9rem;
  border-radius: 7px;
  font-family: inherit;
  font-size: .9rem;
  transition: border-color .15s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
select option { background: var(--bg3); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ─── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.1rem; border-radius: 7px;
  font-family: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .15s; line-height: 1;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #d97706; }
.btn-success { background: var(--accent2); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-info    { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; }
.btn-ghost   { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-xs { padding: .2rem .55rem; font-size: .72rem; }

/* ─── Alerts ─────────────────────────────────── */
.alert {
  padding: .875rem 1rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: .9rem; border-left: 4px solid;
  display: flex; align-items: center; gap: .75rem;
}
.alert-success { background: rgba(16,185,129,.1); border-color: var(--accent2); color: #34d399; }
.alert-error   { background: rgba(239,68,68,.1);  border-color: var(--danger);  color: #f87171; }
.alert-info    { background: rgba(59,130,246,.1);  border-color: var(--info);    color: #60a5fa; }
.alert-warning { background: rgba(245,158,11,.1);  border-color: var(--accent);  color: #fbbf24; }

/* ─── Timeline ───────────────────────────────── */
.timeline { list-style: none; }
.timeline li {
  padding-left: 1.5rem; padding-bottom: 1.25rem;
  position: relative; border-left: 2px solid var(--border);
  margin-left: .5rem;
}
.timeline li::before {
  content: '';
  position: absolute; left: -5px; top: 5px;
  width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%;
}
.timeline li:last-child { border-left-color: transparent; }
.timeline .tl-time { font-size: .72rem; color: var(--muted); margin-bottom: .25rem; font-family: 'JetBrains Mono', monospace; }
.timeline .tl-status { font-weight: 600; font-size: .85rem; }
.timeline .tl-note { font-size: .82rem; color: var(--muted); }

/* ─── Chat ───────────────────────────────────── */
.chat-wrap { display: flex; height: calc(100vh - 140px); }
.chat-sidebar { width: 260px; border-right: 1px solid var(--border); overflow-y: auto; }
.chat-window  { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.chat-bubble {
  max-width: 70%;
  padding: .6rem .9rem; border-radius: 12px;
  font-size: .875rem; line-height: 1.5;
}
.chat-bubble.mine   { background: var(--accent); color: #000; align-self: flex-end; border-radius: 12px 12px 4px 12px; }
.chat-bubble.theirs { background: var(--bg3); align-self: flex-start; border-radius: 12px 12px 12px 4px; }
.chat-time { font-size: .65rem; opacity: .6; margin-top: .25rem; font-family: 'JetBrains Mono', monospace; }
.chat-input-wrap {
  padding: 1rem; border-top: 1px solid var(--border);
  display: flex; gap: .75rem;
}
.chat-input-wrap input { flex: 1; }

/* ─── Notification Dropdown ──────────────────── */
.notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 2px; right: 2px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg2);
}
.dropdown-panel {
  position: absolute; top: calc(100% + .5rem); right: 0;
  width: min(92vw, 320px); background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: none; z-index: 200;
}
.dropdown-panel.open { display: block; }
.dropdown-panel .dp-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .85rem; }
.notif-item { padding: .75rem 1rem; border-bottom: 1px solid rgba(255,255,255,.04); font-size: .82rem; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(245,158,11,.04); }
.notif-title { font-weight: 600; margin-bottom: .2rem; }
.notif-msg   { color: var(--muted); line-height: 1.4; }
.notif-time  { font-size: .7rem; color: var(--muted); margin-top: .2rem; font-family: monospace; }

/* ─── Auth Page ──────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse at 20% 50%, rgba(245,158,11,.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(59,130,246,.06) 0%, transparent 60%),
              var(--bg);
}
.auth-box {
  width: 100%; max-width: 420px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 2.5rem;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .auth-logo-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  margin: 0 auto .75rem;
}
.auth-logo h1 { font-size: 1.6rem; }
.auth-logo p  { color: var(--muted); font-size: .9rem; }
.auth-panel {
  width: 100%;
  max-width: 420px;
}

/* ─── Customer page ──────────────────────────── */
.customer-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: var(--bg);
}
.customer-box {
  width: 100%; max-width: 500px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 2.5rem; text-align: center;
  box-shadow: var(--shadow);
}
.customer-box .big-icon { font-size: 4rem; margin-bottom: 1rem; }
.customer-box h2 { margin-bottom: .5rem; }
.customer-box p { color: var(--muted); margin-bottom: 1.5rem; }
.parcel-details {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  text-align: left; margin-bottom: 1.5rem;
}
.parcel-details .pd-row {
  display: flex; gap: .5rem; margin-bottom: .5rem; font-size: .875rem;
}
.parcel-details .pd-row:last-child { margin-bottom: 0; }
.pd-label { color: var(--muted); min-width: 110px; font-size: .8rem; }
.pd-val   { font-weight: 600; }

/* ─── Rider delivery card ────────────────────── */
.delivery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.delivery-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  text-decoration: none; color: inherit;
  transition: border-color .15s, transform .15s;
  display: block;
}
.delivery-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.dc-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .875rem; }
.dc-code { font-family: 'JetBrains Mono', monospace; font-size: .8rem; color: var(--accent); font-weight: 500; }
.dc-customer { font-weight: 600; margin-bottom: .25rem; }
.dc-address  { font-size: .82rem; color: var(--muted); margin-bottom: .75rem; }
.dc-meta { display: flex; gap: .75rem; align-items: center; }
.dc-inline-icon { font-size: 1rem; vertical-align: text-bottom; margin-right: .2rem; }

/* ─── Proof image ────────────────────────────── */
.proof-img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }

/* ─── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Utilities ──────────────────────────────── */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.gap-1         { gap: .5rem; }
.gap-2         { gap: 1rem; }
.mt-1          { margin-top: .5rem; }
.mt-2          { margin-top: 1rem; }
.mb-2          { margin-bottom: 1rem; }
.text-muted    { color: var(--muted); }
.text-sm       { font-size: .82rem; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-accent   { color: var(--accent); }
.text-success  { color: var(--accent2); }
.text-danger   { color: var(--danger); }
.w-full        { width: 100%; }
.ml-auto       { margin-left: auto; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .nav-item { padding: .55rem .95rem; font-size: .86rem; }
  .sidebar-logo { padding: 1rem .95rem; }
  .page { padding: .75rem; }
}

@media (min-width: 769px) {
  .sidebar {
    width: 240px;
    transform: translateX(0);
  }
  .sidebar-overlay { display: none; }
  .main { margin-left: 240px; }
  .topbar { padding: .875rem 1.75rem; }
  .topbar-title { font-size: 1.1rem; }
  .page { padding: 1.25rem 1.4rem; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
  .card-header { padding: 1rem 1.25rem; }
  .card-body { padding: 1.25rem; }
  tbody td { padding: .875rem 1rem; font-size: .9rem; }

  body.sidebar-collapsed .sidebar { width: 72px; }
  body.sidebar-collapsed .main { margin-left: 72px; }
  body.sidebar-collapsed .sidebar-logo { justify-content: center; padding: .85rem .4rem; }
  body.sidebar-collapsed .sidebar-logo .logo-text,
  body.sidebar-collapsed .sidebar-logo .logo-sub,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .user-card > div,
  body.sidebar-collapsed .user-avatar,
  body.sidebar-collapsed .nav-badge { display: none; }
  body.sidebar-collapsed .nav-item {
    justify-content: center;
    gap: 0;
    padding: .6rem .35rem;
    font-size: 0;
    border-left-color: transparent;
  }
  body.sidebar-collapsed .nav-item .nav-icon { width: auto; font-size: 1.2rem; }
  body.sidebar-collapsed .sidebar-footer { padding: .75rem .35rem; }
  body.sidebar-collapsed .user-card { justify-content: center; }
  body.sidebar-collapsed .logout-link { margin-left: 0; font-size: 1rem; }
}

@media (min-width: 1100px) {
  .page { padding: 1.75rem; }
}
