/* ============================
   Modern UI Design System
   ============================ */

/* === CSS Variables === */
:root {
  /* Color System */
  --primary: #ff6b6b;
  --primary-light: #ff8e8e;
  --primary-dark: #e84a5f;
  --primary-rgb: 255, 107, 107;
  --secondary: #4d79ff;
  --secondary-light: #829fff;
  --secondary-dark: #3a5ccc;
  --secondary-rgb: 77, 121, 255;
  --success: #4ecca3;
  --success-light: #7affaa;
  --success-dark: #3da58a;
  --success-rgb: 78, 204, 163;
  --warning: #ffbe0b;
  --warning-light: #ffcb3b;
  --warning-dark: #e0a800;
  --warning-rgb: 255, 190, 11;
  --danger: #ff5757;
  --danger-light: #ff7a7a;
  --danger-dark: #e04343;
  --danger-rgb: 255, 87, 87;
  --info: #5bc0de;
  --info-light: #85d0e6;
  --info-dark: #46a9c5;
  --info-rgb: 91, 192, 222;

  /* Gradients */
  --primary-gradient: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  );
  --secondary-gradient: linear-gradient(
    135deg,
    var(--secondary),
    var(--secondary-dark)
  );
  --success-gradient: linear-gradient(
    135deg,
    var(--success),
    var(--success-dark)
  );
  --danger-gradient: linear-gradient(135deg, var(--danger), var(--danger-dark));
  --warning-gradient: linear-gradient(
    135deg,
    var(--warning),
    var(--warning-dark)
  );
  --info-gradient: linear-gradient(135deg, var(--info), var(--info-dark));

  /* Dark Mode Colors (Default) */
  --surface-0: #121212; /* Base background */
  --surface-1: #1e1e1e; /* Cards, elevated surfaces */
  --surface-2: #252525; /* Slightly more elevated, or card headers */
  --surface-3: #333; /* Inputs, controls */
  --surface-4: #404040; /* Hover states for controls */
  --surface-glass: rgb(30 30 30 / 85%); /* For glassmorphism effects */
  --text-primary: rgb(255 255 255 / 87%);
  --text-secondary: rgb(255 255 255 / 60%);
  --text-tertiary: rgb(255 255 255 / 38%);
  --text-on-primary: #000; /* Text on primary-bg buttons */
  --text-on-secondary: #fff; /* Text on secondary-bg buttons */
  --text-on-dark: #fff;
  --text-on-light: #000;
  --border-color: rgb(255 255 255 / 12%);
  --border-color-light: rgb(
    255 255 255 / 24%
  ); /* For focused elements or stronger divisions */

  --divider-color: rgb(255 255 255 / 8%);

  /* Typography */
  --font-family:
    "Inter", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, oxygen,
    ubuntu, cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --font-size-xs: 0.75rem; /* 12px */
  --font-size-sm: 0.875rem; /* 14px */
  --font-size-md: 1rem; /* 16px */
  --font-size-lg: 1.125rem; /* 18px */
  --font-size-xl: 1.25rem; /* 20px */
  --font-size-2xl: 1.5rem; /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem; /* 36px */
  --font-size-display: 3rem; /* 48px */
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Spacing System (based on 4px grid) */
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px */
  --space-5: 1.25rem; /* 20px */
  --space-6: 1.5rem; /* 24px */
  --space-8: 2rem; /* 32px */
  --space-10: 2.5rem; /* 40px */
  --space-12: 3rem; /* 48px */
  --space-16: 4rem; /* 64px */

  /* Layout */
  --header-height: 64px;
  --content-max-width: 1440px;
  --sidebar-width: 280px;
  --panel-width: 340px;

  /* Effects */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 5%);
  --shadow-sm: 0 2px 4px rgb(0 0 0 / 10%);
  --shadow-md: 0 4px 8px rgb(0 0 0 / 12%);
  --shadow-lg: 0 10px 20px rgb(0 0 0 / 15%);
  --shadow-xl: 0 20px 40px rgb(0 0 0 / 15%);
  --shadow-inset: inset 0 2px 4px rgb(0 0 0 / 10%);

  /* Border Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Z-Index */
  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-drawer: 1040;
  --z-modal-backdrop: 1045;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-overlay: 1080; /* For general overlays like mobile nav backdrop */
  --z-loading-overlay: 9999;

  /* Scrollbar */
  --scrollbar-thumb-color: rgb(255 255 255 / 30%);
  --scrollbar-track-color: rgb(0 0 0 / 20%);
  --scrollbar-thumb-hover-color: rgb(255 255 255 / 50%);
}

/* === Light Mode Overrides === */
body.light-mode {
  --surface-0: #f8f9fa;
  --surface-1: #fff;
  --surface-2: #f1f3f5;
  --surface-3: #e9ecef;
  --surface-4: #dee2e6;
  --surface-glass: rgb(248 249 250 / 85%);
  --text-primary: rgb(0 0 0 / 87%);
  --text-secondary: rgb(0 0 0 / 60%);
  --text-tertiary: rgb(0 0 0 / 38%);
  --text-on-primary: #fff;
  --border-color: rgb(0 0 0 / 12%);
  --border-color-light: rgb(0 0 0 / 24%);
  --divider-color: rgb(0 0 0 / 8%);
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 3%);
  --shadow-sm: 0 2px 4px rgb(0 0 0 / 5%);
  --shadow-md: 0 4px 8px rgb(0 0 0 / 6%);
  --shadow-lg: 0 10px 20px rgb(0 0 0 / 7%);
  --shadow-xl: 0 20px 40px rgb(0 0 0 / 7%);
  --scrollbar-thumb-color: rgb(0 0 0 / 20%);
  --scrollbar-track-color: rgb(0 0 0 / 5%);
  --scrollbar-thumb-hover-color: rgb(0 0 0 / 40%);
}

/* === Core Reset & Base Styles === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

html {
  height: 100%;
  font-size: var(--font-size-md);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-family);
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal);
  overflow-x: hidden; /* Prevent horizontal scroll */
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track-color);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb-color);
  border-radius: var(--radius-sm);
  border: 2px solid transparent; /* Creates padding around thumb */
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover-color);
}

/* For Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
}

/* === Layout Structure === */
.layout-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--surface-1);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-fixed);
  transition:
    background-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

.app-header.scrolled {
  box-shadow: var(--shadow-md); /* Slightly stronger shadow when scrolled */
  background-color: var(--surface-2);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-4);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

/* Brand Section */
.brand-section {
  display: flex;
  align-items: center;
}

.menu-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  margin-right: var(--space-3);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.menu-toggle-btn:hover {
  background-color: var(--surface-3);
  color: var(--text-primary);
}

.brand-logo {
  display: flex;
  align-items: center;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xl);
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-right: var(--space-2);
  font-size: 1.5em; /* Make icon slightly larger */
}

.brand-text {
  background: var(--primary-gradient);
  background-clip: text;
  color: transparent;
}

/* Main Navigation */
.main-nav {
  height: 100%;
}

.nav-list {
  display: flex;
  align-items: center;
  height: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  height: 100%;
  position: relative;
}

.nav-item a {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--space-4);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.nav-item.active a,
.nav-item a:hover {
  color: var(--text-primary);
}

.nav-item.active a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--space-4);
  right: var(--space-4);
  height: 3px;
  background: var(--primary-gradient);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav-item i {
  margin-right: var(--space-2);
  color: var(--primary);
  font-size: var(--font-size-md);
}

/* Dropdown Menus */
.dropdown-menu {
  background-color: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) 0;
  min-width: 220px;
  z-index: var(--z-dropdown);
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-item.active {
  background-color: var(--surface-3);
  color: var(--text-primary);
}

.dropdown-item i {
  margin-right: var(--space-3);
  width: 20px;
  text-align: center;
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--divider-color);
  margin: var(--space-2) 0;
  border: none;
}

/* Tools Section */
.tools-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.tool-btn:hover {
  background-color: var(--surface-3);
  color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
  position: relative;
  display: inline-flex; /* Use flex for better alignment */
  align-items: center;
  width: 50px;
  height: 26px;
  cursor: pointer;
}

.theme-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider {
  position: absolute;
  inset: 0;
  background-color: var(--surface-3);
  border-radius: var(--radius-full);
  transition: background-color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-1); /* Adjust padding for icons */
}

.theme-slider::before {
  /* The toggle knob */
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--surface-1); /* Knob color */
  box-shadow: var(--shadow-xs);
  border-radius: 50%;
  transition:
    transform var(--transition-normal),
    background-color var(--transition-normal);
  z-index: 2;
}

.theme-toggle input:checked + .theme-slider {
  background-color: var(--primary); /* Active background */
}

.theme-toggle input:checked + .theme-slider::before {
  transform: translateX(24px);
  background-color: var(--text-on-primary); /* Knob color when active */
}

.theme-slider .fa-moon,
.theme-slider .fa-sun {
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  z-index: 1;
  transition: color var(--transition-fast);
}

.theme-toggle input:checked + .theme-slider .fa-moon {
  color: var(--text-on-primary);
}

.theme-toggle input:not(:checked) + .theme-slider .fa-sun {
  color: var(--warning-dark);
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 85%;
  max-width: 320px;
  height: 100%;
  background-color: var(--surface-1);
  z-index: var(--z-drawer);
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  contain: layout style paint; /* Performance hint */
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--divider-color);
}

.drawer-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--font-size-xl);
  cursor: pointer;
  padding: var(--space-2); /* Larger tap target */
  transition: color var(--transition-fast);
}

.drawer-close-btn:hover {
  color: var(--text-primary);
}

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0; /* Reduced top/bottom padding */
}

.drawer-nav-list {
  list-style: none;
}

.drawer-nav-list li a {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-size-md);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
  border-left: 3px solid transparent; /* For active state */
}

.drawer-nav-list li a.active,
.drawer-nav-list li a:hover {
  background-color: var(--surface-2);
  color: var(--text-primary);
}

.drawer-nav-list li a.active {
  border-left-color: var(--primary);
  font-weight: var(--font-weight-medium);
}

.drawer-nav-list li a i {
  margin-right: var(--space-3);
  width: 20px;
  text-align: center;
  color: var(--primary);
}

/* Side Panel (e.g., Filters) */
.side-panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  width: var(--panel-width);
  height: calc(100vh - var(--header-height));
  background-color: var(--surface-1);
  z-index: var(
    --z-drawer
  ); /* Same level as mobile drawer, manage visibility via JS */

  transform: translateX(100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
  contain: layout style paint; /* Performance hint */
}

.side-panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--divider-color);
  background-color: var(--surface-2); /* Subtle distinction */
}

.panel-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.panel-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--font-size-xl);
  cursor: pointer;
  padding: var(--space-2);
  transition: color var(--transition-fast);
}

.panel-close-btn:hover {
  color: var(--text-primary);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.panel-actions {
  padding: var(--space-4);
  border-top: 1px solid var(--divider-color);
  display: flex;
  gap: var(--space-3);
  background-color: var(--surface-1); /* Ensure it matches panel bg */
}

/* Main Content */
.main-content {
  flex-grow: 1;
  padding-top: var(--header-height);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden; /* Changed from auto to hidden to prevent double scrollbars if body handles scrolling */
}

/* Content Overlay (for mobile nav, side panels) */
.content-overlay {
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 50%);
  z-index: calc(var(--z-drawer) - 1); /* Below drawer/panel */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-normal),
    visibility var(--transition-normal);
  pointer-events: none;
}

.content-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* === Components === */

/* Cards */
.card {
  background-color: var(--surface-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition:
    box-shadow var(--transition-normal),
    transform var(--transition-normal);
  margin-bottom: var(--space-5);
  position: relative; /* For pseudo-elements like shimmer */
}

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

/* Card Shimmer Effect (from coverage_management.html) */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgb(255 255 255 / 3%),
    /* Softer shimmer */ transparent
  );
  transition: left 0.7s ease;
  pointer-events: none; /* Allow interaction with card content */
}

body.light-mode .card::before {
  background: linear-gradient(90deg, transparent, rgb(0 0 0 / 2%), transparent);
}

.card:hover::before {
  left: 100%;
}

.card-header {
  background-color: var(--surface-2);
  padding: var(--space-3) var(--space-4); /* Adjusted padding */
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: var(--space-4);
}

.card-footer {
  background-color: var(--surface-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-color);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

/* Darker card variant (from coverage_management.html) */
.card.bg-darker {
  background-color: var(
    --surface-0
  ) !important; /* Even darker than surface-1 */

  border: 1px solid var(--surface-2); /* Subtle border */
}

body.light-mode .card.bg-darker {
  background-color: var(--surface-3) !important;
  border: 1px solid var(--surface-4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent; /* Base border for consistent sizing */
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  text-decoration: none;
  position: relative;
  overflow: hidden; /* Prevent text selection on click */
  user-select: none;
}

/* Ripple Effect */
.btn::after {
  content: "";
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(
    circle,
    rgb(255 255 255 / 30%) 10%,
    transparent 10.01%
  );
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition:
    transform 0.5s,
    opacity 1s;
}

.btn:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

.btn-primary::after,
.btn-secondary::after,
.btn-success::after,
.btn-danger::after,
.btn-warning::after,
.btn-info::after {
  background-image: radial-gradient(
    circle,
    rgb(255 255 255 / 30%) 10%,
    transparent 10.01%
  );
}

.btn-primary.btn-outline::after,
.btn-secondary.btn-outline::after {
  /* Darker ripple for light outline buttons */
  background-image: radial-gradient(
    circle,
    rgb(0 0 0 / 15%) 10%,
    transparent 10.01%
  );
}

body.light-mode .btn-primary.btn-outline::after,
body.light-mode .btn-secondary.btn-outline::after {
  background-image: radial-gradient(
    circle,
    rgb(0 0 0 / 15%) 10%,
    transparent 10.01%
  );
}

.btn:disabled,
.btn.disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:disabled::after,
.btn.disabled::after {
  display: none; /* No ripple on disabled */
}

.btn i {
  font-size: 1.1em; /* Slightly larger icons in buttons */
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--text-on-primary);
  border-color: var(--primary-dark);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgb(var(--primary-rgb), 0.3);
  transform: translateY(-1px);
  filter: brightness(110%);
}

.btn-secondary {
  background: var(--secondary-gradient);
  color: var(--text-on-secondary);
  border-color: var(--secondary-dark);
}

.btn-secondary:hover {
  box-shadow: 0 4px 12px rgb(var(--secondary-rgb), 0.3);
  transform: translateY(-1px);
  filter: brightness(110%);
}

.btn-success {
  background: var(--success-gradient);
  color: var(--text-on-dark);
  border-color: var(--success-dark);
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgb(var(--success-rgb), 0.3);
  transform: translateY(-1px);
  filter: brightness(110%);
}

.btn-danger {
  background: var(--danger-gradient);
  color: var(--text-on-dark);
  border-color: var(--danger-dark);
}

.btn-danger:hover {
  box-shadow: 0 4px 12px rgb(var(--danger-rgb), 0.3);
  transform: translateY(-1px);
  filter: brightness(110%);
}

.btn-warning {
  background: var(--warning-gradient);
  color: var(--text-on-dark);
  border-color: var(--warning-dark);
}

.btn-warning:hover {
  box-shadow: 0 4px 12px rgb(var(--warning-rgb), 0.3);
  transform: translateY(-1px);
  filter: brightness(110%);
}

.btn-info {
  background: var(--info-gradient);
  color: var(--text-on-dark);
  border-color: var(--info-dark);
}

.btn-info:hover {
  box-shadow: 0 4px 12px rgb(var(--info-rgb), 0.3);
  transform: translateY(-1px);
  filter: brightness(110%);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color-light);
}

.btn-outline:hover {
  background-color: var(--surface-3);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background-color: rgb(var(--primary-rgb), 0.1);
}

.btn-outline-secondary {
  color: var(--secondary);
  border-color: var(--secondary);
}

.btn-outline-secondary:hover {
  background-color: rgb(var(--secondary-rgb), 0.1);
}

/* Add other outline variants as needed */

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  width: 38px; /* Slightly larger for better tap target */
  height: 38px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-md);
  border-radius: var(--radius-lg);
}

/* Button Group (from coverage_management.html) */
.btn-group {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.btn-group > .btn {
  position: relative;
  flex: 1 1 auto;
}

.btn-group > .btn:not(:first-child) {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group > .btn:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-group > .btn:hover {
  z-index: 1; /* Bring hovered button to front */
}

/* Forms */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.form-control,
.form-select {
  width: 100%;
  padding: var(--space-2) var(--space-3); /* Adjusted padding */
  background-color: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

.form-control:hover,
.form-select:hover {
  border-color: var(--border-color-light);
  background-color: var(--surface-3);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgb(var(--primary-rgb), 0.25);
  background-color: var(--surface-1); /* Lighten background on focus */
}

.form-control::placeholder {
  color: var(--text-tertiary);
  opacity: 1; /* Firefox fix */
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba(255,255,255,0.6)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px 12px;
  padding-right: calc(
    var(--space-3) + 16px + var(--space-3)
  ); /* Ensure text doesn't overlap arrow */
}

body.light-mode .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba(0,0,0,0.6)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.form-control-color {
  /* For color inputs */
  height: calc(
    1.5em + var(--space-2) * 2 + 2px
  ); /* Match height of other inputs */

  padding: var(--space-2);
}

.form-check {
  display: flex; /* Use flex for better alignment */
  align-items: center;
  margin-bottom: var(--space-2);
  min-height: calc(
    var(--font-size-sm) * var(--line-height-normal)
  ); /* Ensure consistent height */
}

.form-check-input {
  width: 1.25em;
  height: 1.25em;
  margin-top: 0; /* Reset Bootstrap default */
  margin-right: var(--space-2);
  background-color: var(--surface-3);
  border: 1px solid var(--border-color);
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M12.736 3.264a.5.5 0 0 0-.707 0L6.5 8.793 4.236 6.529a.5.5 0 0 0-.707.707l2.5 2.5a.5.5 0 0 0 .707 0l6-6a.5.5 0 0 0 0-.707z'/%3e%3c/svg%3e");
}

.form-check-input:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgb(var(--primary-rgb), 0.25);
}

.form-check-label {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.form-switch .form-check-input {
  width: 2.5em; /* Standard switch width */
  background-image: none; /* Remove checkmark for switch */
  position: relative;
}

.form-switch .form-check-input::before {
  /* Switch knob */
  content: "";
  position: absolute;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background-color: var(--surface-1);
  top: 50%;
  left: 0.125em; /* Initial position */
  transform: translateY(-50%);
  transition:
    transform var(--transition-fast),
    background-color var(--transition-fast);
}

.form-switch .form-check-input:checked::before {
  transform: translate(1.25em, -50%); /* Move knob to the right */
}

.form-text {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--danger);
  animation: shake 0.3s ease;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  box-shadow: 0 0 0 0.2rem rgb(var(--danger-rgb), 0.25);
}

.form-control.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-feedback {
  display: block;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-3px);
  }

  75% {
    transform: translateX(3px);
  }
}

/* Quick Selections (for filter panels) */
.quick-selections {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(80px, 1fr)
  ); /* Responsive columns */

  gap: var(--space-2);
}

.quick-select-btn {
  background-color: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  font-weight: var(--font-weight-medium);
}

.quick-select-btn:hover {
  background-color: var(--surface-3);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px); /* Subtle lift */
}

.quick-select-btn.active {
  background-color: rgb(var(--primary-rgb), 0.15);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* Tables */
.table-container {
  border-radius: var(--radius-lg);
  overflow: hidden; /* For rounded corners on table */
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--surface-1);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table th {
  background-color: var(--surface-2);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.5px;
}

.table-hover tbody tr:hover {
  background-color: var(--surface-2);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(
    --surface-0
  ); /* Slightly different from surface-1 for striping */
}

body.light-mode .table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--surface-2);
}

.table .action-cell {
  /* For cells containing action buttons */
  text-align: right;
  white-space: nowrap;
}

.table .action-cell .btn {
  margin-left: var(--space-1);
}

/* Status Indicators */
.status-indicator {
  display: inline-block; /* Allow use in text flow */
  width: 10px; /* Smaller default size */
  height: 10px;
  border-radius: 50%;
  background-color: var(--warning);
  transition: background-color var(--transition-fast);
  margin-right: var(--space-2);
  vertical-align: middle;
}

.status-indicator.connected {
  background-color: var(--success);
}

.status-indicator.disconnected {
  background-color: var(--danger);
}

.status-indicator.processing {
  background-color: var(--info);
  animation: pulse-indicator 1.5s infinite ease-in-out;
}

@keyframes pulse-indicator {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(0.8);
  }
}

/* === Enhanced Live Trip Metrics Styling === */
.live-tracking-status {
  /* Can be a card or a custom component */
  position: absolute; /* Example positioning */
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-sticky);
  max-width: 300px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background-color: var(--surface-2);
  border: 1px solid var(--border-color);
  opacity: 0.95;
  transition: all var(--transition-normal);
}

.live-tracking-status:hover {
  opacity: 1;
  box-shadow: var(--shadow-lg);
}

.live-tracking-status .card-header {
  /* If using card structure */
  padding: var(--space-2) var(--space-3);
  background-color: var(--surface-3);
}

.live-tracking-status .card-body {
  padding: var(--space-3);
}

/* Enhanced Live Trip Metrics Styling */
.live-trip-metrics {
  font-size: 0.9rem;
  line-height: 1.4;
}

.metric-section {
  margin-bottom: 1rem;
}

.metric-section-title {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-color);
}

.metric-section-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.75rem 0;
  opacity: 0.5;
}

.live-trip-metrics .metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--divider-color);
  font-size: var(--font-size-xs);
}

.live-trip-metrics .metric-row:last-child {
  border-bottom: none;
}

.live-trip-metrics .metric-row:hover {
  background-color: var(--surface-3);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 0.25rem;
}

.live-trip-metrics .metric-label {
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
}

.live-trip-metrics .metric-value {
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Specific styling for base metrics (always shown) */
.metric-base .metric-value {
  color: var(--success);
}

/* Specific styling for advanced metrics (conditionally shown) */
.metric-advanced .metric-value {
  color: var(--info);
}

/* Special highlighting for current speed */
.metric-row:has(.metric-label:contains("Current Speed")) .metric-value {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--warning);
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .live-trip-metrics .metric-row:hover {
  background-color: var(--surface-4);
}

[data-bs-theme="dark"] .metric-section-title {
  color: var(--text-primary);
}

/* Mobile responsive adjustments */
@media (width <= 576px) {
  .live-trip-metrics .metric-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
  }

  .live-trip-metrics .metric-value {
    text-align: left;
    font-size: 0.95em;
  }

  .metric-section-title {
    font-size: 0.75rem;
  }
}

/* Animation for new metrics appearing */
.live-trip-metrics .metric-row {
  animation: fadeInMetric 0.3s ease-in-out;
}

@keyframes fadeInMetric {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Status indicators for different metric types */
.metric-base::before {
  content: "●";
  color: var(--success);
  margin-right: 0.5rem;
  font-size: 0.6rem;
}

.metric-advanced::before {
  content: "▶";
  color: var(--info);
  margin-right: 0.5rem;
  font-size: 0.6rem;
}

/* Notifications */
.notification-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 380px; /* Slightly wider */
  pointer-events: none; /* Container itself shouldn't block clicks */
}

.notification {
  background-color: var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.215, 0.61, 0.355, 1),
    opacity 0.3s ease; /* Smoother transition */

  pointer-events: auto; /* Individual notifications are interactive */
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: flex-start; /* Align items to top for multi-line messages */
  width: 100%;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification-icon {
  font-size: var(--font-size-xl);
  margin-right: var(--space-3);
  margin-top: var(--space-1); /* Align icon better with text */
  flex-shrink: 0; /* Prevent icon from shrinking */
}

.notification-content {
  flex: 1;
  min-width: 0; /* Allow content to shrink if needed */
}

.notification-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.notification-message {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

.notification-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--space-1);
  margin-left: var(--space-2);
  font-size: var(--font-size-lg);
  transition: color var(--transition-fast);
  align-self: flex-start; /* Align close button to top right */
}

.notification-close:hover {
  color: var(--text-secondary);
}

/* Notification variants */
.notification-success {
  border-left-color: var(--success);
}

.notification-success .notification-icon {
  color: var(--success);
}

.notification-error {
  border-left-color: var(--danger);
}

.notification-error .notification-icon {
  color: var(--danger);
}

.notification-warning {
  border-left-color: var(--warning);
}

.notification-warning .notification-icon {
  color: var(--warning);
}

.notification-info {
  border-left-color: var(--info);
}

.notification-info .notification-icon {
  color: var(--info);
}

/* Hero Section (from coverage_management.html) */
.hero-section {
  background: linear-gradient(
    135deg,
    rgb(var(--primary-rgb), 0.1),
    rgb(var(--primary-rgb), 0.05)
  );
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
}

.hero-section::before {
  /* Animated background element */
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgb(var(--primary-rgb), 0.08) 0%,
    transparent 70%
  );
  animation: pulse-hero 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-hero {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.4;
  }
}

.hero-section h1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-3);
}

.hero-section .lead {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  max-width: 700px; /* Limit lead text width */
}

.hero-section .display-4 {
  /* For large numbers */
  font-size: var(--font-size-display);
  color: var(--primary);
}

body.light-mode .hero-section {
  background: linear-gradient(
    135deg,
    rgb(var(--primary-rgb), 0.08),
    rgb(var(--primary-rgb), 0.03)
  );
}

body.light-mode .hero-section::before {
  background: radial-gradient(
    circle,
    rgb(var(--primary-rgb), 0.05) 0%,
    transparent 70%
  );
}

/* Stat Item (from coverage_management.html) */
.stat-item {
  padding: var(--space-4);
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all var(--transition-normal);
  border: 1px solid var(--border-color);
}

.stat-item:hover {
  background: var(--surface-3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-item .stat-icon {
  /* Optional icon for stat items */
  font-size: var(--font-size-2xl);
  color: var(--primary);
  margin-bottom: var(--space-2);
}

.stat-item .stat-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.stat-item .stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Steps Component (from coverage_management.html) */
.steps-container {
  position: relative;
  margin-bottom: var(--space-8);
  display: flex;
  justify-content: space-between;
}

.steps-container::after {
  /* The connecting line */
  content: "";
  position: absolute;
  width: calc(100% - 80px); /* Adjust based on step icon size and padding */
  height: 2px;
  background-color: var(--surface-3);
  top: 20px; /* Vertically center with icon */
  left: 40px; /* Start after first icon */
  z-index: var(--z-base);
}

.step {
  text-align: center;
  position: relative;
  z-index: calc(var(--z-base) + 1); /* Above the line */
  width: auto; /* Allow natural width or set fixed if needed */
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--surface-2);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
  border: 3px solid var(--surface-3);
  transition: all var(--transition-normal);
  font-size: var(--font-size-lg);
  box-shadow: var(--shadow-sm);
}

.step-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  transition: all var(--transition-normal);
  font-weight: var(--font-weight-medium);
}

.step.active .step-icon {
  background-color: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary-dark);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgb(var(--primary-rgb), 0.3);
}

.step.active .step-label {
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
}

.step.complete .step-icon {
  background-color: var(--success);
  color: var(--text-on-dark);
  border-color: var(--success-dark);
}

.step.complete .step-label {
  color: var(--success);
}

.step.error .step-icon {
  background-color: var(--danger);
  color: var(--text-on-dark);
  border-color: var(--danger-dark);
  animation: error-pulse 1s ease infinite alternate;
}

.step.error .step-label {
  color: var(--danger);
}

@keyframes error-pulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.05);
  }
}

/* Alerts (Enhanced from coverage_management.html) */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start; /* For multi-line alerts with icons */
  animation: fadeIn 0.3s ease forwards;
}

.alert-icon {
  /* Optional dedicated icon element */
  margin-right: var(--space-3);
  font-size: var(--font-size-xl);
  margin-top: var(--space-1);
}

.alert-heading {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
}

.alert .btn-close {
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  margin-left: auto; /* Push to the right */
  padding: var(--space-3); /* Easier to click */
}

.alert .btn-close:hover {
  opacity: 1;
}

.alert-primary {
  background-color: rgb(var(--primary-rgb), 0.1);
  border-color: rgb(var(--primary-rgb), 0.3);
  color: var(--primary-dark);
}

.alert-primary .alert-icon,
.alert-primary .alert-heading {
  color: var(--primary-dark);
}

body.light-mode .alert-primary {
  color: var(--primary-dark);
} /* Ensure text contrast */

.alert-success {
  background-color: rgb(var(--success-rgb), 0.1);
  border-color: rgb(var(--success-rgb), 0.3);
  color: var(--success-dark);
}

.alert-success .alert-icon,
.alert-success .alert-heading {
  color: var(--success-dark);
}

body.light-mode .alert-success {
  color: var(--success-dark);
}

.alert-danger {
  background-color: rgb(var(--danger-rgb), 0.1);
  border-color: rgb(var(--danger-rgb), 0.3);
  color: var(--danger-dark);
}

.alert-danger .alert-icon,
.alert-danger .alert-heading {
  color: var(--danger-dark);
}

body.light-mode .alert-danger {
  color: var(--danger-dark);
}

.alert-warning {
  background-color: rgb(var(--warning-rgb), 0.1);
  border-color: rgb(var(--warning-rgb), 0.3);
  color: var(--warning-dark);
}

.alert-warning .alert-icon,
.alert-warning .alert-heading {
  color: var(--warning-dark);
}

body.light-mode .alert-warning {
  color: var(--warning-dark);
}

.alert-info {
  background-color: rgb(var(--info-rgb), 0.1);
  border-color: rgb(var(--info-rgb), 0.3);
  color: var(--info-dark);
}

.alert-info .alert-icon,
.alert-info .alert-heading {
  color: var(--info-dark);
}

body.light-mode .alert-info {
  color: var(--info-dark);
}

/* Modal Enhancements (from coverage_management.html) */
.modal-content {
  background-color: var(--surface-1);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(10px); /* If supported, for content behind modal */
  border-radius: var(--radius-lg);
}

.modal-header {
  border-bottom: 1px solid var(--divider-color);
  padding: var(--space-4);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

.modal-body {
  padding: var(--space-4);
}

.modal-footer {
  border-top: 1px solid var(--divider-color);
  padding: var(--space-3) var(--space-4);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

.btn-close-white {
  /* Ensure close button is visible in dark mode */
  filter: invert(1) grayscale(100%) brightness(200%);
}

body.light-mode .btn-close-white {
  filter: none;
}

/* Tooltips (from coverage_management.html) */
.tooltip-inner {
  background-color: var(--surface-glass);
  backdrop-filter: blur(5px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
}

.tooltip.show {
  opacity: 1;
}

.bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow::before,
.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: var(--border-color); /* Match border */
}

/* Add for other placements as needed */

/* Container layout */
.container-fluid,
.container {
  width: 100%;
  padding-right: var(--space-4);
  padding-left: var(--space-4);
  margin-right: auto;
  margin-left: auto;
}

.container {
  max-width: var(--content-max-width);
}

/* === Utility Classes === */
.text-primary {
  color: var(--primary) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
} /* Note: this is different from --secondary color */
.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.text-info {
  color: var(--info) !important;
}

.text-light {
  color: var(--text-tertiary) !important;
} /* For lighter text on dark backgrounds */
.text-dark {
  color: var(--text-primary) !important;
} /* For darker text on light backgrounds */

.bg-primary {
  background-color: var(--primary) !important;
  color: var(--text-on-primary) !important;
}

/* Add other .bg-color utilities as needed */

.text-center {
  text-align: center !important;
}

.text-start {
  text-align: left !important;
} /* Assuming LTR */
.text-end {
  text-align: right !important;
} /* Assuming LTR */

.mb-1 {
  margin-bottom: var(--space-1) !important;
}

.mb-2 {
  margin-bottom: var(--space-2) !important;
}

.mb-3 {
  margin-bottom: var(--space-3) !important;
}

.mb-4 {
  margin-bottom: var(--space-4) !important;
}

.mb-5 {
  margin-bottom: var(--space-5) !important;
}

.mt-1 {
  margin-top: var(--space-1) !important;
}

.mt-2 {
  margin-top: var(--space-2) !important;
}

.mt-3 {
  margin-top: var(--space-3) !important;
}

.mt-4 {
  margin-top: var(--space-4) !important;
}

.mt-5 {
  margin-top: var(--space-5) !important;
}

/* Add other margin/padding utilities (mx, my, p-*, pt-*, etc.) as needed */

.p-0 {
  padding: 0 !important;
}

.p-1 {
  padding: var(--space-1) !important;
}

.p-2 {
  padding: var(--space-2) !important;
}

.p-3 {
  padding: var(--space-3) !important;
}

.p-4 {
  padding: var(--space-4) !important;
}

.d-none {
  display: none !important;
}

.d-inline {
  display: inline !important;
}

.d-inline-block {
  display: inline-block !important;
}

.d-block {
  display: block !important;
}

.d-flex {
  display: flex !important;
}

.d-inline-flex {
  display: inline-flex !important;
}

.justify-content-start {
  justify-content: flex-start !important;
}

.justify-content-end {
  justify-content: flex-end !important;
}

.justify-content-center {
  justify-content: center !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.justify-content-around {
  justify-content: space-around !important;
}

.justify-content-evenly {
  justify-content: space-evenly !important;
}

.align-items-start {
  align-items: flex-start !important;
}

.align-items-end {
  align-items: flex-end !important;
}

.align-items-center {
  align-items: center !important;
}

.align-items-baseline {
  align-items: baseline !important;
}

.align-items-stretch {
  align-items: stretch !important;
}

.flex-grow-1 {
  flex-grow: 1 !important;
}

.w-100 {
  width: 100% !important;
}

.h-100 {
  height: 100% !important;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visually-hidden,
.visually-hidden-focusable:not(:focus, :active) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* === Animations === */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  animation: slideUp 0.4s ease forwards;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-down {
  animation: slideInDown 0.4s ease forwards;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 0.8s linear infinite;
} /* Generic spinner class */

/* === Accessibility === */

/* Focus visible for keyboard users, not for mouse users */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 0.2rem rgb(var(--primary-rgb), 0.25); /* Consistent with form inputs */
}

/* Remove default outline if :focus-visible is supported and not matched */
:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card,
  .side-panel,
  .control-panel,
  .modal-content {
    border: 2px solid currentcolor; /* Use current text color for borders */
  }

  .btn {
    border-width: 2px;
    border-style: solid; /* Ensure border is solid */
  }

  .btn-primary, .btn-secondary /* etc. */ {
    border-color: currentcolor; /* Ensure contrast for filled buttons */
  }

  .btn-outline {
    border-color: currentcolor;
  }

  .form-control,
  .form-select {
    border-width: 2px;
    border-color: currentcolor;
  }
}

/* === Print Styles === */
@media print {
  body {
    background-color: #fff !important; /* White background for printing */
    color: #000 !important; /* Black text */
    font-size: 12pt; /* Readable print size */
    line-height: 1.4;
  }

  .app-header,
  .mobile-nav-drawer,
  .side-panel,
  .tools-section, /* Hide theme toggle, etc. */
  .menu-toggle-btn,
  .notification-container,
  .loading-overlay,
  .control-panel, /* Hide map control panel */
  .btn, /* Hide most buttons */
  .quick-selections,
  .panel-actions,
  #map-controls /* Hide specific map controls panel if it's different */ {
    display: none !important;
  }

  .main-content {
    padding-top: 0 !important;
    margin-left: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  .table,
  .table th,
  .table td {
    border-color: #ccc !important;
  }

  a {
    text-decoration: none;
    color: #000 !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")"; /* Show URLs for external links */
    font-size: 90%;
  }

  #map {
    /* Ensure map takes up space if it's the primary content */
    position: static !important;
    height: auto !important; /* Or specific print height */
    width: 100% !important;
    page-break-inside: avoid;
  }

  .container,
  .container-fluid {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}

/* === Media Queries for Responsiveness === */

/* Desktop: Hide mobile map elements */
@media (width >= 769px) {
  .mobile-map-overlay,
  .mobile-fab-container,
  .mobile-bottom-sheet,
  .mobile-sheet-handle {
    display: none !important;
  }
}

@media (width <= 992px) {
  /* Tablet and smaller */
  .main-content.sidebar-active {
    /* If sidebar class is on body or wrapper */
    margin-left: 0;
  }

  .main-nav .nav-item span {
    /* Hide text in main nav, show only icons */
    display: none;
  }

  .main-nav .nav-item i {
    margin-right: 0;
    font-size: var(--font-size-lg); /* Make icons a bit larger */
  }

  .header-container {
    padding: 0 var(--space-3);
  }

  .side-panel {
    width: 280px; /* Keep panel width or adjust as needed */
  }

  .steps-container::after {
    /* Adjust steps line for smaller screens */
    width: calc(100% - 60px);
    left: 30px;
  }

  .step-icon {
    width: 35px;
    height: 35px;
    font-size: var(--font-size-md);
  }

  .step-label {
    font-size: 0.7rem;
  }
}

@media (width <= 768px) {
  /* Mobile landscape and smaller */
  .header-container {
    padding: 0 var(--space-2);
  }

  .brand-text {
    /* Hide brand text, show only icon */
    display: none;
  }

  .main-nav {
    /* Hide desktop nav, mobile drawer takes over */
    display: none;
  }

  .menu-toggle-btn {
    /* Ensure menu toggle is always visible */
    display: flex;
  }

  .side-panel {
    /* Make side panel full width on mobile if it opens */
    width: 100%;
    top: 0; /* Cover header if it's a full overlay */
    height: 100vh;
    border-left: none;
    z-index: var(--z-overlay); /* Ensure it's above content */
  }

  .main-content {
    padding: var(--space-4); /* Adjust main content padding */
  }

  .table-responsive,
  .table-responsive-lg {
    /* Ensure tables are scrollable */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .card-body,
  .card-header,
  .card-footer {
    padding: var(--space-3);
  }

  .hero-section {
    padding: var(--space-6) var(--space-4);
  }

  .hero-section h1 {
    font-size: var(--font-size-2xl);
  }

  .hero-section .lead {
    font-size: var(--font-size-md);
  }

  /* Responsive table from coverage_management.html */
  .table-responsive-lg thead {
    display: none;
  }

  .table-responsive-lg tbody tr {
    display: block;
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-1);
    border: 1px solid var(--border-color);
  }

  .table-responsive-lg tbody td {
    display: block;
    text-align: right;
    padding-left: 50%; /* Make space for label */
    position: relative;
    border-bottom: 1px solid var(--divider-color);
  }

  .table-responsive-lg tbody td::before {
    content: attr(data-label); /* Requires data-label attribute on td */
    position: absolute;
    left: var(--space-3);
    width: 45%;
    text-align: left;
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
  }

  .table-responsive-lg tbody td:last-child {
    border-bottom: none;
  }

  /* Mobile Map - iOS Native App Feel */

  /* Hide desktop controls on mobile */
  .control-panel#map-controls {
    display: none !important;
  }

  /* Full-screen map */
  .map-wrapper {
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 100vh;
    position: fixed;
    inset: 0;
  }

  #map {
    height: 100vh !important;
    width: 100vw !important;
    position: fixed;
    top: 0;
    left: 0;
  }

  /* Adjust header for map page */
  body.map-page .app-header {
    background: transparent;
    backdrop-filter: blur(10px);
    box-shadow: none;
    border-bottom: 1px solid rgb(255 255 255 / 10%);
  }

  body.light-mode.map-page .app-header {
    border-bottom: 1px solid rgb(0 0 0 / 10%);
  }

  /* Mobile Bottom Sheet - iOS Style */
  .mobile-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-1);
    border-radius: 20px 20px 0 0;
    box-shadow:
      0 -4px 30px rgb(0 0 0 / 40%),
      0 -1px 0 rgb(255 255 255 / 10%);
    z-index: var(--z-drawer);
    transition:
      transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
      box-shadow 0.3s;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0);

    --sheet-offset: calc(100% - 180px);

    transform: translateY(var(--sheet-offset));
    will-change: transform;
  }

  .mobile-bottom-sheet:active,
  .mobile-bottom-sheet.dragging {
    box-shadow:
      0 -6px 40px rgb(0 0 0 / 50%),
      0 -1px 0 rgb(255 255 255 / 10%);
  }

  /* Sheet states */
  .mobile-bottom-sheet.collapsed {
    --sheet-offset: calc(100% - 180px); /* Show more by default */
  }

  .mobile-bottom-sheet.peek {
    --sheet-offset: calc(100% - 280px);
  }

  .mobile-bottom-sheet.half {
    --sheet-offset: 45vh;
  }

  .mobile-bottom-sheet.expanded {
    --sheet-offset: 0;
  }

  /* iOS-style handle - with larger touch area */
  .mobile-sheet-handle-container {
    padding: var(--space-3) 0; /* Larger touch target */
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .mobile-sheet-handle-container:active {
    cursor: grabbing;
  }

  .mobile-sheet-handle {
    width: 40px;
    height: 5px;
    background: var(--text-secondary);
    border-radius: 3px;
    opacity: 0.6;
    pointer-events: none; /* Let container handle clicks */
  }

  /* Sheet header */
  .mobile-sheet-header {
    padding: 0 var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--divider-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--surface-1);
    z-index: 10;
    cursor: pointer; /* Make entire header tappable */
    user-select: none;
  }

  .mobile-sheet-header:active {
    background: var(--surface-2);
  }

  .mobile-sheet-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
  }

  .mobile-sheet-actions {
    display: flex;
    gap: var(--space-2);
  }

  /* Sheet content */
  .mobile-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Floating Action Buttons */
  .mobile-fab-container {
    position: fixed;
    right: var(--space-3);
    bottom: calc(
      200px + env(safe-area-inset-bottom, 0)
    ); /* Adjusted for taller collapsed state */

    z-index: calc(var(--z-drawer) - 1);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .mobile-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgb(0 0 0 / 30%);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: var(--font-size-xl);
  }

  .mobile-fab:active {
    transform: scale(0.95);
  }

  .mobile-fab.secondary {
    width: 48px;
    height: 48px;
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: var(--font-size-lg);
  }

  /* iOS-style sections */
  .mobile-section {
    background: var(--surface-2);
    border-radius: 12px;
    padding: var(--space-3);
    margin-bottom: var(--space-3);
  }

  .mobile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
  }

  .mobile-section-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
  }

  .mobile-section-action {
    font-size: var(--font-size-sm);
    color: var(--primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
  }

  /* iOS-style list items */
  .mobile-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--divider-color);
  }

  .mobile-list-item:last-child {
    border-bottom: none;
  }

  .mobile-list-item-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
  }

  .mobile-list-item-value {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
    text-align: right;
  }

  /* iOS-style search */
  .mobile-search {
    background: var(--surface-3);
    border-radius: 10px;
    padding: var(--space-2) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    border: none;
  }

  .mobile-search i {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
  }

  .mobile-search input {
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
    color: var(--text-primary);
    font-size: var(--font-size-md);
  }

  .mobile-search input::placeholder {
    color: var(--text-tertiary);
  }

  /* Live tracking status badge */
  .mobile-live-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: rgb(var(--success-rgb), 0.15);
    color: var(--success);
    padding: var(--space-1) var(--space-3);
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
  }

  .mobile-live-badge.disconnected {
    background: rgb(var(--danger-rgb), 0.15);
    color: var(--danger);
  }

  .mobile-live-badge .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentcolor;
    animation: mobile-pulse 2s infinite;
  }

  @keyframes mobile-pulse {
    0%,
    100% {
      opacity: 1;
      transform: scale(1);
    }

    50% {
      opacity: 0.6;
      transform: scale(0.9);
    }
  }

  /* Metrics grid */
  .mobile-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-top: var(--space-3);
  }

  .mobile-metric-card {
    background: var(--surface-1);
    border-radius: 10px;
    padding: var(--space-3);
    text-align: center;
  }

  .mobile-metric-value {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary);
    margin-bottom: var(--space-1);
  }

  .mobile-metric-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* iOS-style toggle */
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
  }

  .mobile-toggle-label {
    font-size: var(--font-size-md);
    color: var(--text-primary);
  }

  .mobile-toggle input[type="checkbox"] {
    width: 51px;
    height: 31px;
    appearance: none;
    background: var(--surface-4);
    border-radius: 15.5px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
  }

  .mobile-toggle input[type="checkbox"]::before {
    content: "";
    position: absolute;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgb(0 0 0 / 20%);
  }

  .mobile-toggle input[type="checkbox"]:checked {
    background: var(--success);
  }

  .mobile-toggle input[type="checkbox"]:checked::before {
    transform: translateX(20px);
  }

  /* Layer buttons */
  .mobile-layer-buttons {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-2);
  }

  .mobile-layer-buttons::-webkit-scrollbar {
    display: none;
  }

  .mobile-layer-btn {
    flex-shrink: 0;
    padding: var(--space-2) var(--space-4);
    border-radius: 20px;
    background: var(--surface-3);
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
  }

  .mobile-layer-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }

  .mobile-layer-btn i {
    margin-right: var(--space-1);
  }

  /* Street mode selector */
  .mobile-street-modes {
    display: flex;
    background: var(--surface-1);
    border-radius: 10px;
    padding: var(--space-1);
    gap: var(--space-1);
  }

  .mobile-street-mode-btn {
    flex: 1;
    padding: var(--space-2);
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
  }

  .mobile-street-mode-btn.active {
    background: var(--surface-3);
    color: var(--text-primary);
  }

  .mobile-street-mode-btn i {
    font-size: var(--font-size-md);
  }

  /* Action buttons grid */
  .mobile-action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    margin-top: var(--space-3);
  }

  .mobile-action-btn {
    padding: var(--space-3);
    border-radius: 10px;
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
  }

  .mobile-action-btn:active {
    transform: scale(0.97);
    background: var(--surface-2);
  }

  .mobile-action-btn i {
    font-size: var(--font-size-xl);
    color: var(--primary);
  }

  /* Backdrop for when sheet is expanded */
  .mobile-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 30%);
    z-index: calc(var(--z-drawer) - 1);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.3s,
      visibility 0.3s;
  }

  .mobile-sheet-backdrop.visible {
    opacity: 1;
    visibility: visible;
  }

  /* Adjust Mapbox controls for mobile */
  .mapboxgl-ctrl-top-right {
    top: calc(var(--header-height) + var(--space-2)) !important;
    right: var(--space-2) !important;
  }

  .mapboxgl-ctrl-bottom-right {
    bottom: calc(
      200px + env(safe-area-inset-bottom, 0)
    ) !important; /* Adjusted for taller collapsed state */
  }

  /* Safe area support */
  @supports (padding: env(safe-area-inset-bottom)) {
    .mobile-bottom-sheet {
      padding-bottom: calc(env(safe-area-inset-bottom) + var(--space-2));
    }

    .mobile-fab-container {
      bottom: calc(200px + env(safe-area-inset-bottom));
    }
  }

  /* Expand hint in collapsed state */
  .mobile-sheet-expand-hint {
    text-align: center;
    padding: var(--space-2) 0;
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
  }

  .mobile-sheet-expand-hint i {
    animation: mobile-bounce 2s infinite;
  }

  @keyframes mobile-bounce {
    0%,
    100% {
      transform: translateY(0);
    }

    50% {
      transform: translateY(-4px);
    }
  }

  .mobile-bottom-sheet:not(.collapsed) .mobile-sheet-expand-hint {
    display: none;
  }

  /* Compact metrics for mobile */
  .mobile-compact-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    text-align: center;
    padding: var(--space-2) 0;
  }

  .mobile-compact-metric {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2);
    background: var(--surface-2);
    border-radius: var(--radius-md);
  }

  .mobile-compact-metric-value {
    font-weight: var(--font-weight-bold);
    color: var(--primary);
    font-size: var(--font-size-lg);
  }

  .mobile-compact-metric-label {
    color: var(--text-tertiary);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  /* Location selector mobile */
  .mobile-select {
    width: 100%;
    padding: var(--space-3);
    border-radius: 10px;
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba(255,255,255,0.6)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
  }

  body.light-mode .mobile-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba(0,0,0,0.6)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  }

  /* Pull-to-refresh hint */
  .mobile-pull-hint {
    text-align: center;
    padding: var(--space-2);
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
  }
}

@media (width <= 576px) {
  /* Mobile portrait */
  :root {
    /* Adjust base font size for very small screens */
    --font-size-md: 0.9375rem; /* 15px */
  }

  /* Note: .control-panel mobile styles handled above in @media (width <= 768px) */

  .notification-container {
    left: var(--space-2);
    right: var(--space-2);
    top: var(
      --space-2
    ); /* Position below header if header is very short or hidden */

    max-width: calc(100% - var(--space-4));
  }

  .btn-group {
    /* Stack button group vertically */
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
    border-radius: var(--radius-md) !important; /* Reset group overrides */
    margin-bottom: var(--space-2);
  }

  .btn-group .btn:last-child {
    margin-bottom: 0;
  }

  .steps-container {
    flex-wrap: wrap;
  } /* Allow steps to wrap */
  .step {
    width: 33.33%;
    margin-bottom: var(--space-4);
  } /* Example for 3 steps per row */
  .steps-container::after {
    display: none;
  } /* Hide connecting line on small screens */
}

@media (width <= 375px) {
  /* Very small devices */
  .mobile-fab {
    width: 50px;
    height: 50px;
    font-size: var(--font-size-lg);
  }

  .mobile-fab.secondary {
    width: 44px;
    height: 44px;
  }

  .mobile-metrics-grid {
    grid-template-columns: 1fr;
  }

  .mobile-metric-value {
    font-size: var(--font-size-lg);
  }
}
