/* ═══════════════════════════════════════════════
   GREEN EXPRESS — ADMIN PANEL STYLESHEET
   admin.css
═══════════════════════════════════════════════ */

:root {
  --green:       #1a7a3c;
  --green-dark:  #0f5228;
  --green-mid:   #2a9d52;
  --green-light: #e8f5ed;
  --accent:      #f0a500;
  --text:        #1a1f1c;
  --muted:       #6b7280;
  --border:      #e5e7eb;
  --bg:          #f3f4f6;
  --white:       #ffffff;
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ── Login page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  padding: 1rem;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--green-dark);
}
.login-logo-icon {
  width: 42px; height: 42px;
  background: var(--green);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 22px; height: 22px; fill: white; }
.login-title { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.login-sub   { font-size: .875rem; color: var(--muted); margin-bottom: 2rem; }
.form-group  { margin-bottom: 1.1rem; }
.form-label  { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .4rem; color: var(--text); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit; font-size: .875rem;
  color: var(--text); background: var(--white);
  outline: none; transition: border-color .2s;
  -webkit-appearance: none; appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,122,60,.08);
}
.form-textarea { resize: vertical; min-height: 100px; }
.alert {
  padding: .85rem 1rem; border-radius: 8px;
  font-size: .875rem; font-weight: 500; margin-bottom: 1.2rem;
}
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light); color: var(--green-dark); border: 1px solid #86efac; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .65rem 1.25rem; border: none; border-radius: 8px;
  font-family: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; fill: currentColor; }
.btn-primary   { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--white); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger    { background: #fef2f2; color: #b91c1c; border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.btn-accent    { background: var(--accent); color: white; }
.btn-accent:hover { background: #d4920a; }
.btn-sm { padding: .4rem .85rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--green-dark);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 199;
}
.sidebar-overlay.show { display: block; }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo { display: flex; align-items: center; gap: .65rem; }
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--green-mid); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; min-width: 36px;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; fill: white; }
.sidebar-logo-name { font-weight: 800; font-size: .95rem; color: white; line-height: 1.2; }
.sidebar-logo-sub  { font-size: .68rem; color: rgba(255,255,255,.5); }
.sidebar-close {
  display: none; background: none; border: none; color: rgba(255,255,255,.6);
  font-size: 1.1rem; cursor: pointer; padding: .25rem;
}
.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 1rem .75rem;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-section-label {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.35); font-weight: 700;
  padding: .5rem .5rem .25rem; margin-bottom: .25rem;
}
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem; border-radius: 8px;
  color: rgba(255,255,255,.72); font-size: .875rem; font-weight: 500;
  transition: all .18s; margin-bottom: 2px; position: relative;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; min-width: 18px; }
.nav-item:hover { background: rgba(255,255,255,.1); color: white; }
.nav-item.active { background: var(--green-mid); color: white; font-weight: 600; }
.nav-badge {
  margin-left: auto; background: #ef4444;
  color: white; font-size: .65rem; font-weight: 700;
  padding: .1rem .4rem; border-radius: 50px; min-width: 18px; text-align: center;
  display: none;
}
.nav-badge.show { display: inline-block; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-admin-info { flex: 1; display: flex; align-items: center; gap: .6rem; min-width: 0; }
.sidebar-avatar {
  width: 32px; height: 32px; min-width: 32px;
  background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .875rem; color: white;
}
.sidebar-admin-name { font-size: .82rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-admin-role { font-size: .68rem; color: rgba(255,255,255,.5); }
.sidebar-logout {
  color: rgba(255,255,255,.5); transition: color .18s;
  display: flex; align-items: center;
}
.sidebar-logout:hover { color: #ef4444; }
.sidebar-logout svg { width: 18px; height: 18px; fill: currentColor; }

/* ── Main wrapper & topbar ─────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  box-shadow: var(--shadow);
}
.topbar-hamburger {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: none; padding: .25rem; cursor: pointer;
}
.topbar-hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
}
.topbar-title { font-weight: 700; font-size: 1rem; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-link {
  font-size: .8rem; font-weight: 500; color: var(--muted);
  display: flex; align-items: center; gap: .3rem;
  transition: color .18s;
}
.topbar-link:hover { color: var(--green); }
.topbar-logout:hover { color: #b91c1c; }
.page-main { flex: 1; padding: 1.75rem; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: .75rem;
}
.card-title { font-weight: 700; font-size: .95rem; }
.card-body { padding: 1.4rem; }

/* ── Stat cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.4rem;
  display: flex; align-items: flex-start; gap: 1rem;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; min-width: 44px;
}
.stat-icon svg { width: 22px; height: 22px; fill: white; }
.stat-icon.green  { background: var(--green); }
.stat-icon.amber  { background: var(--accent); }
.stat-icon.blue   { background: #3b82f6; }
.stat-icon.purple { background: #8b5cf6; }
.stat-icon.red    { background: #ef4444; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; margin-bottom: .2rem; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.stat-trend { font-size: .75rem; margin-top: .4rem; font-weight: 600; }
.stat-trend.up   { color: var(--green); }
.stat-trend.down { color: #ef4444; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: .875rem;
}
th {
  text-align: left; padding: .75rem 1rem;
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  background: var(--bg); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: .85rem 1rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.td-ref { font-family: monospace; font-weight: 700; font-size: .8rem; color: var(--green); }
.td-name { font-weight: 600; }
.td-muted { color: var(--muted); font-size: .8rem; }
.td-actions { display: flex; align-items: center; gap: .4rem; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .7rem; border-radius: 50px;
  font-size: .72rem; font-weight: 700;
  white-space: nowrap;
}
.badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* ── Filters bar ───────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap; margin-bottom: 1.1rem;
}
.search-box {
  position: relative; flex: 1; min-width: 200px;
}
.search-box svg {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; fill: var(--muted);
}
.search-box input {
  width: 100%; padding: .6rem .75rem .6rem 2.25rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: .875rem;
  outline: none; transition: border-color .2s;
}
.search-box input:focus { border-color: var(--green); }
.filter-select {
  padding: .6rem .75rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: .875rem;
  background: var(--white); outline: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center; background-size: 18px;
}
.filter-select:focus { border-color: var(--green); }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.4rem; border-top: 1px solid var(--border);
  flex-wrap: wrap; gap: .75rem;
}
.pagination-info { font-size: .8rem; color: var(--muted); }
.pagination-btns { display: flex; gap: .4rem; }
.pg-btn {
  padding: .4rem .75rem; border: 1.5px solid var(--border);
  border-radius: 6px; background: var(--white);
  font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.pg-btn:hover    { border-color: var(--green); color: var(--green); }
.pg-btn.active   { background: var(--green); border-color: var(--green); color: white; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 500;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--white); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 820px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--white); z-index: 1;
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none; border: none; font-size: 1.3rem;
  color: var(--muted); cursor: pointer; line-height: 1;
  padding: .2rem;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: .75rem;
  padding: 1.1rem 1.5rem; border-top: 1px solid var(--border);
}

/* ── Detail rows in modal ──────────────────────────────────── */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-bottom: 1.25rem;
}
.detail-item label {
  display: block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: .25rem;
}
.detail-item .val {
  font-size: .9rem; font-weight: 500; word-break: break-word;
}
.detail-section {
  padding-top: 1.1rem; margin-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.detail-section-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: .85rem;
}

/* ── Tracking timeline ─────────────────────────────────────── */
.tracking-timeline { position: relative; padding-left: 1.75rem; }
.tracking-timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 0;
  width: 2px; background: var(--border);
}
.track-event {
  position: relative; padding-bottom: 1.25rem;
}
.track-event:last-child { padding-bottom: 0; }
.track-dot {
  position: absolute; left: -1.75rem; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); border: 2px solid white;
  box-shadow: 0 0 0 2px var(--green);
}
.track-dot.past { background: var(--border); box-shadow: 0 0 0 2px var(--border); }
.track-status { font-weight: 700; font-size: .875rem; margin-bottom: .15rem; }
.track-meta   { font-size: .78rem; color: var(--muted); }
.track-note   { font-size: .82rem; color: var(--text); margin-top: .25rem; background: var(--bg); padding: .4rem .6rem; border-radius: 6px; }

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.page-header-left h1 { font-size: 1.35rem; font-weight: 800; }
.page-header-left p  { font-size: .875rem; color: var(--muted); margin-top: .2rem; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3.5rem 1rem; color: var(--muted);
}
.empty-state svg { width: 48px; height: 48px; fill: var(--border); margin-bottom: 1rem; }
.empty-state p   { font-size: .9rem; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem; z-index: 1000;
}
.toast {
  background: var(--text); color: white;
  padding: .75rem 1.1rem; border-radius: 10px;
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: .5rem;
  animation: toastIn .25s ease;
  max-width: 320px;
}
.toast.success { background: var(--green); }
.toast.error   { background: #b91c1c; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ── Misc utils ────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-green  { color: var(--green); }
.text-red    { color: #b91c1c; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.mt-1        { margin-top: .5rem; }
.mt-2        { margin-top: 1rem; }
.mb-2        { margin-bottom: 1rem; }
.gap-2       { gap: 1rem; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.w-full      { width: 100%; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-close { display: block; }
  .main-wrapper  { margin-left: 0; }
  .topbar-hamburger { display: flex; }
  .page-main { padding: 1.1rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .modal { border-radius: 16px 16px 0 0; align-self: flex-end; max-height: 85vh; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
}

@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-value { font-size: 1.4rem; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
}
