/* ============================================================
   SmartSync – Master Stylesheet
   Modern Logistics SaaS Dashboard
   ============================================================ */

/* ─── GOOGLE FONTS ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Brand Colors */
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #818cf8;
  --accent:        #06b6d4;
  --accent-dark:   #0891b2;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  /* Backgrounds */
  --bg-base:       #0f0f1a;
  --bg-surface:    #16162a;
  --bg-elevated:   #1e1e35;
  --bg-card:       #1a1a30;
  --bg-hover:      #22223a;
  --sidebar-bg:    #12121f;

  /* Text */
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  /* Borders */
  --border:        rgba(99, 102, 241, 0.15);
  --border-strong: rgba(99, 102, 241, 0.3);

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:  0 10px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.2);

  /* Sizing */
  --sidebar-width: 260px;
  --navbar-height: 64px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  transition: var(--transition);
  font-size: 0.9rem;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--bg-elevated); color: var(--text-primary); }

/* ─── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ─── TOAST NOTIFICATIONS ───────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 12px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  min-width: 280px; max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%); opacity: 0;
  transition: all 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-success { border-color: var(--success); box-shadow: 0 4px 20px rgba(16,185,129,0.2); }
.toast-error   { border-color: var(--danger);  box-shadow: 0 4px 20px rgba(239,68,68,0.2); }
.toast-warning { border-color: var(--warning); box-shadow: 0 4px 20px rgba(245,158,11,0.2); }
.toast-info    { border-color: var(--info);    box-shadow: 0 4px 20px rgba(59,130,246,0.2); }
.toast-icon { font-size: 1.1rem; }

/* ─── AUTH PAGES ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg-base);
  overflow: hidden;
}
.auth-visual {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center; padding: 60px;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a35 50%, #12122b 100%);
  position: relative; overflow: hidden;
}
.auth-visual::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(99,102,241,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 70%, rgba(6,182,212,0.1) 0%, transparent 50%);
}
.auth-visual-content { position: relative; z-index: 1; max-width: 480px; }
.auth-logo-large {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 48px;
}
.auth-logo-large .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 14px; display: flex; align-items: center;
  justify-content: center; font-size: 1.8rem;
  box-shadow: 0 8px 25px rgba(99,102,241,0.4);
}
.auth-logo-large .logo-text {
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-tagline {
  font-size: 2.2rem; font-weight: 700; line-height: 1.2;
  color: var(--text-primary); margin-bottom: 20px;
}
.auth-tagline span {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-sub { font-size: 1rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 40px; }
.auth-features { display: flex; flex-direction: column; gap: 14px; }
.auth-feature-item {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.9rem; color: var(--text-secondary);
}
.auth-feature-item .feat-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(99,102,241,0.15); display: flex;
  align-items: center; justify-content: center; font-size: 1rem;
  flex-shrink: 0;
}
/* Floating shapes */
.shape {
  position: absolute; border-radius: 50%;
  filter: blur(60px); pointer-events: none;
}
.shape-1 {
  width: 300px; height: 300px; top: -100px; left: -100px;
  background: rgba(99,102,241,0.12);
  animation: floatShape 8s ease-in-out infinite;
}
.shape-2 {
  width: 200px; height: 200px; bottom: 0; right: -50px;
  background: rgba(6,182,212,0.1);
  animation: floatShape 10s ease-in-out infinite reverse;
}
@keyframes floatShape {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-30px) scale(1.05); }
}

.auth-panel {
  width: 460px; min-width: 380px; padding: 48px 40px;
  display: flex; flex-direction: column; justify-content: center;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
}
.auth-panel-header { margin-bottom: 32px; }
.auth-panel-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.auth-panel-header p  { font-size: 0.9rem; color: var(--text-secondary); }

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-size: 0.825rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 8px; letter-spacing: 0.5px; text-transform: uppercase;
}
.input-wrapper { position: relative; }
.input-wrapper .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 1rem; pointer-events: none; z-index: 1;
}
.input-wrapper input { padding-left: 42px; }
.password-toggle {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; font-size: 1rem; color: var(--text-muted);
  transition: var(--transition); z-index: 1;
}
.password-toggle:hover { color: var(--primary); }

.form-error {
  display: none; font-size: 0.8rem; color: var(--danger);
  margin-top: 6px;
}
.form-group.has-error input { border-color: var(--danger); }
.form-group.has-error .form-error { display: block; }

.btn-primary {
  width: 100%; padding: 13px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; font-size: 0.95rem; font-weight: 600;
  border-radius: var(--radius-sm); border: none;
  transition: var(--transition); position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 15px rgba(99,102,241,0.4);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99,102,241,0.5);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0; transition: var(--transition);
}
.btn-primary:hover::before { opacity: 1; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0; color: var(--text-muted); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-switch {
  text-align: center; font-size: 0.875rem; color: var(--text-secondary);
  margin-top: 24px;
}
.auth-switch a { color: var(--primary-light); font-weight: 600; transition: var(--transition); }
.auth-switch a:hover { color: var(--primary); }

/* Spinner */
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── DASHBOARD LAYOUT ───────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: var(--transition);
  overflow-y: auto;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px; border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; box-shadow: 0 4px 15px rgba(99,102,241,0.35);
}
.logo-text { font-size: 1.3rem; font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-section-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 0 8px; margin-bottom: 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  transition: var(--transition); margin-bottom: 2px; cursor: pointer;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.08));
  color: var(--primary-light);
  border: 1px solid rgba(99,102,241,0.25);
  box-shadow: 0 2px 10px rgba(99,102,241,0.1);
}
.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto; padding: 2px 8px;
  background: var(--primary); color: white;
  border-radius: 99px; font-size: 0.7rem; font-weight: 700;
}

.sidebar-user {
  margin-top: auto; padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  background: var(--bg-hover);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; color: white; flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 0.825rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.user-email { font-size: 0.72rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#logout-btn {
  background: none; font-size: 1rem; color: var(--text-muted);
  padding: 4px; border-radius: 4px; transition: var(--transition);
}
#logout-btn:hover { color: var(--danger); }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--navbar-height); padding: 0 28px;
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
#menu-toggle {
  display: none; background: none; font-size: 1.3rem;
  color: var(--text-primary); padding: 6px; border-radius: 6px;
}
#menu-toggle:hover { background: var(--bg-hover); }
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; width: 260px;
}
.topbar-search input {
  background: none; border: none; padding: 0; font-size: 0.875rem; width: 100%;
}
.topbar-search input:focus { box-shadow: none; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-secondary);
  transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--primary-light); border-color: var(--border-strong); }

.content-area { padding: 28px; flex: 1; }

/* Page Sections */
.page-section { display: none; }
.page-section.active-section { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.section-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.section-header p  { font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px; }

/* ─── STAT CARDS ─────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  position: relative; overflow: hidden;
  transition: var(--transition); cursor: default;
}
.stat-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--card-glow, rgba(99,102,241,0.05)), transparent);
  opacity: 0; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.stat-card:hover::before { opacity: 1; }
.stat-card.blue  { --card-glow: rgba(99,102,241,0.12); }
.stat-card.cyan  { --card-glow: rgba(6,182,212,0.12); }
.stat-card.green { --card-glow: rgba(16,185,129,0.12); }
.stat-card.amber { --card-glow: rgba(245,158,11,0.12); }

.stat-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.stat-card.blue  .stat-icon { background: rgba(99,102,241,0.15); }
.stat-card.cyan  .stat-icon { background: rgba(6,182,212,0.15); }
.stat-card.green .stat-icon { background: rgba(16,185,129,0.15); }
.stat-card.amber .stat-icon { background: rgba(245,158,11,0.15); }

.stat-change {
  font-size: 0.75rem; font-weight: 600; padding: 3px 8px;
  border-radius: 99px; background: rgba(16,185,129,0.15); color: var(--success);
}
.stat-change.down { background: rgba(239,68,68,0.15); color: var(--danger); }
.stat-value {
  font-size: 2.2rem; font-weight: 800;
  color: var(--text-primary); line-height: 1; margin-bottom: 6px;
}
.stat-label { font-size: 0.825rem; color: var(--text-secondary); font-weight: 500; }

/* ─── CARD COMPONENT ─────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.card-header .card-action {
  font-size: 0.8rem; color: var(--primary-light); font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.card-header .card-action:hover { color: var(--primary); }

/* Dashboard Grid */
.dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ─── SHIPMENT CARDS ─────────────────────────────────────── */
.shipments-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.shipment-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: var(--transition); cursor: pointer;
  position: relative; overflow: hidden;
}
.shipment-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
  border-radius: 3px 0 0 3px;
}
.shipment-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.shipment-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tracking-id { font-size: 0.875rem; font-weight: 700; color: var(--primary-light);
  font-family: 'JetBrains Mono', monospace; }
.status-badge {
  font-size: 0.72rem; font-weight: 700; padding: 4px 10px;
  border-radius: 99px; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-order-placed    { background: rgba(99,102,241,0.15);  color: var(--primary-light); }
.status-picked-up       { background: rgba(245,158,11,0.15);  color: var(--warning); }
.status-in-transit      { background: rgba(6,182,212,0.15);   color: var(--accent); }
.status-out-for-delivery{ background: rgba(59,130,246,0.15);  color: var(--info); }
.status-delivered       { background: rgba(16,185,129,0.15);  color: var(--success); }

.route-info {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 12px; font-size: 0.825rem;
  flex-wrap: wrap; gap: 6px;
}
.location { display: flex; align-items: center; gap: 4px; color: var(--text-secondary); }
.location i { font-style: normal; }
.route-arrow { color: var(--text-muted); font-weight: 600; }
.shipment-meta { display: flex; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; }
.shipment-meta span { display: flex; align-items: center; gap: 4px; }
.shipment-card-footer { display: flex; gap: 8px; }
.btn-sm {
  padding: 7px 14px; font-size: 0.8rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid; transition: var(--transition);
}
.btn-track { background: rgba(99,102,241,0.15); color: var(--primary-light); border-color: rgba(99,102,241,0.3); }
.btn-track:hover { background: rgba(99,102,241,0.3); }
.btn-route { background: rgba(6,182,212,0.15); color: var(--accent); border-color: rgba(6,182,212,0.3); }
.btn-route:hover { background: rgba(6,182,212,0.3); }

/* ─── FORM CARD ──────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .full-width { grid-column: 1 / -1; }
.btn-action {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; font-size: 0.9rem; font-weight: 600;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.btn-primary-action {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; box-shadow: 0 4px 15px rgba(99,102,241,0.35);
}
.btn-primary-action:hover:not(:disabled) {
  transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99,102,241,0.5);
}
.btn-primary-action:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── TRACKING MODAL ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: var(--transition); padding: 20px;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); padding: 32px; max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: scale(0.9) translateY(20px); transition: var(--transition);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px;
}
.modal-header h2 { font-size: 1.25rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-hover); color: var(--text-muted); font-size: 1.1rem;
  transition: var(--transition); display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--danger); }

.tracking-info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px;
}
.tracking-info-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
}
.tracking-info-item .ti-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600; margin-bottom: 4px; }
.tracking-info-item .ti-value { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }

/* Tracking Steps */
.tracking-steps { display: flex; flex-direction: column; gap: 0; }
.tracking-step {
  display: flex; align-items: flex-start; gap: 16px;
  position: relative; padding-bottom: 24px;
}
.tracking-step:last-child { padding-bottom: 0; }
.step-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  background: var(--bg-card); border: 2px solid var(--border);
  flex-shrink: 0; position: relative; z-index: 1; transition: var(--transition);
}
.tracking-step.done .step-icon  { background: rgba(16,185,129,0.15); border-color: var(--success); }
.tracking-step.active .step-icon{ background: rgba(99,102,241,0.2);  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99,102,241,0.4);
  animation: pulse-ring 2s ease-in-out infinite; }
@keyframes pulse-ring {
  0%,100% { box-shadow: 0 0 15px rgba(99,102,241,0.4); }
  50%      { box-shadow: 0 0 30px rgba(99,102,241,0.7); }
}
.step-connector {
  position: absolute; left: 22px; top: 44px; bottom: 0;
  width: 2px; background: var(--border);
}
.tracking-step.done .step-connector { background: var(--success); }
.step-info { flex: 1; padding-top: 8px; }
.step-label {
  font-size: 0.9rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: 2px;
}
.tracking-step.done .step-label  { color: var(--success); }
.tracking-step.active .step-label { color: var(--primary-light); }
.step-desc { font-size: 0.8rem; color: var(--text-muted); }

.modal-actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn-advance {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; font-size: 0.875rem; font-weight: 600;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; box-shadow: 0 4px 15px rgba(99,102,241,0.35);
  transition: var(--transition);
}
.btn-advance:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99,102,241,0.5); }

/* ─── ROUTE PLANNING ─────────────────────────────────────── */
.route-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; }
@media (max-width: 900px) { .route-layout { grid-template-columns: 1fr; } }
.route-map-container {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; min-height: 420px;
  position: relative;
}
.route-map-container iframe {
  width: 100%; height: 100%; min-height: 420px; border: none; filter: invert(0.9) hue-rotate(180deg);
}
.map-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 420px; color: var(--text-muted); gap: 12px;
}
.map-placeholder .map-icon { font-size: 3rem; }
.route-result { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.route-result-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--bg-elevated);
  border-radius: var(--radius-sm); font-size: 0.875rem;
}
.ri-label { color: var(--text-muted); font-size: 0.8rem; }

/* ─── CALENDAR / BOOKINGS ────────────────────────────────── */
.booking-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .booking-layout { grid-template-columns: 1fr; } }

.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.cal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.cal-nav {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-elevated); color: var(--text-primary); font-size: 1.2rem;
  transition: var(--transition); display: flex; align-items: center; justify-content: center;
}
.cal-nav:hover { background: var(--bg-hover); color: var(--primary-light); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-day-name {
  text-align: center; font-size: 0.72rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; padding: 6px 0;
}
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.825rem; border-radius: 8px; transition: var(--transition);
  cursor: pointer;
}
.cal-day.empty { cursor: default; }
.cal-day.past  { color: var(--text-muted); cursor: default; opacity: 0.4; }
.cal-day.today { background: rgba(99,102,241,0.2); color: var(--primary-light); font-weight: 700; }
.cal-day.available:hover { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.cal-day.selected { background: var(--primary); color: white; font-weight: 700;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.cal-day.booked { background: rgba(16,185,129,0.1); color: var(--success); cursor: default; }

#selected-date-display {
  margin: 16px 0 12px;
  font-size: 0.875rem; font-weight: 600; color: var(--primary-light);
}
.slots-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.slot-btn {
  padding: 10px; border-radius: var(--radius-sm);
  font-size: 0.825rem; font-weight: 600; transition: var(--transition);
}
.slot-available {
  background: rgba(16,185,129,0.1); color: var(--success);
  border: 1px solid rgba(16,185,129,0.3);
}
.slot-available:hover { background: rgba(16,185,129,0.25); }
.slot-booked { background: var(--bg-elevated); color: var(--text-muted);
  border: 1px solid var(--border); cursor: not-allowed; }

.booking-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); margin-bottom: 8px;
  border: 1px solid var(--border); transition: var(--transition);
}
.booking-item:hover { border-color: var(--border-strong); }
.booking-icon { font-size: 1.4rem; }
.booking-info { flex: 1; }
.booking-title { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.booking-sub   { display: block; font-size: 0.78rem; color: var(--text-muted); }
.booking-badge {
  font-size: 0.72rem; font-weight: 700; padding: 3px 8px;
  background: rgba(16,185,129,0.15); color: var(--success);
  border-radius: 99px;
}

/* ─── CHAT ───────────────────────────────────────────────── */
.chat-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 20px;
  height: calc(100vh - var(--navbar-height) - 56px - 80px);
  min-height: 500px;
}
@media (max-width: 800px) { .chat-layout { grid-template-columns: 1fr; } }

.chat-contacts {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow-y: auto;
}
.chat-contacts-header { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-contacts-header h3 { font-size: 0.9rem; font-weight: 700; }
.contact-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; transition: var(--transition);
}
.contact-item:hover { background: var(--bg-hover); }
.contact-item.active { background: rgba(99,102,241,0.1); }
.contact-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  position: relative; flex-shrink: 0;
}
.contact-online {
  position: absolute; bottom: 1px; right: 1px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg-card);
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.contact-status { font-size: 0.75rem; color: var(--success); }

.chat-window {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden;
}
.chat-topbar {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.chat-topbar .chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.chat-topbar-info .chat-name { font-size: 0.9rem; font-weight: 700; }
.chat-topbar-info .chat-status { font-size: 0.75rem; color: var(--success); }

.chat-body {
  flex: 1; padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 70%; }
.chat-user { align-self: flex-end; align-items: flex-end; }
.chat-bot  { align-self: flex-start; }
.chat-bubble {
  padding: 12px 16px; border-radius: 16px;
  font-size: 0.875rem; line-height: 1.5; word-break: break-word;
}
.chat-user .chat-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border-bottom-right-radius: 4px;
}
.chat-bot .chat-bubble {
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* Typing indicator */
.typing-indicator .chat-bubble { padding: 14px 20px; }
.typing-indicator span {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted); margin: 0 2px;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.chat-input-area {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}
.chat-input-area input { flex: 1; }
.btn-send {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; font-size: 1.1rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.btn-send:hover { transform: scale(1.05); box-shadow: 0 6px 18px rgba(99,102,241,0.5); }

/* ─── RECENT ACTIVITY ────────────────────────────────────── */
.recent-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { opacity: 0.85; }
.recent-icon { font-size: 1.3rem; }
.recent-info { flex: 1; }
.recent-title { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.recent-sub   { display: block; font-size: 0.78rem; color: var(--text-muted); }
.recent-status { font-size: 0.75rem; color: var(--primary-light); font-weight: 600;
  white-space: nowrap; }

/* ─── EMPTY STATES ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state.small { padding: 24px; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; }

/* ─── SIDEBAR OVERLAY ────────────────────────────────────── */
#sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
}
#sidebar-overlay.show { display: block; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  #menu-toggle { display: flex; }
  .auth-visual { display: none; }
  .auth-panel { width: 100%; min-width: unset; padding: 32px 24px; }
  .topbar-search { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .shipments-grid { grid-template-columns: 1fr; }
  .tracking-info-grid { grid-template-columns: 1fr; }
  .booking-layout { grid-template-columns: 1fr; }
  .chat-layout { height: auto; }
  .chat-contacts { display: none; }
  .content-area { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.8rem; }
  #toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: unset; width: 100%; }
}

/* ─── UTILITY ────────────────────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ─── ANIMATED BACKGROUND GRID ──────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
