/* ============================================================
   FleetBite Admin — Global Stylesheet
   Default: Light Mode | Toggle: Dark Mode
   ============================================================ */

/* ── LIGHT MODE (default) ── */
:root {
  --bg:        #f4f5f9;
  --surface:   #ffffff;
  --surface2:  #f0f1f5;
  --surface3:  #e4e6ed;
  --border:    rgba(0,0,0,0.08);
  --border2:   rgba(0,0,0,0.14);
  --accent:    #ff6b35;
  --accent2:   #ff9f1c;
  --accent-glow: rgba(255,107,53,0.12);
  --green:     #16a34a;
  --blue:      #2563eb;
  --purple:    #7c3aed;
  --red:       #dc2626;
  --yellow:    #ca8a04;
  --text:      #111827;
  --text2:     #6b7280;
  --text3:     #9ca3af;
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.10);
  --sidebar-w: 240px;
  --radius:    14px;
  --radius-sm: 8px;
  --topbar-h:  64px;
}

/* ── DARK MODE ── */
body.dark {
  --bg:        #0a0b0f;
  --surface:   #111318;
  --surface2:  #181b22;
  --surface3:  #1e2230;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --accent-glow: rgba(255,107,53,0.18);
  --green:     #22c55e;
  --blue:      #3b82f6;
  --purple:    #a855f7;
  --red:       #ef4444;
  --yellow:    #eab308;
  --text:      #f1f3f9;
  --text2:     #8b92a5;
  --text3:     #545d70;
  --shadow:    0 1px 4px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.5);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  transition: background .25s, color .25s;
}

a { color: inherit; text-decoration: none; }

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: background .25s, border-color .25s;
}

.sidebar-logo {
  padding: 20px 18px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.logo-text span { color: var(--accent); }

.nav-section { padding: 16px 10px 4px; }

.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  padding: 0 10px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  user-select: none;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.4;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.user-chip:hover { background: var(--surface3); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 11px; color: var(--text2); }

/* ── MAIN ── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
  transition: background .25s;
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}

.search-box {
  display: flex; align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 0 12px; gap: 8px;
  width: 220px;
  transition: border-color .2s;
}

.search-box:focus-within { border-color: var(--accent); }

.search-box input {
  background: none; border: none; outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 9px 0;
  flex: 1;
}

.search-box input::placeholder { color: var(--text3); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text2);
  transition: all .15s;
  position: relative;
}

.icon-btn:hover { background: var(--surface3); color: var(--text); }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ── CONTENT ── */
.content {
  padding: 26px;
  flex: 1;
  animation: fadeUp .3s ease;
}

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

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}

.page-header-left h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800;
  margin-bottom: 3px;
}

.page-header-left p { font-size: 13px; color: var(--text2); }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: background .25s;
}

.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px; font-weight: 700;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, background .25s;
  position: relative; overflow: hidden;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px;
}

.stat-icon.orange  { background: rgba(255,107,53,.12); }
.stat-icon.green   { background: rgba(22,163,74,.12); }
.stat-icon.blue    { background: rgba(37,99,235,.12); }
.stat-icon.purple  { background: rgba(124,58,237,.12); }

body.dark .stat-icon.green  { background: rgba(34,197,94,.15); }
body.dark .stat-icon.blue   { background: rgba(59,130,246,.15); }
body.dark .stat-icon.purple { background: rgba(168,85,247,.15); }

.stat-val {
  font-family: 'Syne', sans-serif;
  font-size: 26px; font-weight: 800;
  line-height: 1; margin-bottom: 4px;
}

.stat-label { font-size: 13px; color: var(--text2); margin-bottom: 8px; }

.stat-delta {
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 20px;
}

.stat-delta.up   { background: rgba(22,163,74,.1);  color: var(--green); }
.stat-delta.down { background: rgba(220,38,38,.08); color: var(--red);   }

body.dark .stat-delta.up   { background: rgba(34,197,94,.12); }
body.dark .stat-delta.down { background: rgba(239,68,68,.10); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}

.badge::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; }

.badge-delivered  { background:rgba(22,163,74,.1);  color:var(--green);  }
.badge-pending    { background:rgba(202,138,4,.1);  color:var(--yellow); }
.badge-cancelled  { background:rgba(220,38,38,.08); color:var(--red);    }
.badge-transit    { background:rgba(37,99,235,.1);  color:var(--blue);   }
.badge-preparing  { background:rgba(124,58,237,.1); color:var(--purple); }
.badge-active     { background:rgba(22,163,74,.1);  color:var(--green);  }
.badge-inactive   { background:rgba(202,138,4,.1);  color:var(--yellow); }

body.dark .badge-delivered  { background:rgba(34,197,94,.12);  }
body.dark .badge-transit    { background:rgba(59,130,246,.12); }
body.dark .badge-preparing  { background:rgba(168,85,247,.12); }
body.dark .badge-cancelled  { background:rgba(239,68,68,.10);  }

.order-id { font-family:'Syne',sans-serif; font-weight:700; color:var(--accent); }

/* ── BUTTONS ── */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { opacity: .86; }
.btn:active { transform: scale(.98); }

.btn-primary  { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-outline:hover { color: var(--text); border-color: var(--text2); }
.btn-danger   { background: rgba(220,38,38,.08); color: var(--red); border: 1px solid rgba(220,38,38,.2); }
.btn-success  { background: rgba(22,163,74,.1);  color: var(--green); border: 1px solid rgba(22,163,74,.25); }
.btn-sm       { padding: 6px 12px; font-size: 12px; }
.btn-icon     { padding: 7px; }

/* ── FORMS ── */
.form-group   { margin-bottom: 16px; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  margin-bottom: 7px;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea { resize: vertical; min-height: 90px; }
.form-select   { appearance: none; cursor: pointer; }

/* ── FILTERS ── */
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.filter-chip {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  transition: all .15s;
  text-decoration: none;
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── PAGINATION ── */
.pagination {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 0 0;
  font-size: 13px; color: var(--text2);
}

/* ── TOGGLE ── */
.toggle { position: relative; width: 40px; height: 22px; cursor: pointer; }
.toggle input { opacity:0; width:0; height:0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--surface3);
  border-radius: 11px;
  transition: background .2s;
}
.toggle-slider::before {
  content:'';
  position: absolute; left:3px; top:3px;
  width:16px; height:16px;
  border-radius:50%;
  background:#fff;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── ALERT ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

.alert-success { background: rgba(22,163,74,.1);  color: var(--green); border: 1px solid rgba(22,163,74,.25);  }
.alert-error   { background: rgba(220,38,38,.08); color: var(--red);   border: 1px solid rgba(220,38,38,.2);   }
.alert-info    { background: rgba(37,99,235,.08); color: var(--blue);  border: 1px solid rgba(37,99,235,.2);   }

/* ── BACK LINK ── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text2);
  margin-bottom: 18px; cursor: pointer;
  transition: color .15s;
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }

/* ── DETAIL GRID ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* ── PRODUCT CARD ── */
.product-img-box {
  height: 160px;
  background: var(--surface2);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
}

/* ── RATING ── */
.rating { color: var(--yellow); letter-spacing: 1px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text3);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--text2); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text3); }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ── MINI INFO ROW ── */
.info-row {
  display: flex; justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text2); }
.info-row .value { font-weight: 500; }

/* ── CUST AVATAR IN TABLE ── */
.cust-cell { display: flex; align-items: center; gap: 10px; }
.cust-name { font-weight: 600; font-size: 13px; }
.cust-email { font-size: 11px; color: var(--text2); }

/* ── COUPON CARD ── */
.coupon-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .15s;
}
.coupon-card:hover { transform: translateY(-2px); }
.coupon-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.coupon-discount { font-family:'Syne',sans-serif; font-size:26px; font-weight:800; color:var(--accent); }
.coupon-code { font-family:'Syne',sans-serif; font-size:18px; font-weight:800; letter-spacing:.08em; margin-bottom:4px; }
.coupon-desc { font-size:12px; color:var(--text2); margin-bottom:12px; }
.coupon-foot { display:flex; align-items:center; justify-content:space-between; font-size:12px; color:var(--text2); }

/* ── DASH GRID ── */
.dash-grid { display:grid; grid-template-columns:1.5fr 1fr; gap:16px; margin-bottom:20px; }

/* ── BAR CHART ── */
.chart-area {
  height:160px; display:flex; align-items:flex-end;
  gap:8px; padding-top:10px;
}
.bar-group { flex:1; display:flex; flex-direction:column; align-items:center; gap:5px; }
.bar {
  width:100%; border-radius:6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), rgba(255,107,53,.35));
  transition: opacity .15s; cursor:pointer;
}
.bar:hover { opacity:.75; }
.bar-label { font-size:10px; color:var(--text3); }

/* ── DONUT ── */
.donut-wrap { display:flex; align-items:center; gap:18px; }
.donut { position:relative; width:120px; height:120px; flex-shrink:0; }
.donut svg { transform:rotate(-90deg); }
.donut-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.donut-center-val { font-family:'Syne',sans-serif; font-size:22px; font-weight:800; }
.donut-center-label { font-size:10px; color:var(--text2); }
.legend-item { display:flex; align-items:center; gap:8px; font-size:12px; margin-bottom:7px; }
.legend-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }

/* ── ACTIVITY ── */
.activity-item { display:flex; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.activity-item:last-child { border-bottom:none; }
.activity-dot { width:8px; height:8px; border-radius:50%; margin-top:5px; flex-shrink:0; }
.activity-text { font-size:13px; line-height:1.5; }
.activity-time { font-size:11px; color:var(--text3); margin-top:2px; }

/* ── PROFILE ── */
.profile-grid { display:grid; grid-template-columns:290px 1fr; gap:20px; }
.profile-avatar-lg {
  width:88px; height:88px; border-radius:50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display:flex; align-items:center; justify-content:center;
  font-size:30px; font-weight:800; color:#fff;
  margin: 0 auto 14px;
  border:3px solid var(--accent-glow);
}
.profile-stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:18px; }
.p-stat { background:var(--surface2); border-radius:var(--radius-sm); padding:12px; text-align:center; }
.p-stat-val { font-family:'Syne',sans-serif; font-size:18px; font-weight:800; }
.p-stat-label { font-size:10px; color:var(--text2); margin-top:2px; }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh; display:flex; align-items:center; justify-content:center;
  background: var(--bg);
  margin-left: 0;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 24px;
  padding: 44px 48px;
  width: 440px; max-width: 95vw;
  box-shadow: var(--shadow-md);
}

.login-logo { display:flex; align-items:center; gap:12px; margin-bottom:28px; }
.login-title { font-family:'Syne',sans-serif; font-size:24px; font-weight:800; margin-bottom:6px; }
.login-sub { color:var(--text2); font-size:13px; margin-bottom:28px; }

/* ── MAP PLACEHOLDER ── */
.map-placeholder {
  background: var(--surface2);
  border-radius: var(--radius);
  height: 250px;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  border: 1px dashed var(--border2);
  color: var(--text3); font-size:14px; gap:8px;
}

/* ── RESPONSIVE ── */
@media (max-width:1100px) {
  .stats-grid { grid-template-columns:repeat(2,1fr); }
  .dash-grid  { grid-template-columns:1fr; }
  .profile-grid { grid-template-columns:1fr; }
  .detail-grid  { grid-template-columns:1fr; }
}

@media (max-width:768px) {
  #sidebar { transform: translateX(-100%); }
  #main { margin-left:0; }
  .stats-grid { grid-template-columns:1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns:1fr; }
}
