/* ============================================================
   TRANSPORT MANAGEMENT SYSTEM — style.css
   Modern Glassmorphism UI | Dark/Light Mode | Responsive
   ============================================================ */

/* ---- CSS CUSTOM PROPERTIES ---- */
:root {
  /* Colors */
  --blue:    #3b82f6;
  --indigo:  #6366f1;
  --purple:  #8b5cf6;
  --green:   #22c55e;
  --yellow:  #eab308;
  --orange:  #f97316;
  --red:     #ef4444;
  --teal:    #14b8a6;

  /* Spacing */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap:    16px;
  --gap-lg: 24px;
  --gap-xl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow:    0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h:  64px;

  /* Aliases used by the admin panel UI */
  --primary:   var(--indigo);
  --surface:   var(--bg-elevated);
  --radius-md: var(--radius-sm);
}

/* ---- DARK THEME (default) ---- */
[data-theme="dark"] {
  --bg-base:        #0a0e1a;
  --bg-surface:     #111827;
  --bg-elevated:    #1a2235;
  --bg-hover:       #1e2d45;

  --glass-bg:       rgba(17, 24, 39, 0.75);
  --glass-border:   rgba(255, 255, 255, 0.08);
  --glass-blur:     20px;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #0f172a;

  --border:         rgba(255, 255, 255, 0.08);
  --border-hover:   rgba(255, 255, 255, 0.15);

  --input-bg:       rgba(255, 255, 255, 0.05);
  --input-border:   rgba(255, 255, 255, 0.12);
  --input-focus:    rgba(99, 102, 241, 0.5);

  --sidebar-bg:     rgba(10, 14, 26, 0.95);
  --topbar-bg:      rgba(17, 24, 39, 0.85);

  --scrollbar-bg:   #1a2235;
  --scrollbar-thumb: #2d3f5e;
}

/* ---- LIGHT THEME ---- */
[data-theme="light"] {
  --bg-base:        #f0f4f8;
  --bg-surface:     #ffffff;
  --bg-elevated:    #f8fafc;
  --bg-hover:       #e8f0fe;

  --glass-bg:       rgba(255, 255, 255, 0.75);
  --glass-border:   rgba(0, 0, 0, 0.08);
  --glass-blur:     20px;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #f1f5f9;

  --border:         rgba(0, 0, 0, 0.08);
  --border-hover:   rgba(0, 0, 0, 0.15);

  --input-bg:       rgba(0, 0, 0, 0.03);
  --input-border:   rgba(0, 0, 0, 0.12);
  --input-focus:    rgba(99, 102, 241, 0.35);

  --sidebar-bg:     rgba(255, 255, 255, 0.97);
  --topbar-bg:      rgba(255, 255, 255, 0.85);

  --scrollbar-bg:   #e2e8f0;
  --scrollbar-thumb: #94a3b8;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-slow), color var(--transition-slow);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--indigo); }

/* Links */
a { text-decoration: none; color: inherit; }

/* Images */
img { max-width: 100%; display: block; }

/* ---- UTILITY ---- */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.required { color: var(--red); }

/* ---- GLASS CARD ---- */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-hover); }

.btn-danger {
  background: linear-gradient(135deg, var(--red), #dc2626);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239,68,68,0.4); }

.btn-icon {
  padding: 9px;
  background: var(--input-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon-danger:hover { background: rgba(239,68,68,0.1); color: var(--red); border-color: rgba(239,68,68,0.3); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; color: var(--indigo); padding: 4px 8px; font-size: 0.8rem; }
.btn-link:hover { text-decoration: underline; }

.btn-spinner { display: inline-flex; }

/* ---- FORM ELEMENTS ---- */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input, .form-select, .form-textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--input-focus);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.error { border-color: var(--red); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  cursor: pointer;
}
.form-select option { background: var(--bg-surface); color: var(--text-primary); }

.field-error { font-size: 0.78rem; color: var(--red); min-height: 1.1em; }
.field-hint { font-size: 0.78rem; color: var(--text-muted); }
.char-count { font-size: 0.75rem; color: var(--text-muted); text-align: right; }

.input-wrapper { position: relative; }
.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.input-wrapper .form-input { padding-left: 38px; }
.input-suffix-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}
.input-suffix-btn:hover { color: var(--green); }
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.form-section { margin-bottom: var(--gap-lg); }
.form-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--indigo);
  margin-bottom: var(--gap);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-grid { display: grid; gap: var(--gap); }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-full { grid-column: 1 / -1; }

.select-sm { padding: 7px 28px 7px 10px; font-size: 0.82rem; }

/* ---- TOAST ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  pointer-events: auto;
  animation: slideInToast 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.toast.removing { animation: slideOutToast 0.25s ease forwards; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--yellow); }
.toast.info .toast-icon { color: var(--blue); }
.toast-msg { flex: 1; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 4px; }
.toast-close:hover { color: var(--text-primary); }

@keyframes slideInToast {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}
@keyframes slideOutToast {
  from { transform: translateX(0);   opacity: 1; }
  to   { transform: translateX(110%); opacity: 0; }
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg-orbs { position: absolute; inset: 0; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: floatOrb 8s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: var(--indigo); top: -100px; left: -100px; animation-delay: 0s; }
.orb-2 { width: 300px; height: 300px; background: var(--blue);   bottom: -50px; right: -50px; animation-delay: 2s; }
.orb-3 { width: 250px; height: 250px; background: var(--purple); top: 50%; left: 60%; animation-delay: 4s; }

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(20px, -20px) scale(1.05); }
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: var(--gap-xl);
  position: relative;
  z-index: 1;
  animation: fadeInScale 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.login-logo { text-align: center; margin-bottom: var(--gap-lg); }
.logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff;
  margin: 0 auto var(--gap);
  box-shadow: 0 8px 24px rgba(99,102,241,0.4);
}
.logo-icon.small { width: 36px; height: 36px; font-size: 1rem; border-radius: var(--radius-sm); }
.login-title { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.login-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.login-footer { margin-top: var(--gap); text-align: center; }

.theme-toggle-login {
  position: fixed;
  top: 20px; right: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
  z-index: 10;
}
.theme-toggle-login:hover { background: var(--bg-hover); }

/* ---- APP LAYOUT ---- */
.app { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: var(--gap);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.sidebar-close { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }

.sidebar-nav { flex: 1; padding: var(--gap) 0; overflow-y: auto; }
.nav-section { margin-bottom: var(--gap); }
.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px var(--gap);
  margin-bottom: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--gap);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: rgba(99,102,241,0.12);
  color: var(--indigo);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--indigo);
  border-radius: 0 2px 2px 0;
}
.nav-icon { width: 18px; text-align: center; font-size: 0.95rem; }
.nav-badge {
  margin-left: auto;
  background: var(--indigo);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}
.nav-badge.fav { background: var(--yellow); color: #000; }

.sidebar-footer {
  padding: var(--gap);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: #fff; flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.user-role { font-size: 0.72rem; color: var(--text-muted); display: block; }

/* ---- SIDEBAR OVERLAY ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ---- MAIN WRAPPER ---- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0 var(--gap-lg);
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar-center { flex: 1; max-width: 480px; margin: 0 auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.sidebar-toggle { display: none; }

.breadcrumb { font-size: 0.85rem; color: var(--text-secondary); }
.breadcrumb i { margin-right: 6px; color: var(--indigo); }

/* Global Search */
.global-search-wrapper {
  position: relative;
  width: 100%;
}
.global-search {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 9px 80px 9px 38px;
  transition: all var(--transition);
}
.global-search:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--input-focus); }
.global-search::placeholder { color: var(--text-muted); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.85rem; pointer-events: none; }
.search-shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  pointer-events: none;
}

/* Search Suggestions Dropdown */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.search-suggestions.show { display: block; }
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.875rem;
}
.suggestion-item:hover, .suggestion-item.active-suggestion { background: var(--bg-hover); }
.suggestion-item i { color: var(--indigo); width: 16px; text-align: center; }
.suggestion-item .suggestion-name { font-weight: 500; }
.suggestion-item .suggestion-sub { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }
.suggestion-no-results { padding: 12px 14px; color: var(--text-muted); font-size: 0.875rem; text-align: center; }

/* ---- PAGE CONTENT ---- */
.page-content { flex: 1; padding: var(--gap-lg); }

.view { display: none; }
.view.active { display: block; animation: fadeInView 0.3s ease; }
@keyframes fadeInView {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--gap-lg);
  gap: var(--gap);
}
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---- DASHBOARD ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap-lg);
}

.stat-card {
  padding: var(--gap-lg);
  display: flex;
  align-items: center;
  gap: var(--gap);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
  flex-shrink: 0;
}
.bg-blue   { background: linear-gradient(135deg, var(--blue),   #1d4ed8); }
.bg-yellow { background: linear-gradient(135deg, var(--yellow), #d97706); }
.bg-green  { background: linear-gradient(135deg, var(--green),  #15803d); }
.bg-purple { background: linear-gradient(135deg, var(--purple), #7c3aed); }

.stat-info { flex: 1; }
.stat-value { display: block; font-size: 1.8rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; display: block; }
.stat-trend { font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--green); }

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.dashboard-card { padding: var(--gap-lg); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--gap); }
.card-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--indigo); }

/* Recent list */
.recent-list, .fav-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item, .fav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  cursor: pointer;
  transition: background var(--transition);
}
.recent-item:hover, .fav-item:hover { background: var(--bg-hover); }
.item-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub  { font-size: 0.75rem; color: var(--text-muted); }

/* State Chart */
.state-bar-item { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.state-bar-label { font-size: 0.78rem; color: var(--text-secondary); width: 120px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-bar-track { flex: 1; height: 8px; background: var(--input-bg); border-radius: 4px; overflow: hidden; }
.state-bar-fill { height: 100%; background: linear-gradient(90deg, var(--indigo), var(--blue)); border-radius: 4px; transition: width 0.5s ease; }
.state-bar-count { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); width: 24px; text-align: right; flex-shrink: 0; }

/* Quick Actions */
.quick-actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-sm); }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: var(--gap);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.quick-action-btn i { font-size: 1.3rem; color: var(--indigo); }
.quick-action-btn:hover { background: rgba(99,102,241,0.08); color: var(--indigo); border-color: rgba(99,102,241,0.3); transform: translateY(-2px); }

/* ---- CONTROLS BAR ---- */
.controls-bar {
  display: flex;
  gap: var(--gap);
  padding: var(--gap);
  margin-bottom: var(--gap);
  align-items: center;
  flex-wrap: wrap;
}
.controls-left { flex: 1; min-width: 200px; }
.controls-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search-box { position: relative; }
.search-icon-sm {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}
.search-input { padding-left: 32px !important; }
.clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}
.clear-search:hover { color: var(--red); }

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}
.view-btn.active, .view-btn[aria-pressed="true"] {
  background: var(--indigo);
  color: #fff;
}
.view-btn:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }

/* Results info */
.results-info {
  display: flex;
  align-items: center;
  gap: var(--gap);
  margin-bottom: var(--gap);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tag {
  background: rgba(99,102,241,0.12);
  color: var(--indigo);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.filter-tag:hover { background: rgba(99,102,241,0.2); }
.filter-tag i { font-size: 0.65rem; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 100;
  display: none;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}
.dropdown-menu.open { display: block; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: none; border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item i { color: var(--indigo); width: 16px; }

/* ---- TRANSPORTER CARDS ---- */
.transporters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.transporter-card {
  padding: var(--gap-lg);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  animation: cardIn 0.3s ease;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.transporter-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--gap);
}
.card-avatar {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.card-badges { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.badge-fav { background: rgba(234,179,8,0.15); color: var(--yellow); border: 1px solid rgba(234,179,8,0.3); }

.card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}
.card-gst {
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--indigo);
  background: rgba(99,102,241,0.1);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: var(--gap-sm);
}
.card-location { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; color: var(--text-muted); margin-bottom: var(--gap-sm); }
.card-location i { color: var(--indigo); font-size: 0.75rem; }

.card-divider { height: 1px; background: var(--border); margin: var(--gap-sm) 0; }

.card-contact-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 0.8rem; color: var(--text-secondary); }
.card-contact-row i { width: 14px; color: var(--text-muted); font-size: 0.75rem; }

.card-actions {
  display: flex;
  gap: 6px;
  margin-top: var(--gap);
  flex-wrap: wrap;
}
.card-action-btn {
  flex: 1;
  min-width: 0;
  padding: 7px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-family: inherit;
}
.card-action-btn:hover { background: rgba(99,102,241,0.08); color: var(--indigo); border-color: rgba(99,102,241,0.2); }
.card-action-btn.danger:hover { background: rgba(239,68,68,0.08); color: var(--red); border-color: rgba(239,68,68,0.2); }
.card-action-btn.fav-active { color: var(--yellow); border-color: rgba(234,179,8,0.3); background: rgba(234,179,8,0.08); }

/* Skeleton */
.skeleton-card {
  height: 260px;
  animation: shimmer 1.5s infinite;
}
.skeleton-list { display: flex; flex-direction: column; gap: 10px; }
.skeleton-item {
  height: 60px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-card, .skeleton-item {
  background: linear-gradient(90deg, var(--input-bg) 25%, var(--bg-hover) 50%, var(--input-bg) 75%);
  background-size: 200% 100%;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 3.5rem; color: var(--text-muted); margin-bottom: var(--gap); }
.empty-state h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; color: var(--text-muted); margin-bottom: var(--gap-lg); }

/* ---- TABLE VIEW ---- */
.table-container { overflow-x: auto; margin-bottom: var(--gap); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  text-align: left;
  padding: 12px var(--gap);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px var(--gap);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr:last-child td { border-bottom: none; }
.table-name { font-weight: 600; color: var(--text-primary); }
.table-gst { font-family: monospace; font-size: 0.82rem; color: var(--indigo); }
.table-loading { text-align: center; padding: 30px; color: var(--text-muted); }
.table-actions { display: flex; gap: 4px; }
.table-action-btn {
  width: 30px; height: 30px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  transition: all var(--transition);
}
.table-action-btn:hover { background: rgba(99,102,241,0.08); color: var(--indigo); }
.table-action-btn.danger:hover { background: rgba(239,68,68,0.08); color: var(--red); }

/* ---- PAGINATION ---- */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--gap);
  flex-wrap: wrap;
  gap: var(--gap);
}
.pagination-info { font-size: 0.82rem; color: var(--text-muted); }
.pagination { display: flex; gap: 5px; flex-wrap: wrap; }
.page-btn {
  width: 36px; height: 36px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active { background: var(--indigo); color: #fff; border-color: var(--indigo); font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal {
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition);
}
.modal-sm  { max-width: 420px; }
.modal-large { max-width: 780px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--gap-lg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  z-index: 1;
}
.modal-header-actions { display: flex; gap: 8px; align-items: center; }
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: var(--gap-lg); }

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--gap);
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
}
.modal-footer-actions { display: flex; gap: 10px; }
.auto-save-indicator { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

/* Confirm Modal */
.confirm-body { text-align: center; padding: var(--gap-xl); }
.confirm-icon { font-size: 3rem; color: var(--red); margin-bottom: var(--gap); }
.confirm-body h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.confirm-body p  { font-size: 0.875rem; color: var(--text-muted); margin-bottom: var(--gap-lg); }
.confirm-actions { display: flex; gap: var(--gap); justify-content: center; }

/* ---- IMAGE UPLOAD ---- */
.image-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 160px;
  position: relative;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.image-upload-zone:hover, .image-upload-zone.drag-over {
  border-color: var(--indigo);
  background: rgba(99,102,241,0.04);
}
.upload-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--gap-lg);
  min-height: 160px;
  color: var(--text-muted);
  text-align: center;
  pointer-events: none;
}
.upload-placeholder i { font-size: 2rem; color: var(--text-muted); margin-bottom: var(--gap-sm); }
.upload-placeholder p { font-size: 0.85rem; margin-bottom: 4px; }
.upload-placeholder span { font-size: 0.75rem; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.image-preview { position: relative; min-height: 160px; }
.image-preview img {
  width: 100%; height: 200px;
  object-fit: cover;
  display: block;
}
.image-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 5px;
}
.img-action-btn {
  width: 32px; height: 32px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  transition: all var(--transition);
}
.img-action-btn:hover { background: rgba(0,0,0,0.8); }
.img-action-btn.danger:hover { background: rgba(239,68,68,0.8); }

.upload-progress { padding: var(--gap); }
.progress-bar { height: 6px; background: var(--input-bg); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--indigo), var(--blue)); border-radius: 3px; transition: width 0.3s ease; }
.progress-text { font-size: 0.78rem; color: var(--text-muted); }

/* ---- IMAGE ZOOM ---- */
.image-zoom-overlay { background: rgba(0,0,0,0.9) !important; }
.image-zoom-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
.zoom-img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: var(--radius); }
.image-zoom-close {
  position: absolute;
  top: -16px; right: -16px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.image-zoom-close:hover { background: rgba(255,255,255,0.25); }

/* ---- DETAIL MODAL ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-lg); }
.detail-section { margin-bottom: var(--gap-lg); }
.detail-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--indigo);
  margin-bottom: var(--gap);
  display: flex; align-items: center; gap: 6px;
}
.detail-field { margin-bottom: 12px; }
.detail-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-value a { color: var(--indigo); }
.detail-value a:hover { text-decoration: underline; }

.detail-gst {
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--indigo);
  background: rgba(99,102,241,0.1);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.copy-btn {
  width: 26px; height: 26px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.copy-btn:hover { background: rgba(99,102,241,0.1); color: var(--indigo); border-color: rgba(99,102,241,0.3); }
.copy-btn.copied { color: var(--green); border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.08); }

.detail-action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: var(--gap) var(--gap-lg);
  border-top: 1px solid var(--border);
  background: var(--input-bg);
}
.detail-action-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.detail-action-btn:hover { background: rgba(99,102,241,0.08); color: var(--indigo); border-color: rgba(99,102,241,0.3); }
.detail-action-btn.whatsapp:hover { background: rgba(37,211,102,0.08); color: #25d366; border-color: rgba(37,211,102,0.3); }
.detail-action-btn.maps:hover { background: rgba(66,133,244,0.08); color: #4285f4; border-color: rgba(66,133,244,0.3); }
.detail-action-btn.copy-all { color: var(--indigo); }

/* QR Code */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap);
  background: var(--input-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.qr-container canvas, .qr-container img { border-radius: var(--radius-sm); }
.qr-label { font-size: 0.7rem; color: var(--text-muted); text-align: center; }

/* LR Images in detail */
.lr-images { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.lr-image-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); cursor: zoom-in; transition: transform var(--transition); }
.lr-image-card:hover { transform: scale(1.02); }
.lr-image-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.lr-image-label { font-size: 0.75rem; padding: 6px 8px; background: var(--input-bg); color: var(--text-muted); font-weight: 500; }

/* ---- SETUP MODAL ---- */
.setup-steps { display: flex; flex-direction: column; gap: var(--gap-lg); }
.setup-step { display: flex; gap: var(--gap); }
.step-number {
  width: 32px; height: 32px; min-width: 32px;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: #fff;
}
.step-content { flex: 1; }
.step-content h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.step-content p  { font-size: 0.85rem; color: var(--text-muted); }

.code-block {
  position: relative;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: var(--gap-sm);
  overflow: hidden;
}
.code-block pre {
  padding: var(--gap);
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  max-height: 240px;
}
.copy-code-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 8px;
  font-size: 0.75rem;
  transition: all var(--transition);
}
.copy-code-btn:hover { background: var(--bg-hover); color: var(--indigo); }

.setup-check { display: flex; align-items: center; gap: var(--gap); margin-top: var(--gap-lg); padding-top: var(--gap-lg); border-top: 1px solid var(--border); }
.connection-status { font-size: 0.85rem; font-weight: 500; }
.connection-status.ok  { color: var(--green); }
.connection-status.err { color: var(--red); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 var(--gap); }
  .topbar-center { display: none; }
  .global-search-wrapper { display: none; }
}

@media (max-width: 640px) {
  .page-content { padding: var(--gap); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .transporters-grid { grid-template-columns: 1fr; }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .controls-right { flex-wrap: wrap; }
  .page-header { flex-direction: column; gap: var(--gap-sm); }
  .modal { max-height: 95vh; }
  .lr-images { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
  .btn-sm .hide-mobile { display: none; }
  .topbar { gap: var(--gap-sm); }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: var(--gap); }
}

/* ---- THEME TRANSITION ---- */
* { transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease; }
.btn, .card-action-btn, .nav-item, .page-btn, .view-btn { transition: all 0.2s ease !important; }
