/* Sidebar Navigation - G2 Logistics Client Portal */
/* Light theme, orange accents, sharp edges */
/* Self-contained: loads its own font so sidebar is identical on every page */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --g2-text-on-orange: #FFFFFF;
}

/* Sidebar - fully self-contained, immune to page CSS */
.sidebar,
.sidebar *,
.sidebar *::before,
.sidebar *::after {
  box-sizing: border-box;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #FFFFFF;
  border-right: 1px solid #E5E5E5;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.3s ease;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #0B0B0B;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Collapsed State - Early collapse for flash prevention */
html.sidebar-will-collapse .sidebar {
  width: var(--sidebar-collapsed-width);
}

html.sidebar-will-collapse .sidebar-logo,
html.sidebar-will-collapse .nav-section-title,
html.sidebar-will-collapse .nav-link-text,
html.sidebar-will-collapse .btn-book-job-text,
html.sidebar-will-collapse .user-info,
html.sidebar-will-collapse .sidebar-legal {
  display: none !important;
}

html.sidebar-will-collapse .sidebar-header {
  justify-content: center;
  padding: 0;
}

html.sidebar-will-collapse .sidebar-collapse-toggle {
  width: 100%;
  height: 64px;
  border-radius: 0;
  background: #0A84DD;
  color: white;
  border: none;
  border-bottom: 1px solid #E5E5E5;
}

html.sidebar-will-collapse .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

/* Collapsed Header */
.sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-logo {
  opacity: 0;
  width: 0;
  flex: 0 0 0;
  transition: opacity 0.15s ease, width 0.2s ease, flex 0.2s ease;
}

.sidebar.collapsed .sidebar-collapse-toggle {
  width: 100%;
  height: 64px;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #E5E5E5;
  background: #0A84DD;
  color: white;
}

.sidebar.collapsed .sidebar-collapse-toggle:hover {
  background: #0070C2;
}

.sidebar.collapsed .nav-section-title {
  opacity: 0;
  visibility: hidden;
  height: 0;
  padding: 0;
  margin: 0;
  transition: opacity 0.15s ease, height 0.2s ease, padding 0.2s ease, margin 0.2s ease;
}

.sidebar.collapsed .sidebar-book-job {
  padding: 0;
}

.sidebar.collapsed .nav-link {
  padding: 12px 0;
  justify-content: center;
  border-left: none;
  position: relative;
  gap: 0;
}

.sidebar.collapsed .nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: transparent;
  transition: height 0.2s ease, background 0.2s ease;
  border-radius: 0 2px 2px 0;
}

.sidebar.collapsed .nav-link:hover::before {
  height: 24px;
  background: #E5E5E5;
}

.sidebar.collapsed .nav-link.active::before {
  height: 24px;
  background: #0A84DD;
}

.sidebar.collapsed .nav-link svg {
  margin: 0;
}

.sidebar.collapsed .nav-link span:not(.nav-badge):not(.nav-tooltip),
.sidebar.collapsed .nav-link-text {
  opacity: 0;
  width: 0;
  flex: 0 0 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.2s ease, flex 0.2s ease;
}

.sidebar.collapsed .nav-badge {
  position: absolute;
  top: 6px;
  right: 12px;
  margin: 0;
  padding: 2px 5px;
  font-size: 9px;
  min-width: 16px;
}

.sidebar.collapsed .nav-dropdown-toggle {
  padding: 12px 0;
  justify-content: center;
  border-left: none;
  position: relative;
  gap: 0;
}

.sidebar.collapsed .nav-dropdown-toggle::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: transparent;
  transition: height 0.2s ease, background 0.2s ease;
  border-radius: 0 2px 2px 0;
}

.sidebar.collapsed .nav-dropdown-toggle:hover::before {
  height: 24px;
  background: #E5E5E5;
}

.sidebar.collapsed .nav-dropdown-toggle.active::before {
  height: 24px;
  background: #0A84DD;
}

.sidebar.collapsed .nav-dropdown-toggle span:not(.nav-tooltip),
.sidebar.collapsed .nav-dropdown-toggle .chevron,
.sidebar.collapsed .nav-dropdown-text {
  opacity: 0;
  width: 0;
  flex: 0 0 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.2s ease, flex 0.2s ease;
}

.sidebar.collapsed .nav-dropdown-menu {
  display: none;
}

.sidebar.collapsed .sidebar-footer {
  padding: 8px 4px;
}

.sidebar.collapsed .sidebar-user {
  padding: 6px;
  justify-content: center;
  gap: 0;
  background: transparent;
  border: none;
}

.sidebar.collapsed .user-info {
  opacity: 0;
  width: 0;
  flex: 0 0 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.2s ease, flex 0.2s ease;
}

.sidebar.collapsed .btn-logout {
  opacity: 0;
  width: 0;
  flex: 0 0 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.2s ease, flex 0.2s ease;
}

.sidebar.collapsed .sidebar-legal {
  opacity: 0;
  max-height: 0;
  padding: 0;
  overflow: hidden;
  border-color: transparent;
  transition: opacity 0.15s ease, max-height 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
}


/* Tooltip for collapsed state */
.sidebar.collapsed .nav-link,
.sidebar.collapsed .nav-dropdown-toggle {
  position: relative;
}

.nav-tooltip {
  position: fixed;
  background: #FFFFFF;
  color: #333333;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #E8E8E8;
}

.nav-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.nav-tooltip::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #FFFFFF;
  border-left: none;
}

/* Sidebar Header - Logo + Toggle */
.sidebar-header {
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid #E5E5E5;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  transition: padding 0.3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
}

.sidebar-logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.sidebar-logo img {
  height: 40px;
  width: auto;
  max-width: 132px;
  object-fit: contain;
  object-position: left center;
}

/* Collapse Toggle Button - In Header */
.sidebar-collapse-toggle {
  width: 36px;
  height: 36px;
  background: #F5F5F5;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6B7280;
  transition: width 0.35s ease, height 0.35s ease, background 0.2s ease, border-color 0.2s ease, border-radius 0.35s ease, color 0.2s ease;
  flex-shrink: 0;
}

.sidebar-collapse-toggle:hover {
  background: #0A84DD;
  border-color: #0A84DD;
  color: white;
}

.sidebar-collapse-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-collapse-toggle svg {
  transform: rotate(180deg);
}

/* Collapse animation - base transitions (control the EXPAND animation) */
.sidebar-logo {
  transition: opacity 0.25s ease 0.12s, width 0.3s ease, flex 0.3s ease;
  overflow: hidden;
  white-space: nowrap;
}

.nav-link-text,
.btn-book-job-text,
.nav-dropdown-text,
.nav-dropdown-toggle .chevron {
  transition: opacity 0.25s ease 0.12s, width 0.3s ease, flex 0.3s ease;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar .user-info,
.sidebar .btn-logout {
  transition: opacity 0.25s ease 0.12s, width 0.3s ease, flex 0.3s ease;
  overflow: hidden;
}

.sidebar-legal {
  transition: opacity 0.25s ease 0.12s, max-height 0.3s ease, padding 0.3s ease, border-color 0.3s ease;
  max-height: 60px;
}

.sidebar-footer {
  transition: padding 0.3s ease;
}

.sidebar-user {
  transition: padding 0.3s ease, gap 0.3s ease;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}

.sidebar-nav::-webkit-scrollbar {
  display: none;                  /* Chrome/Safari/Edge */
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #8B9EB0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 12px 24px 8px;
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin: 0;
  padding: 0;
}

/* Nav Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: #6B7280;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, padding 0.3s ease, gap 0.3s ease;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: #F5F5F5;
  color: #0B0B0B;
  border-left-color: #E5E5E5;
}

.nav-link.active {
  background: #EFF6FF;
  color: #0A84DD;
  font-weight: 600;
  border-left-color: #0A84DD;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Book a Job Button - always orange, always stands out */
.sidebar-book-job {
  padding: 4px 8px;
  border-bottom: 1px solid #E5E5E5;
  transition: padding 0.3s ease;
}

.sidebar-book-job .nav-link {
  background: #0A84DD;
  color: #FFFFFF;
  border-radius: 8px;
  font-weight: 600;
}

.sidebar-book-job .nav-link:hover {
  background: #0070C2;
  color: #FFFFFF;
}

.sidebar-book-job .nav-link:active {
  background: #cc4429;
  color: #FFFFFF;
}

.sidebar-book-job .nav-link.active {
  background: #0A84DD;
  color: #FFFFFF;
}

/* Nav Badge */
.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  background: #0A84DD;
  color: var(--g2-text-on-orange);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  border-radius: var(--radius-sm);
}

/* Dropdown */
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  border: none;
  background: transparent;
  color: #6B7280;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, padding 0.3s ease, gap 0.3s ease;
  border-left: 3px solid transparent;
}

.nav-dropdown-toggle:hover {
  background: #F5F5F5;
  color: #0B0B0B;
}

.nav-dropdown-toggle.active {
  background: #EFF6FF;
  color: #0A84DD;
  font-weight: 600;
  border-left-color: #0A84DD;
}

.nav-dropdown-toggle svg:first-child {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-dropdown-toggle .chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-dropdown.open .chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  list-style: none;
  padding-left: 0;
  margin: 0;
  background: #F9F9F9;
}

.nav-dropdown.open .nav-dropdown-menu {
  max-height: 200px;
}

.nav-dropdown-menu .nav-link {
  padding: 10px 24px 10px 56px;
  font-size: 13px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #E5E5E5;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #F5F5F5;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: #0A84DD;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--g2-text-on-orange);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.sidebar-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  border-radius: inherit;
  background: var(--bg-card);
}

.user-avatar.has-image span {
  display: none !important;
}

.user-avatar.has-image .sidebar-avatar-image {
  display: block !important;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0B0B0B;
}

.user-role {
  font-size: 12px;
  color: #8B9EB0;
}

.btn-logout {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #E5E5E5;
  color: #8B9EB0;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  border-radius: var(--radius-md);
}

.btn-logout:hover {
  background: #FEF2F2;
  border-color: #EF4444;
  color: #EF4444;
}

.btn-logout svg {
  width: 18px;
  height: 18px;
}

/* Sidebar Legal Links */
.sidebar-legal {
  padding: 12px 24px;
  border-top: 1px solid #E5E5E5;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.sidebar-legal a {
  font-size: 11px;
  color: #8B9EB0;
  text-decoration: none;
  transition: color 0.15s ease;
}

.sidebar-legal a:hover {
  color: #0A84DD;
}

/* Main Content Offset */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  flex: 1;
  min-width: 0;
}

.sidebar.collapsed ~ .main-content,
body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* Header Bar - fully self-contained, immune to page CSS */
.header-bar,
.header-bar *,
.header-bar *::before,
.header-bar *::after {
  box-sizing: border-box;
}

.header-bar {
  height: 64px;
  background: #FFFFFF;
  border-bottom: 1px solid #E5E5E5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #0B0B0B;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0B0B0B;
  margin: 0;
}

.page-subtitle {
  font-size: 13px;
  color: #8B9EB0;
  margin: 0;
}

/* Header Stats */
.header-stats {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-stat {
  text-align: right;
}

.header-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0B0B0B;
  display: block;
  line-height: 1.2;
}

.header-stat-value.active { color: #10B981; }
.header-stat-value.pending { color: #F59E0B; }
.header-stat-value.brand { color: #0A84DD; }
.header-stat-value.completed { color: #10B981; }

.header-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #8B9EB0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Header Action Button */
.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #0A84DD;
  color: var(--g2-text-on-orange);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border-radius: var(--radius-md);
}

.header-btn:hover {
  background: #0070C2;
}

.header-btn svg {
  width: 18px;
  height: 18px;
}

.header-btn.secondary {
  background: #FFFFFF;
  color: #6B7280;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius-md);
}

.header-btn.secondary:hover {
  background: #F5F5F5;
  border-color: #D1D5DB;
}

/* Live Indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #ECFDF5;
  border: 1px solid #10B981;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  color: #10B981;
}

.live-pulse {
  width: 8px;
  height: 8px;
  background: #10B981;
  animation: livePulse 2s infinite;
  border-radius: 50%;
  flex-shrink: 0;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.live-text {
  font-size: 13px;
  font-weight: 600;
  color: #10B981;
}

.live-time {
  font-size: 12px;
  color: #6B7280;
}

/* Last Updated Time (tracking page) */
.last-updated {
  font-size: 11px;
  font-weight: 500;
  color: #78716C;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid #D6D3D1;
}

/* Pulse animation on location update */
.live-indicator.pulse {
  animation: indicatorPulse 0.5s ease;
}

@keyframes indicatorPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); background: #D1FAE5; }
  100% { transform: scale(1); }
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 10px;
  background: transparent;
  border: 1px solid #E5E5E5;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.mobile-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: #0B0B0B;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: #F5F5F5;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: #E5E5E5;
}

.theme-toggle-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
}

.theme-toggle-icon svg {
  width: 18px;
  height: 18px;
  color: #6B7280;
  transition: all 0.3s;
}

.theme-toggle-icon.active {
  background: #FFFFFF;
  border-radius: var(--radius-sm);
}

.theme-toggle-icon.active svg {
  color: #0A84DD;
}

[data-theme="dark"] .theme-toggle {
  background: #3D3D3B;
  border-color: #454543;
}

[data-theme="dark"] .theme-toggle:hover {
  background: #454543;
}

[data-theme="dark"] .theme-toggle-icon svg {
  color: #808080;
}

[data-theme="dark"] .theme-toggle-icon.active {
  background: #0A84DD;
}

[data-theme="dark"] .theme-toggle-icon.active svg {
  color: #FFFFFF;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .sidebar.collapsed {
    width: var(--sidebar-width) !important;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  .main-content,
  .sidebar.collapsed ~ .main-content,
  body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
  }

  .mobile-toggle {
    display: flex;
  }

  .header-bar {
    padding: 0 20px;
  }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .header-bar {
    height: 56px;
    padding: 0 16px;
  }

  .page-title {
    font-size: 1rem;
  }

  .page-subtitle {
    display: none;
  }

  .header-stats {
    display: none;
  }

  .live-indicator {
    padding: 6px 10px;
    font-size: 11px;
  }

  .live-indicator .live-time {
    display: none;
  }

  .live-indicator span:not(.live-pulse) {
    display: none;
  }

  .last-updated {
    display: none;
  }
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

@media (max-width: 1024px) {
  .sidebar-overlay.active {
    display: block;
  }
}

/* Skip Link */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  padding: 12px 24px;
  background: #0A84DD;
  color: var(--g2-text-on-orange);
  text-decoration: none;
  z-index: 9999;
  font-weight: 600;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  transition: top 0.2s ease;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.skip-link:focus {
  top: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .sidebar {
  background: #2D2D2B;
  border-right-color: #454543;
}

[data-theme="dark"] .sidebar-header {
  background: #2D2D2B;
  border-bottom-color: #454543;
}

[data-theme="dark"] .sidebar-collapse-toggle {
  background: #3D3D3B;
  border-color: #454543;
  color: #B0B0B0;
}

[data-theme="dark"] .sidebar-collapse-toggle:hover {
  background: #0A84DD;
  border-color: #0A84DD;
  color: #FFFFFF;
}

[data-theme="dark"] .sidebar-logo {
  background: transparent;
}

[data-theme="dark"] .sidebar-logo img {
  filter: brightness(0) invert(1);
}

[data-theme="dark"] .nav-link {
  color: #B0B0B0;
}

[data-theme="dark"] .nav-link:hover {
  background: #3D3D3B;
  color: #FFFFFF;
  border-left-color: #525250;
}

[data-theme="dark"] .nav-link.active {
  background: rgba(10, 132, 221, 0.15);
  color: #0A84DD;
}

[data-theme="dark"] .nav-section-title {
  color: #777775;
}

[data-theme="dark"] .sidebar-book-job {
  border-bottom-color: #454543;
}

[data-theme="dark"] .sidebar-book-job .nav-link {
  background: #0A84DD;
  color: #FFFFFF;
}

[data-theme="dark"] .sidebar-book-job .nav-link:hover {
  background: #0070C2;
  color: #FFFFFF;
}

[data-theme="dark"] .nav-dropdown-toggle {
  color: #B0B0B0;
}

[data-theme="dark"] .nav-dropdown-toggle:hover {
  background: #3D3D3B;
  color: #FFFFFF;
}

[data-theme="dark"] .nav-dropdown-toggle.active {
  background: rgba(10, 132, 221, 0.15);
  color: #0A84DD;
}

[data-theme="dark"] .nav-dropdown-menu {
  background: #292927;
}

[data-theme="dark"] .sidebar-footer {
  border-top-color: #454543;
}

[data-theme="dark"] .sidebar-user {
  background: #3D3D3B;
  border-color: #454543;
}

[data-theme="dark"] .user-name {
  color: #FFFFFF;
}

[data-theme="dark"] .user-role {
  color: #808080;
}

[data-theme="dark"] .btn-logout {
  background: #3D3D3B;
  border-color: #454543;
  color: #808080;
}

[data-theme="dark"] .btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
  color: #EF4444;
}

[data-theme="dark"] .sidebar-legal {
  border-top-color: #454543;
}

[data-theme="dark"] .sidebar-legal a {
  color: #777775;
}

[data-theme="dark"] .sidebar-legal a:hover {
  color: #0A84DD;
}

[data-theme="dark"] .header-bar {
  background: #2D2D2B;
  border-bottom-color: #454543;
}

[data-theme="dark"] .page-title {
  color: #FFFFFF;
}

[data-theme="dark"] .header-stat-value {
  color: #FFFFFF;
}

[data-theme="dark"] .header-stat-label {
  color: #808080;
}

[data-theme="dark"] .header-btn.secondary {
  background: #3D3D3B;
  color: #B0B0B0;
  border-color: #454543;
}

[data-theme="dark"] .header-btn.secondary:hover {
  background: #454543;
  border-color: #525250;
}

/* Dark Mode - Collapsed Sidebar */
[data-theme="dark"] .sidebar-collapse-toggle {
  border-top-color: #454543;
  color: #808080;
}

[data-theme="dark"] .sidebar-collapse-toggle:hover {
  background: #3D3D3B;
  color: #0A84DD;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-collapse-toggle {
  background: #0A84DD;
  color: white;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-collapse-toggle:hover {
  background: #0070C2;
  color: white;
}

[data-theme="dark"] .nav-tooltip {
  background: #3D3D3B;
  color: #E0E0E0;
  border-color: #525250;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .nav-tooltip::before {
  border-right-color: #3D3D3B;
  filter: drop-shadow(-1px 0 0 #525250);
}

[data-theme="dark"] .sidebar.collapsed .nav-link:hover::before,
[data-theme="dark"] .sidebar.collapsed .nav-dropdown-toggle:hover::before {
  background: #525250;
}

[data-theme="dark"] .sidebar.collapsed .nav-link.active::before,
[data-theme="dark"] .sidebar.collapsed .nav-dropdown-toggle.active::before {
  background: #0A84DD;
}

/* Sidebar Plan Badge */
.user-plan-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-top: 2px;
}
.user-plan-badge.plan-sub {
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  color: #4338ca;
}
.user-plan-badge.plan-payg {
  background: #f0fdf4;
  color: #166534;
}
[data-theme="dark"] .user-plan-badge.plan-sub {
  background: linear-gradient(135deg, #312e81, #1e1b4b);
  color: #a5b4fc;
}
[data-theme="dark"] .user-plan-badge.plan-payg {
  background: #064e3b;
  color: #6ee7b7;
}

/* ==========================================================================
   ACCOUNT-TYPE ANTI-FLASH
   Cached from localStorage in blocking <script>, prevents transport UI
   flashing before async auth resolves for recovery/both accounts.
   ========================================================================== */

/* Recovery accounts: hide transport-only elements immediately */
[data-account="recovery"] .transport-only-tile { display: none !important; }
[data-account="recovery"] .recovery-only-tile  { display: flex !important; }

/* Transport accounts: hide recovery-only elements immediately */
[data-account="transport"] .recovery-only-tile  { display: none !important; }

/* Both accounts: show everything */
[data-account="both"] .recovery-only-tile  { display: flex !important; }

/* Recovery sidebar text swaps - use CSS to hide/show the right text instantly */
[data-account="recovery"] .btn-book-job-text { font-size: 0 !important; }
[data-account="recovery"] .btn-book-job-text::after { content: 'Book Recovery'; font-size: 14px; }
[data-account="recovery"] a[href="pricing.html"] .nav-link-text { font-size: 0 !important; }
[data-account="recovery"] a[href="pricing.html"] .nav-link-text::after { content: 'My Rates'; font-size: 14px; }
[data-account="recovery"] a[href="pricing.html"] .nav-tooltip { font-size: 0 !important; }
[data-account="recovery"] a[href="pricing.html"] .nav-tooltip::after { content: 'My Rates'; font-size: 12px; }

/* Recovery accounts: hide transport-specific UI */
[data-account="recovery"] .btn-book-job-header { display: none !important; }
[data-account="recovery"] .section-tabs { display: none !important; }
[data-account="recovery"] .section-tab[data-section="quote-calculator"] { display: none !important; }

/* ============================================================================
   SHARED HEADER + FAB CHROME
   The header bar is injected by nav.js on every page, but G2 only defined the
   search box / notification button / FAB inside dashboard.css. These rules are
   lifted here (the chrome stylesheet, loaded on every page) so the header and
   FAB render consistently across all pages, not just the dashboard.
   ============================================================================ */
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F0F0EE;
  border: 2px solid #E5E5E3;
  padding: 10px 18px;
  width: 340px;
  transition: all 0.2s;
  border-radius: var(--radius-md, 8px);
}
.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-weight: 500;
  color: var(--text-primary, #0B0B0B);
  width: 100%;
}
.search-box input::placeholder { color: var(--text-muted, #9CA3AF); }
.search-box svg { width: 18px; height: 18px; color: var(--text-muted, #9CA3AF); flex-shrink: 0; }
.search-box:focus-within { border-color: #0A84DD; background: #FFFFFF; box-shadow: 0 0 0 3px rgba(10,132,221,.10); }

.notifications-wrapper { position: relative; }
.notification-btn {
  width: 44px; height: 44px; border: none; background: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; transition: all 0.2s; border-radius: 12px;
}
.notification-btn:hover { background: #F5F5F4; }
.notification-btn svg { width: 20px; height: 20px; color: var(--text-secondary, #6B7280); }
.notification-badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px;
  background: #0A84DD; color: #FFFFFF; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}

.quick-action-fab {
  position: fixed; bottom: 32px; right: 32px; width: 64px; height: 64px;
  background: var(--g2-orange, #0A84DD); border: none; color: #FFFFFF; cursor: pointer;
  box-shadow: var(--shadow-orange, 0 8px 32px rgba(10,132,221,.25));
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1); z-index: 100; border-radius: 16px;
}
.quick-action-fab:hover { transform: translateY(-2px); }
.quick-action-fab svg { width: 28px; height: 28px; }

@media (max-width: 1024px) {
  .search-box { width: 220px; }
}
@media (max-width: 768px) {
  .search-box { display: none; }
  .quick-action-fab { bottom: 20px; right: 20px; width: 56px; height: 56px; }
}
