/* =========================================================
   Ojiosador Innovation Courier - Admin Dashboard Styles
   ========================================================= */

:root {
  --brand-navy: #0b3d91;
  --brand-navy-dark: #072a66;
  --brand-gold: #f2a900;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #f1f4f9;
  --card: #ffffff;
  --border: #e5e7eb;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  --font: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
}
a { text-decoration: none; color: inherit; }

/* ---------- Layout ---------- */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: var(--brand-navy-dark);
  color: #dce7ff;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.2s ease;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand .logo-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--brand-gold);
  color: var(--brand-navy-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.sidebar .brand strong { display: block; color: #fff; font-size: 15px; }
.sidebar .brand small { color: #9fb6e8; font-size: 11px; }

.sidebar nav { padding: 16px 10px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: #cddaf5;
  margin-bottom: 4px;
  font-weight: 500;
}
.sidebar nav a .ic { width: 20px; text-align: center; }
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: var(--brand-gold); color: var(--brand-navy-dark); font-weight: 700; }

.sidebar .side-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: #8fa8dd;
}

.main {
  margin-left: 250px;
  flex: 1;
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 19px; margin: 0; color: var(--brand-navy); }
.topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
}
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }

.page { padding: 26px 28px 60px; }

/* ---------- Cards / grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.stat-card .ic {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.stat-card .ic.navy { background: var(--brand-navy); }
.stat-card .ic.gold { background: var(--brand-gold); }
.stat-card .ic.green { background: var(--success); }
.stat-card .ic.blue { background: var(--info); }
.stat-card .num { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-card .lbl { font-size: 12.5px; color: var(--muted); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.card-head h3 { margin: 0; font-size: 16.5px; color: var(--brand-navy); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; border-radius: 8px;
  padding: 11px 18px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--brand-navy); color: #fff; }
.btn-gold { background: var(--brand-gold); color: var(--brand-navy-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--ink); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 6px; }
.btn-icon { padding: 8px 10px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 600; color: #374151; }
.form-group label .req { color: var(--danger); }
.form-control {
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  width: 100%;
  background: #fff;
}
.form-control:focus { border-color: var(--brand-navy); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-actions { display: flex; gap: 12px; margin-top: 6px; }
.help-text { font-size: 12px; color: var(--muted); }

.image-drop {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 13.5px;
  position: relative;
}
.image-drop img { max-height: 140px; margin: 0 auto 10px; border-radius: 8px; }
.image-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left; padding: 12px 14px;
  background: #f8fafc; color: var(--muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr:hover { background: #f9fafe; }
.thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: #f3f4f6; }
.tn-code { font-family: 'Courier New', monospace; font-weight: 700; color: var(--brand-navy); }

.badge {
  display: inline-block; padding: 5px 12px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; color: #fff; white-space: nowrap;
}
.status-delivered { background: var(--success); }
.status-transit { background: var(--info); }
.status-hold { background: var(--warn); }
.status-cleared { background: #0891b2; }
.status-returned { background: var(--danger); }
.status-outfordelivery { background: #7c3aed; }
.status-default { background: var(--brand-navy); }

.action-btns { display: flex; gap: 6px; }
.action-btns a, .action-btns button {
  width: 32px; height: 32px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-size: 14px;
}
.act-view { background: #e0e7ff; color: #3730a3; }
.act-edit { background: #fef3c7; color: #92400e; }
.act-delete { background: #fee2e2; color: #991b1b; }

.search-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.search-bar input, .search-bar select {
  padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13.5px;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 13px 18px; border-radius: 9px; font-size: 14px;
  margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #ecfdf3; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-dark) 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 400px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card .logo-mark {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px;
  background: var(--brand-gold); color: var(--brand-navy-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px;
}
.login-card h2 { text-align: center; margin: 0 0 4px; color: var(--brand-navy); }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 26px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 13px; margin-top: 8px; }

/* ---------- Detail view / QR ---------- */
.pkg-detail-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 760px) { .pkg-detail-layout { grid-template-columns: 1fr; } }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-grid .full { grid-column: 1 / -1; }
.detail-grid label { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.4px; margin-bottom: 4px; }
.detail-grid p { margin: 0 0 4px; font-weight: 600; font-size: 14px; }

.pkg-hero-img {
  width: 100%; max-height: 260px; object-fit: cover;
  border-radius: 10px; background: #f3f4f6; margin-bottom: 16px;
}

.qr-box { text-align: center; padding: 20px; border: 1px dashed var(--border); border-radius: 10px; }
.qr-box .tn-big { font-weight: 800; color: var(--brand-navy); letter-spacing: 1px; margin-top: 10px; }

/* Timeline (admin view) */
.timeline { position: relative; margin-left: 10px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-left: 34px; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: 0; top: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-navy); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--brand-navy);
}
.timeline-item:first-child .timeline-dot { background: var(--brand-gold); box-shadow: 0 0 0 2px var(--brand-gold); }
.timeline-item h5 { margin: 0 0 3px; font-size: 14px; }
.timeline-item .meta { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.timeline-item p { margin: 0; font-size: 13px; color: #374151; }

/* Modal (used for delete confirm) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border-radius: 12px; max-width: 420px; width: 100%; padding: 26px; }
.modal-box h3 { margin: 0 0 10px; }
.modal-box p { color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
}
