:root {
  --sidebar-w: 16rem;
  --transition: 240ms;

  /* Safe area insets pour iOS (notch, barre du bas) */
  --sat: env(safe-area-inset-top);
  --sar: env(safe-area-inset-right);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial;
  margin: 0;
  color: #202124;
  background: #f8f9fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Pill-shaped button utility class */
button:not(input):not(select):not(textarea) {
  border-radius: 1.5rem !important;
}

.logo {
  height: 50px;
  width: auto;
  display: block;
}

.app-logo {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
  border-radius: 50%;
}

.app-logo:hover {
  transform: scale(1.05);
}

/* Company Logo styles removed - logo now only in main content header */

/* Company Header in Main Layout */
.company-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #dadce0;
  margin-bottom: 1rem;
}

/* Standardized border color for Tailwind's border-gray-200 equivalent */
.border-gray-200 {
  border-color: #dadce0 !important;
}

.company-header-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  flex-shrink: 0;
}

.company-header-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.company-header-name {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.3;
}

.company-header-version {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Hide company header when no data */
.company-header:not(:has(.company-header-logo[src]:not([src=""]))) .company-header-logo {
  display: none;
}

/* Responsive adjustments for company header */
@media (max-width: 768px) {
  .company-header {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .company-header-logo {
    width: 40px;
    height: 40px;
  }

  .company-header-name {
    font-size: 0.875rem;
  }
}

.toast {
  position: fixed;
  bottom: 70px;
  right: 20px;
  background: white;
  color: #202124;
  padding: 12px 16px;
  border-radius: 0.5rem;
  border-left: 4px solid #1a73e8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
  min-width: 250px;
  max-width: 400px;
  font-size: 0.875rem;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-10px);
}

.toast.success {
  border-left-color: #10b981;
  color: #065f46;
}

.toast.info {
  border-left-color: #3b82f6;
  color: #1e40af;
}

.toast.warning {
  border-left-color: #f59e0b;
  color: #92400e;
}

.toast.error {
  border-left-color: #ef4444;
  color: #991b1b;
}

.progress-container {
  margin-top: 10px;
  display: none;
  align-items: center;
  gap: 10px;
}

progress {
  width: 100%;
  height: 16px;
  transition: width 0.3s ease;
}

#tripsTable tbody tr:hover {
  background-color: #f1f3f4;
}

/* Sticky table header */
#tripsTable thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f9fafb;
}

#tripsTable thead th {
  background-color: #f9fafb;
}

/* Ensure the table container allows sticky positioning */
.flex-1.overflow-auto.bg-white.rounded.shadow {
  position: relative;
}

/* Awesomplete dropdown z-index fix - must appear above table header and form */
.awesomplete {
  position: relative;
  z-index: 1000;
}

.awesomplete > ul {
  z-index: 9999 !important;
  position: absolute !important;
}

/* Ensure awesomplete container doesn't clip dropdown */
.awesomplete mark {
  background: #ffeb3b;
}

/* Form container overflow fix for Awesomplete */
#tripFormContainer {
  overflow: visible !important;
  /* Increase z-index to ensure it's above table */
  z-index: 100 !important;
}

#tripFormContent {
  overflow: visible !important;
}

/* ========================================
   App Header - Full-width Sticky Header
   ======================================== */

#appHeader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: white;
  border-bottom: 1px solid #dadce0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  /* Safe area pour iOS */
  padding-top: var(--sat);
  padding-left: max(1.5rem, var(--sal));
  padding-right: max(1.5rem, var(--sar));
}

.app-header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.app-header-logo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.app-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.app-header-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: #202124;
}

.app-header-version {
  font-size: 0.75rem;
  color: #5f6368;
}

/* ========================================
   App Footer - Full-width Professional Footer
   ======================================== */

#appFooter {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: white;
  border-top: 1px solid #dadce0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 90;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
  /* Safe area pour iOS */
  padding-bottom: var(--sab);
  padding-left: max(1.5rem, var(--sal));
  padding-right: max(1.5rem, var(--sar));
}

.app-footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8rem;
  color: #5f6368;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-app-name {
  font-weight: 700;
  color: #202124;
  font-size: 0.875rem;
}

.footer-version {
  font-size: 0.7rem;
  color: #80868b;
  padding: 0.15rem 0.5rem;
  background: #f1f3f4;
  border-radius: 12px;
}

.footer-center {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #1a73e8;
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #1557b0;
}

.footer-link i {
  font-size: 0.9rem;
}

/* Layout & Sidebar */
#appLayout {
  display: flex;
  height: 100vh;
  padding-top: 0; /* No header */
  padding-bottom: 0; /* No footer */
  transition: all var(--transition) ease;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  overflow-y: auto;
  background: #f1f3f4;
  z-index: 50;
  will-change: transform;
}

.sidebar>* {
  visibility: visible;
  opacity: 1;
}

/* Collapsed sidebar state */
.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
  overflow: hidden;
}

.sidebar.collapsed .flex-1.overflow-y-auto,
.sidebar.collapsed footer {
  display: none;
}

.sidebar.collapsed #toggleSidebarBtn {
  margin: 0 auto;
}

.sidebar.collapsed .flex.items-center.mb-6 {
  justify-content: center;
}

/* Main content adjustment when sidebar is collapsed */
.main.sidebar-collapsed {
  margin-left: 0;
}

.main {
  flex: 1;
  transition: margin-left var(--transition) ease;
}

.layout-collapsed .sidebar {
  width: 0 !important;
  transform: translateX(-100%);
  min-width: 0 !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

.layout-collapsed .main {
  margin-left: 0;
}

/* Overlay backdrop for mobile sidebar */
@media (max-width: 800px) {
  #appLayout::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
  }

  #appLayout:not(.layout-collapsed)::before {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

#toggleSidebarBtn,
#openSidebarBtn,
#loadPatientsBtn,
#saveBackupBtn,
#loadBackupBtn,
#btnClearCache {
  visibility: visible;
  opacity: 1;
}

/* Unified burger button - always top-left, outside sidebar */
.sidebar-burger-btn,
#sidebarToggle {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1a73e8;
  border: none;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  font-size: 1.2rem;
}

.sidebar-burger-btn:hover,
#sidebarToggle:hover {
  background: #1557b0;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.5);
}

.sidebar-burger-btn:active,
#sidebarToggle:active {
  transform: scale(0.95);
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* License Screen */
.license-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: system-ui, -apple-system, sans-serif;
}

/* Styles pour le bouton de retour licence */
.license-back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dadce0;
  border-radius: 1.5rem; /* Pill shape */
  padding: 10px 15px;
  font-size: 0.9rem;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10001;
  backdrop-filter: blur(10px);
}

.license-back-btn:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #2d3748;
}

.license-back-btn:active {
  transform: translateY(0);
}

.license-container {
  position: relative;
  background: white;
  border-radius: 0.5rem;
  padding: 2.5rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  text-align: center;
  animation: slideUp 0.5s ease-out;
}

.license-header {
  margin-bottom: 2rem;
}

.license-logo {
  height: 60px;
  margin-bottom: 1rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.license-header h1 {
  color: #2d3748;
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
}

.license-subtitle {
  color: #718096;
  margin: 0;
}

.license-state {
  transition: all 0.3s ease;
}

.loading-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1a73e8;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.license-form h2 {
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.license-form>p {
  color: #718096;
  margin-bottom: 1.5rem;
}

/* Styles pour les informations d'utilisation de licence */
.license-usage-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: #0369a1;
  font-size: 0.9rem;
  text-align: center;
}

.license-usage-success {
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: #065f46;
  font-size: 0.9rem;
  text-align: center;
}

.success-message {
  padding: 1rem 0;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.success-message h3 {
  color: #059669;
  margin-bottom: 0.5rem;
}

/* Ajouter au bouton continuer */
#license-continue {
  margin-top: 1rem;
  width: 100%;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.license-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #dadce0;
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.license-input:focus {
  outline: none;
  border-color: #1a73e8;
}

.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 1.5rem; /* Pill shape */
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #1a73e8;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #1557b0;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f8f9fa;
  color: #4a5568;
  border: 1px solid #dadce0;
}

.btn-secondary:hover {
  background: #edf2f7;
}

.license-help {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-top: 1.5rem;
}

.license-help p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #718096;
}

.license-help a {
  color: #1a73e8;
  text-decoration: none;
}

.license-help a:hover {
  text-decoration: underline;
}

.error-message,
.demo-message {
  padding: 1rem 0;
}

.error-icon,
.demo-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error-message h3 {
  color: #e53e3e;
  margin-bottom: 0.5rem;
}

.demo-message h3 {
  color: #2d3748;
}

.demo-features {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1.5rem 0;
  text-align: left;
}

.demo-features span {
  padding: 0.25rem 0;
}

.license-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #dadce0;
}

.version {
  color: #a0aec0;
  font-size: 0.8rem;
  margin: 0;
}

.hidden {
  display: none !important;
}

/* License Status Badge */
.license-status-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.license-status-valid {
  background: #d1fae5;
  color: #065f46;
}

.license-status-demo {
  background: #fef3c7;
  color: #92400e;
}

.license-status-invalid {
  background: #fee2e2;
  color: #991b1b;
}

.demo-counter {
  background: #f59e0b;
  color: white;
  border-radius: 10px;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* Export Controls */
.export-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-left: auto;
}

.export-control-group {
  display: flex;
  flex-direction: column;
}

.export-control-label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 4px;
  white-space: nowrap;
}

.export-control {
  border: 1px solid #dadce0;
  border-radius: 0.375rem;
  padding: 8px 12px;
  font-size: 0.875rem;
  background: white;
  height: 40px;
  box-sizing: border-box;
}

#exportMonth {
  min-width: 120px;
}

#exportYear {
  min-width: 90px;
}

#employeeName {
  min-width: 160px;
}

/* Buttons Hover Effects */
#addBtn,
#calcAllBtn,
#exportCsvBtn,
#clearBtn {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

#addBtn:hover,
#calcAllBtn:hover,
#exportCsvBtn:hover,
#clearBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#addBtn:active,
#calcAllBtn:active,
#exportCsvBtn:active,
#clearBtn:active {
  transform: translateY(0);
}

/* Animations */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

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

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

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes successFlash {
  0% {
    background-color: #10b981;
  }

  50% {
    background-color: #34d399;
  }

  100% {
    background-color: #10b981;
  }
}

.export-pulse {
  animation: pulse 2s infinite;
}

.success-flash {
  animation: successFlash 0.5s ease-in-out;
}

/* Demo Option */
.demo-option {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dadce0;
}

.demo-option .btn-secondary {
  width: 100%;
  margin-bottom: 0.5rem;
}

/* Loading States */
.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Styles pour les détails de licence dans la sidebar */
#license-details {
  border-top: 1px solid #dadce0;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

#license-key-display {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  background: #f8f9fa;
  padding: 2px 4px;
  border-radius: 3px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#license-usage-display {
  font-weight: 600;
  color: #1f2937;
}

/* Responsive Design */
@media (max-width: 1280px) {
  .grid.grid-cols-1.sm\:grid-cols-3.md\:grid-cols-7 {
    grid-template-columns: repeat(4, 1fr);
  }

  #exportMonth {
    width: 130px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.1);
  }

  #exportMonth {
    width: 120px;
  }

  .grid.grid-cols-1.sm\:grid-cols-3.md\:grid-cols-7 {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
  }
}

@media (max-width: 800px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 65;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.06);
  }

  .layout-collapsed .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }

  .layout-collapsed .main {
    margin-left: 0;
  }

  /* Force sidebar to be collapsed by default on mobile */
  body {
    --sidebar-collapsed-on-mobile: true;
  }
}

/* FAB (Floating Action Button) for adding trips on mobile */
.fab-add-trip,
#fabAddTrip {
  display: none; /* Hidden on desktop */
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a73e8;
  border: none;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  font-size: 1.5rem;
  align-items: center;
  justify-content: center;
}

.fab-add-trip:hover,
#fabAddTrip:hover {
  background: #1557b0;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(26, 115, 232, 0.6);
}

.fab-add-trip:active,
#fabAddTrip:active {
  transform: scale(0.95);
}

/* Form on mobile */
#tripFormContainer {
  transition: all 0.3s ease-out;
}

#tripFormContent {
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  overflow: hidden;
}

#tripFormContent.collapsed {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

/* Hide form container when collapsed on mobile */
#tripFormContainer.mobile-hidden {
  display: none;
}

@media (max-width: 768px) {
  /* Show FAB on mobile */
  .fab-add-trip,
  #fabAddTrip {
    display: flex !important;
  }

  /* Hide form by default on mobile */
  #tripFormContainer {
    display: none !important;
  }

  /* Show form when active */
  #tripFormContainer.active {
    display: block !important;
  }

  /* Form content on mobile */
  #tripFormContent {
    max-height: 2000px; /* Large enough for all content */
  }

  .license-back-btn span {
    display: none;
    /* Cache le texte sur mobile, garde l'icône */
  }

  .license-back-btn {
    top: 15px;
    left: 15px;
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  /* Formulaire d'ajout de trajet - mobile optimisé */
  .grid.grid-cols-1.sm\:grid-cols-4.md\:grid-cols-8 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Optimisation du padding principal */
  .tab-content {
    padding: 0.75rem !important;
  }

  #openSidebarBtn {
    left: 12px;
    top: 12px;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }


  /* Panneau de contrôle mobile */
  .table-control-panel {
    padding: 0.5rem !important;
  }

  /* Formulaire sticky - ajustements mobiles */
  .sticky.top-0.z-20 {
    padding: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Labels de formulaire plus compacts */
  .sticky.top-0.z-20 label {
    font-size: 0.75rem !important;
    margin-bottom: 0.25rem !important;
  }

  /* Inputs de formulaire */
  .sticky.top-0.z-20 input,
  .sticky.top-0.z-20 select {
    padding: 0.5rem !important;
    font-size: 0.875rem !important;
  }

  /* Bouton ajouter mobile */
  #addBtn {
    padding: 0.6rem 1rem !important;
    font-size: 0.875rem !important;
  }

  /* Company header mobile */
  .company-header {
    padding: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }
}

@media (max-width: 600px) {

  /* Réduction du padding global */
  .tab-content {
    padding: 0.5rem !important;
  }

  /* Formulaire ultra-compact */
  .sticky.top-0.z-20 {
    padding: 0.5rem !important;
    gap: 0.5rem !important;
  }

  /* Table responsive - card layout */
  #tripsTable {
    font-size: 0.8rem;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  tbody tr.row-selected {
    border-left: 4px solid #3b82f6 !important;
    background-color: #eff6ff !important;
  }

  td {
    border: none;
    position: relative;
    padding: 0.4rem 0 !important;
    text-align: left !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Checkbox cell */
  td:first-child {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0 !important;
    width: auto;
  }

  /* Labels pour les cellules mobiles */
  td:not(:first-child)::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    width: 40%;
  }

  /* Actions cell */
  td:last-child {
    justify-content: flex-start;
    padding-top: 0.5rem !important;
    margin-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
  }

  td:last-child::before {
    content: '';
    display: none;
  }

  /* Toast mobile */
  .toast {
    bottom: 50px;
    right: 10px;
    left: 10px;
    max-width: none;
    font-size: 0.8rem;
  }

  /* Open sidebar button */
  #openSidebarBtn {
    left: 10px;
    top: 10px;
    width: 48px;
    height: 48px;
    font-size: 1.15rem;
  }

  /* Optimisation des sections de config */
  #configTab .p-4,
  #licenseTab .p-4,
  #usageTab .p-4,
  #backupTab .p-4,
  #logsTab .p-4,
  #privacyTab .p-4 {
    padding: 0.75rem !important;
  }

  #configTab .grid-cols-2,
  #licenseTab .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  /* Boutons plus accessibles au pouce */
  button {
    min-height: 44px;
  }

  /* Inputs plus accessibles */
  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px !important; /* Empêche le zoom sur iOS */
  }
}

/* iPhone SE et petits téléphones */
@media (max-width: 375px) {

  .tab-content {
    padding: 0.4rem !important;
  }

  .sticky.top-0.z-20 {
    padding: 0.4rem !important;
  }

  .table-control-panel {
    padding: 0.4rem !important;
  }

  tbody tr {
    padding: 0.5rem;
  }

  .toast {
    font-size: 0.75rem;
    padding: 10px 12px;
  }
}

/* Mode paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .sticky.top-0.z-20 {
    position: relative !important;
  }
}

/* Styles pour la section Usage des API dans l'en-tête */
.usage-api-section {
  max-height: 400px;
  overflow-y: auto;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

.usage-api-section h4 {
  margin-bottom: 0.75rem;
}

.service-stat {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.service-stat:last-child {
  margin-bottom: 0;
}

/* Assurer que la sidebar ne devient pas trop longue */
.sidebar-header {
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}


/* Animation pour l'affichage des logs */
#logsSection {
  transition: all 0.3s ease-in-out;
}

/* Style pour le bouton actif */
.bg-blue-50 {
  background-color: #eff6ff;
}

.border-blue-300 {
  border-color: #93c5fd;
}

/* Styles pour les onglets */
.tab-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.tab-btn.active {
  background-color: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}

/* Animation de transition pour les onglets */
.tab-content {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

/* Style pour le bouton d'onglet actif */
.bg-blue-50 {
  background-color: #eff6ff;
}

.border-blue-200 {
  border-color: #bfdbfe;
}

.text-blue-700 {
  color: #1d4ed8;
}

/* Styles pour l'onglet configuration */
.bg-blue-50 { background-color: #eff6ff; }
.border-blue-200 { border-color: #bfdbfe; }
.text-blue-800 { color: #1e40af; }

.bg-green-50 { background-color: #f0fdf4; }
.border-green-200 { border-color: #bbf7d0; }
.text-green-800 { color: #166534; }

.bg-yellow-50 { background-color: #fefce8; }
.border-yellow-200 { border-color: #fef08a; }
.text-yellow-800 { color: #854d0e; }

.bg-purple-50 { background-color: #faf5ff; }
.border-purple-200 { border-color: #e9d5ff; }
.text-purple-800 { color: #6b21a8; }

.bg-gray-50 { background-color: #f9fafb; }
.border-gray-200 { border-color: #e5e7eb; }
.text-gray-800 { color: #1f2937; }


/* Styles pour les cartes de taux */
.reimbursement-card {
    transition: all 0.3s ease-in-out;
}

.reimbursement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   API Services Section - Configuration Tab
   ======================================== */

.api-services-section {
    background: linear-gradient(135deg, #fafbfc 0%, #f3f4f6 100%);
}

/* Service Cards */
.service-card {
    background: white;
    transition: all 0.2s ease-in-out;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

/* Service card for default service */
.service-card.border-purple-300 {
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.1), 0 4px 6px rgba(168, 85, 247, 0.1);
}

.service-card.border-purple-300:hover {
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.2), 0 8px 16px rgba(168, 85, 247, 0.15);
}

/* Service card for unavailable service */
.service-card.border-red-200 {
    opacity: 0.85;
}

.service-card.border-red-200:hover {
    opacity: 1;
}

/* Progress bar styles for service usage */
.service-card .h-1\.5 {
    background: #e5e7eb;
}

.service-card .h-1\.5 > div {
    transition: width 0.5s ease-out;
}

/* Service icon styling */
.service-card i.fa-solid,
.service-card i.fa-regular {
    transition: color 0.2s ease;
}

/* Legend styling */
.api-services-section .border-t {
    border-color: #e5e7eb;
}

/* Configuration tab section headers */
#configTab h3 {
    color: #374151;
}

#configTab h3 i {
    font-size: 1rem;
}

/* Smooth transitions for all config sections */
#configTab > .bg-white > .space-y-6 > div {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

#configTab > .bg-white > .space-y-6 > div:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Better visual hierarchy for section borders */
#configTab .p-4.border {
    border-color: #e5e7eb;
}

/* Status indicator pulse animation */
@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.service-card .w-2.h-2.rounded-full.bg-green-500 {
    animation: statusPulse 2s ease-in-out infinite;
}

/* Progress bar warning colors */
.service-card .bg-orange-500 {
    background-color: #f97316;
}

.service-card .bg-yellow-500 {
    background-color: #eab308;
}

.service-card .bg-red-500 {
    background-color: #ef4444;
}

/* Font Awesome icon consistency */
#configTab i.fa-solid,
#configTab i.fa-regular {
    width: 1em;
    text-align: center;
}

/* Responsive adjustments for service cards */
@media (max-width: 1024px) {
    #allServicesDisplay {
        grid-template-columns: 1fr;
    }

    #usageServicesDisplay {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    /* Service cards mobile optimization */
    .service-card {
        padding: 0.75rem !important;
    }

    .service-card h4 {
        font-size: 0.9rem !important;
    }

    .service-card .text-xs {
        font-size: 0.7rem !important;
    }

    /* Stats display mobile */
    #usageServicesDisplay {
        gap: 0.75rem;
    }

    /* Reimbursement cards mobile */
    .reimbursement-card {
        padding: 0.75rem !important;
    }

    .reimbursement-card .text-2xl {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 600px) {
    .grid.grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
}

/* Dark mode support preparation */
@media (prefers-color-scheme: dark) {
    .api-services-section {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }

    .service-card {
        background: #1f2937;
        border-color: #374151;
    }

    .service-card .text-gray-800 {
        color: #f3f4f6;
    }

    .service-card .text-gray-600 {
        color: #9ca3af;
    }

    .service-card .text-gray-500 {
        color: #6b7280;
    }
}

/* ========================================
   Map Panel Styles
   ======================================== */

.map-panel {
    width: 40%;
    min-width: 400px;
    max-width: 600px;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #dadce0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 40;
}

.map-panel.hidden {
    width: 0;
    min-width: 0;
    opacity: 0;
    overflow: hidden;
    border-left: none;
}

.map-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #dadce0;
    flex-shrink: 0;
}

.map-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #202124;
    font-size: 0.875rem;
}

.map-panel-title i {
    color: #5f6368;
}

.map-panel-actions {
    display: flex;
    gap: 0.5rem;
}

.map-panel-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dadce0;
    border-radius: 1.5rem; /* Pill shape */
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-panel-btn:hover {
    background: #f1f3f4;
    color: #374151;
    border-color: #dadce0;
}

/* Close button - Subtle styling matching app design */
.map-panel-btn-close {
    width: 32px;
    height: 32px;
    background: white;
    color: #5f6368;
    border-color: #dadce0;
    font-size: 0.875rem;
}

.map-panel-btn-close:hover {
    background: #f1f3f4;
    color: #202124;
    border-color: #dadce0;
}

.map-panel-btn-close:active {
    background: #e8eaed;
}

.map-container {
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

/* Trip Info Section */
.map-trip-info {
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid #dadce0;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.trip-info-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.trip-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #202124;
    font-size: 0.75rem;
}

.trip-info-item i {
    color: #5f6368;
    font-size: 0.7rem;
}

.trip-info-addresses {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.trip-info-address {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #5f6368;
    font-size: 0.7rem;
    line-height: 1.3;
}

.address-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.address-departure {
    background: #22c55e;
    border: 1px solid #16a34a;
}

.address-arrival {
    background: #ef4444;
    border: 1px solid #dc2626;
}


/* Leaflet custom popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 0.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #dadce0;
}

.leaflet-popup-content {
    margin: 10px 14px;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.map-popup-title {
    font-weight: 500;
    color: #202124;
    margin-bottom: 4px;
}

.map-popup-address {
    color: #5f6368;
    font-size: 0.75rem;
}

/* Custom marker styles */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.marker-departure {
    background: #22c55e;
    border: 2px solid #16a34a;
}

.marker-arrival {
    background: #ef4444;
    border: 2px solid #dc2626;
}

/* Responsive adjustments for map panel */
@media (max-width: 1280px) {
    .map-panel {
        width: 45%;
    }
}

@media (max-width: 1024px) {
    .map-panel {
        position: fixed;
        right: 0;
        top: 0;
        width: 50%;
        min-width: 320px;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    }
}

@media (max-width: 768px) {
    .map-panel {
        width: 100%;
        max-width: none;
    }
}

/* ========================================
   Action Buttons - Table Row Actions
   ======================================== */

.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 1.5rem; /* Pill shape */
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    position: relative;
}

/* Map button - Blue/Info styling */
.action-btn.map-btn {
    background: #eff6ff;
    color: #3b82f6;
    border: 1px solid #bfdbfe;
}

.action-btn.map-btn:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.action-btn.map-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

/* Delete button - Red/Danger styling */
.action-btn.delete-btn {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.action-btn.delete-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.action-btn.delete-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

/* Tooltip styles using title attribute */
.action-btn[title] {
    position: relative;
}

.action-btn[title]::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.375rem 0.625rem;
    background: #1f2937;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.action-btn[title]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.action-btn[title]:hover::after,
.action-btn[title]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Focus states for accessibility */
.action-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.action-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .action-btn {
        width: 36px;
        height: 36px;
    }

    /* Hide custom tooltips on touch devices */
    .action-btn[title]::after,
    .action-btn[title]::before {
        display: none;
    }
}

@media (max-width: 600px) {
    .action-buttons {
        justify-content: flex-end;
    }

    .action-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ========================================
   Actions Section Styles
   ======================================== */

.actions-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.actions-section button {
    transition: all 0.2s ease;
}

.actions-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Export Section Styles
   ======================================== */

.export-section {
    background: white;
}

.export-section .export-controls {
    margin-left: 0;
}

/* Responsive adjustments for export section */
@media (max-width: 768px) {
    .export-section .export-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .export-section .export-control-group {
        width: 100%;
    }

    .export-section .export-control {
        width: 100%;
    }
}

/* ========================================
   Bulk Actions Bar
   ======================================== */

.bulk-actions-bar {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideDown 0.3s ease-out;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.bulk-actions-bar.hidden {
  display: none;
}

.bulk-actions-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.bulk-selection-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bulk-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e40af;
  white-space: nowrap;
}

.bulk-actions-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bulk-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 1.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bulk-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.bulk-action-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bulk-action-btn:not(:disabled):active {
  transform: translateY(0);
}

/* Calculate button - Blue */
.bulk-action-calculate {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.bulk-action-calculate:not(:disabled):hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Map button - Purple */
.bulk-action-map {
  background: #8b5cf6;
  color: white;
  border-color: #8b5cf6;
}

.bulk-action-map:not(:disabled):hover {
  background: #7c3aed;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Delete button - Red */
.bulk-action-delete {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.bulk-action-delete:not(:disabled):hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Clear selection button - Text style */
.bulk-action-btn-text {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid #bfdbfe;
  border-radius: 1.5rem;
  font-size: 0.875rem;
  color: #3b82f6;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bulk-action-btn-text:hover {
  background: white;
  border-color: #3b82f6;
  transform: translateY(-1px);
}

/* ========================================
   Checkboxes - Modern Gmail-style
   ======================================== */

.row-checkbox,
.bulk-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #93c5fd;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.row-checkbox:hover,
.bulk-checkbox:hover {
  opacity: 1;
  box-shadow: 0 0 0 6px rgba(147, 197, 253, 0.08);
  border-radius: 3px;
}

.row-checkbox:checked,
.bulk-checkbox:checked {
  opacity: 0.9;
}

/* Checkbox cell styling */
.checkbox-cell {
  text-align: center;
  vertical-align: middle;
  padding: 0.5rem !important;
}

/* ========================================
   Selected Row Highlighting
   ======================================== */

#tripsTable tbody tr.row-selected {
  background-color: #eff6ff !important;
  border-left: 3px solid #3b82f6;
}

#tripsTable tbody tr.row-selected:hover {
  background-color: #dbeafe !important;
}

/* ========================================
   Animations
   ======================================== */

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

/* ========================================
   Unified Control Panel
   ======================================== */

.table-control-panel {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  background: white;
  border: 1px solid #dadce0;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.control-panel-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.section-filters {
  flex: 1;
  min-width: 0; /* Allow flexbox to shrink */
}

.section-stats {
  flex-shrink: 0;
}

.section-actions {
  flex-shrink: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #5f6368;
}

.section-header i {
  font-size: 0.8rem;
  color: #5f6368;
}

.section-title {
  line-height: 1;
}

/* Selection Indicator */
.selection-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #1e40af;
  margin-left: 0.5rem;
  animation: slideInRight 0.2s ease-out;
}

.selection-indicator.hidden {
  display: none;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Filters */
.filter-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
  min-width: 100px;
  max-width: 140px;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: #5f6368;
  white-space: nowrap;
}

.filter-select {
  padding: 0.4rem 0.5rem;
  border: 1px solid #dadce0;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  background: white;
  color: #202124;
  transition: all 0.2s ease;
  cursor: pointer;
  min-width: 0;
}

.filter-select:hover {
  border-color: #bdc1c6;
}

.filter-select:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.filter-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #dadce0;
  border-radius: 50%;
  background: white;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.filter-clear-btn:hover {
  background: #f8f9fa;
  border-color: #bdc1c6;
  color: #202124;
  transform: rotate(90deg);
}

.filter-clear-btn:active {
  background: #e8eaed;
}

/* Divider */
.control-panel-divider {
  width: 1px;
  background: linear-gradient(to bottom, transparent 0%, #dadce0 20%, #dadce0 80%, transparent 100%);
  margin: 0.25rem 0;
  flex-shrink: 0;
}

/* Stats Cards */
.stats-cards {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  background: #f1f3f4;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.stat-icon-trips {
  background: #eff6ff;
  color: #3b82f6;
}

.stat-icon-distance {
  background: #f0fdf4;
  color: #22c55e;
}

.stat-icon-amount {
  background: #fef3c7;
  color: #f59e0b;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #202124;
  line-height: 1;
}

.stat-label {
  font-size: 0.65rem;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
}

/* Actions */
.action-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.action-btn span {
  display: none;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
  transform: translateY(0);
}

/* Tooltips for action buttons */
.action-btn[title] {
  position: relative;
}

.action-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.375rem 0.625rem;
  background: #1f2937;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease forwards;
  pointer-events: none;
  z-index: 100;
}

.action-btn[title]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease forwards;
  pointer-events: none;
  z-index: 100;
}

/* Export - Green accent */
.action-export {
  background: #0f9d58;
  color: white;
  border-color: #0f9d58;
}

.action-export:hover {
  background: #0d8a4d;
  box-shadow: 0 4px 12px rgba(15, 157, 88, 0.4);
}

/* Calculate - Primary blue */
.action-calculate {
  background: #1a73e8;
  color: white;
  border-color: #1a73e8;
}

.action-calculate:hover {
  background: #1557b0;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}

/* Clear - Danger red with outline style */
.action-clear {
  background: white;
  color: #d93025;
  border-color: #d93025;
}

.action-clear:hover {
  background: #d93025;
  color: white;
  box-shadow: 0 4px 12px rgba(217, 48, 37, 0.4);
}

/* ========================================
   Row-Level Map Button
   ======================================== */

.row-map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #bfdbfe;
  border-radius: 50%;
  background: #eff6ff;
  color: #3b82f6;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.row-map-btn:hover:not(.disabled) {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.4);
}

.row-map-btn:active:not(.disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

.row-map-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f1f3f4;
  color: #9ca3af;
  border-color: #e5e7eb;
}

.row-map-btn:focus:not(.disabled) {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.row-map-btn:focus:not(:focus-visible) {
  outline: none;
}

/* ========================================
   Bulk Export Button (Green)
   ======================================== */

.bulk-action-export {
  background: #0f9d58;
  color: white;
  border-color: #0f9d58;
}

.bulk-action-export:not(:disabled):hover {
  background: #0d8a4d;
  box-shadow: 0 4px 12px rgba(15, 157, 88, 0.4);
}

/* ========================================
   Filter Active State
   ======================================== */

.filter-select.active {
  border-color: #1a73e8;
  background: #f0f7ff;
  font-weight: 500;
}

.filter-clear-btn.visible {
  border-color: #1a73e8;
  color: #1a73e8;
}

/* ========================================
   Tooltip for row map button
   ======================================== */

.row-map-btn[title] {
  position: relative;
}

.row-map-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.375rem 0.625rem;
  background: #1f2937;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease forwards;
  pointer-events: none;
  z-index: 100;
}

.row-map-btn[title]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease forwards;
  pointer-events: none;
  z-index: 100;
}

@keyframes tooltipFadeIn {
  to {
    opacity: 1;
  }
}

/* Hide tooltips on touch devices */
@media (hover: none) {
  .row-map-btn[title]::after,
  .row-map-btn[title]::before,
  .action-btn[title]::after,
  .action-btn[title]::before {
    display: none;
  }
}

/* ========================================
   Control Panel Responsive Design
   ======================================== */

@media (max-width: 1024px) {
  .table-control-panel {
    flex-direction: column;
    gap: 1rem;
  }

  .control-panel-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent 0%, #dadce0 20%, #dadce0 80%, transparent 100%);
  }

  .section-stats {
    width: 100%;
  }

  .section-actions {
    width: 100%;
  }

  .action-controls {
    width: 100%;
    justify-content: flex-end;
  }

  .stats-cards {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .filter-group {
    min-width: 0;
    flex: 1 1 calc(50% - 0.25rem);
  }

  .action-controls {
    justify-content: center;
    gap: 0.75rem;
  }

  .action-btn {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .stats-cards {
    width: 100%;
    justify-content: space-between;
  }

  .stat-card {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 600px) {
  .filter-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
    max-width: none;
  }

  .filter-clear-btn {
    align-self: center;
  }

  /* Make row map button larger for touch */
  .row-map-btn {
    width: 36px;
    height: 36px;
  }

  .stats-cards {
    flex-direction: column;
  }

  .stat-card {
    width: 100%;
  }
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
  .bulk-actions-bar {
    padding: 0.5rem;
  }

  .bulk-actions-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .bulk-selection-info {
    justify-content: center;
  }

  .bulk-actions-buttons {
    justify-content: center;
  }

  .bulk-action-btn span,
  .bulk-action-btn-text span {
    display: none;
  }

  .bulk-action-btn,
  .bulk-action-btn-text {
    padding: 0.5rem;
    min-width: 40px;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  /* Checkbox column should remain visible on mobile */
  #tripsTable thead th:first-child,
  #tripsTable tbody td:first-child,
  #tripsTable tfoot td:first-child {
    display: table-cell !important;
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
  }

  #tripsTable thead {
    display: table-header-group !important;
  }

  #tripsTable thead th:first-child {
    background: #f9fafb;
  }
}
/* ========================================
   Update Modal Styles
   ======================================== */

.update-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.update-modal.hidden {
  display: none;
}

.update-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.update-modal-content {
  position: relative;
  width: 90%;
  max-width: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.update-modal-header {
  padding: 2rem;
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
  color: white;
  text-align: center;
  position: relative;
}

.update-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.update-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.update-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.update-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.update-modal-body {
  padding: 2rem;
}

.update-version-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.version-current,
.version-latest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.version-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #5f6368;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.version-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: #202124;
  font-family: 'Courier New', monospace;
}

.version-highlight {
  color: #1a73e8;
  background: #e8f0fe;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
}

.version-arrow {
  color: #80868b;
  font-size: 1.5rem;
}

.update-release-info {
  margin-bottom: 1.5rem;
}

.update-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #202124;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.update-section-title i {
  color: #1a73e8;
}

.update-changelog {
  background: #f8f9fa;
  border-left: 3px solid #1a73e8;
  padding: 1rem;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.changelog-item {
  padding: 0.5rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #5f6368;
  line-height: 1.5;
}

.changelog-item i {
  color: #34a853;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.update-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 1.5rem;
}

.update-detail-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #5f6368;
}

.update-detail-item i {
  width: 20px;
  color: #1a73e8;
}

.update-warning {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
}

.update-warning i {
  font-size: 1.25rem;
  color: #f59e0b;
}

.update-modal-footer {
  padding: 1.5rem 2rem;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.update-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.update-btn-secondary {
  background: white;
  color: #5f6368;
  border: 1px solid #dadce0;
}

.update-btn-secondary:hover {
  background: #f1f3f4;
  border-color: #c0c0c0;
}

.update-btn-primary {
  background: #1a73e8;
  color: white;
  box-shadow: 0 2px 4px rgba(26, 115, 232, 0.3);
}

.update-btn-primary:hover {
  background: #1557b0;
  box-shadow: 0 4px 8px rgba(26, 115, 232, 0.4);
  transform: translateY(-1px);
}

.update-btn-primary:active {
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .update-modal-content {
    width: 95%;
    max-width: 100%;
    margin: 1rem;
  }

  .update-modal-header,
  .update-modal-body {
    padding: 1.5rem;
  }

  .update-version-info {
    flex-direction: column;
    gap: 1rem;
  }

  .version-arrow {
    transform: rotate(90deg);
  }

  .update-modal-footer {
    flex-direction: column;
    padding: 1rem 1.5rem;
  }

  .update-btn {
    width: 100%;
    justify-content: center;
  }
}
