/**
 * Design System for CEPID Infoviz 2025
 * Based on cepid.eu visual identity
 */

/* ==========================================
   CSS Custom Properties (Design Tokens)
   ========================================== */
:root {
  /* Breakpoints (2024-2025 market-aligned) */
  --breakpoint-xs: 0px;
  /* Mobile S: iPhone SE, small Android */
  --breakpoint-sm: 428px;
  /* Mobile L: iPhone 14/15, Pixel */
  --breakpoint-md: 768px;
  /* Tablet: iPad Mini, Android tablets */
  --breakpoint-lg: 1024px;
  /* Desktop: Laptops, small monitors */
  --breakpoint-xl: 1280px;
  /* Large: Standard monitors */
  --breakpoint-2xl: 1536px;
  /* Extra Large: Large monitors, 4K */

  /* Map dimensions (minimized, consistent across tabs) */
  --map-height-mobile: 280px;
  --map-height-tablet: 320px;
  --map-height-desktop: 380px;

  /* Colors */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #3b82f6;
  --color-secondary: #64748b;
  --color-secondary-dark: #475569;

  --color-background: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-alt: #f1f5f9;

  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;

  --color-border: #e2e8f0;
  --color-border-dark: #cbd5e1;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --header-height: 80px;
  --sidebar-width: 280px;
  --max-content-width: 1400px;
}

/* ==========================================
   Reset & Base Styles
   ========================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
select {
  font-family: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* ==========================================
   Header
   ========================================== */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-xl);
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
}

.logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo {
  height: 120px;
  width: auto;
}

.header-title {
  flex: 1;
}

.header-title h1 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.header-title .subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.data-source {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: var(--font-size-sm);
}

.source-label {
  color: var(--color-text-light);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.source-link {
  color: var(--color-primary);
  font-weight: 500;
}

/* ==========================================
   Navigation Tabs
   ========================================== */
.nav-tabs {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: 0 var(--spacing-xl);
  position: sticky;
  top: var(--header-height);
  z-index: 90;
}

.tab-btn {
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--color-text-muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ==========================================
   Main Layout
   ========================================== */
.main-content {
  max-width: var(--max-content-width);
  margin: 0 auto;
  display: flex;
  gap: var(--spacing-xl);
  padding: var(--spacing-xl);
  min-height: 800px;
  /* CLS fix: reserve main content height */
  position: relative;
  /* CLS fix: for loading overlay positioning */
}

/* ==========================================
   Sidebar
   ========================================== */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  min-height: 800px;
  /* CLS fix: reserve sidebar height */
  contain: layout style;
  /* CLS fix: isolate layout changes */
}

.filter-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-lg);
  min-height: 580px;
  /* CLS fix: reserve space for filter content */
}

.filter-section h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--color-text);
}

.filter-group {
  margin-bottom: var(--spacing-lg);
}

.filter-group:last-of-type {
  margin-bottom: var(--spacing-md);
}

.filter-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.checkbox-group-wrapper {
  position: relative;
}

.checkbox-group-wrapper::after {
  content: '↓ plus';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: linear-gradient(transparent, var(--color-surface) 60%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.checkbox-group-wrapper.scrolled-end::after {
  opacity: 0;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  min-height: 200px;
  /* CLS fix: reserve space for dynamic checkboxes */
  max-height: 200px;
  overflow-y: auto;
  padding-bottom: var(--spacing-md);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  cursor: pointer;
  padding: var(--spacing-xs) 0;
  text-transform: none;
  letter-spacing: normal;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.search-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Department Autocomplete + Chips */
.dept-autocomplete {
  position: relative;
}

.dept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
  min-height: 0;
}

.dept-chips:empty {
  display: none;
}

.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 4px 8px 4px 12px;
  background: var(--color-primary);
  color: white;
  border-radius: 16px;
  font-size: var(--font-size-sm);
  animation: chipIn 0.15s ease-out;
}

@keyframes chipIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.dept-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: background 0.15s;
}

.dept-chip-remove:hover {
  background: rgba(255, 255, 255, 0.4);
}

.dept-input-wrapper {
  position: relative;
}

.dept-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.dept-dropdown[hidden] {
  display: none;
}

.dept-option {
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  transition: background 0.1s;
}

.dept-option:hover,
.dept-option.highlighted {
  background: var(--color-surface-alt);
}

.dept-option.selected {
  background: var(--color-primary);
  color: white;
}

.dept-option-code {
  font-weight: 600;
  margin-right: var(--spacing-xs);
}

.dept-no-results {
  padding: var(--spacing-md);
  color: var(--color-text-muted);
  text-align: center;
  font-size: var(--font-size-sm);
}

.dept-list {
  margin-top: var(--spacing-sm);
  max-height: 150px;
  overflow-y: auto;
}

/* Stats Summary */
.stats-summary {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  min-height: 180px;
  /* CLS fix: reserve stats height */
}

.stat-item {
  text-align: center;
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--color-border);
}

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

.stat-value {
  display: block;
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  /* CLS fix: consistent number widths */
  min-width: 80px;
  /* CLS fix: reserve space for numbers */
  text-align: center;
}

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

/* ==========================================
   Content Area
   ========================================== */
.content-area {
  flex: 1;
  min-width: 0;
  contain: layout style;
  /* CLS fix: isolate layout changes */
}

.tab-content {
  display: none;
  content-visibility: auto;
  /* CLS fix: skip rendering for hidden tabs */
  contain-intrinsic-size: 0 500px;
  /* CLS fix: estimate content size */
}

.tab-content.active {
  display: block;
  content-visibility: visible;
  contain: layout style;
  /* CLS fix: contain layout changes */
  min-height: 600px;
  /* CLS fix: reserve space for content */
}

.tab-content h2 {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--color-text);
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-surface-alt);
  color: var(--color-text);
  width: 100%;
}

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

/* Toggle Buttons */
.toggle-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.toggle-group label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

.toggle-btn {
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  transition: all var(--transition-fast);
}

.toggle-btn:hover {
  background: var(--color-border);
}

.toggle-btn.active {
  background: var(--color-primary);
  color: white;
}

/* ==========================================
   Metrics Grid
   ========================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  min-height: 120px;
  /* Reserve space to prevent CLS */
  contain: layout style paint;
  /* CLS fix: full containment */
}

.metric-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
  min-height: 100px;
  /* Reserve space to prevent CLS */
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
}

.metric-icon {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--spacing-sm);
}

.metric-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  /* CLS fix: consistent number widths */
  min-height: 1.2em;
  /* CLS fix: reserve vertical space */
}

.metric-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--spacing-xs);
}

/* ==========================================
   Charts
   ========================================== */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  contain: layout style;
  /* CLS fix: contain layout changes */
}

.chart-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  min-height: 400px;
  /* CLS fix: reserve space */
  contain: layout style;
  /* CLS fix: contain layout changes */
}

.chart-card.full-width {
  grid-column: 1 / -1;
}

.chart-card h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
}

.chart-card canvas {
  width: 100% !important;
  max-height: 400px;
}

/* ==========================================
   Salary Section
   ========================================== */
.salary-toggles {
  display: flex;
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.salary-table-container {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  margin-top: var(--spacing-lg);
}

.salary-table-container h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.salary-table {
  font-size: var(--font-size-sm);
}

.salary-table th,
.salary-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.salary-table th {
  background: var(--color-surface-alt);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.05em;
}

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

/* ==========================================
   Map Section
   ========================================== */
.map-controls {
  display: flex;
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.map-container {
  display: flex;
  gap: var(--spacing-lg);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-lg);
}

#france-map {
  flex: 1;
  min-height: var(--map-height-desktop);
  max-height: var(--map-height-desktop);
  /* INV7: Consistent height */
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}

.map-legend {
  width: 150px;
  flex-shrink: 0;
}

.map-legend h4 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

.comparison-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.comparison-panel h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

.help-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-md);
}

.comparison-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

/* ==========================================
   Sectors Section
   ========================================== */
#sector-treemap {
  min-height: 400px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}

.sector-details {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  margin-top: var(--spacing-lg);
}

.sector-details h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.data-table {
  font-size: var(--font-size-sm);
}

.data-table th,
.data-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.data-table td:first-child {
  white-space: normal;
  word-wrap: break-word;
}

.data-table th {
  background: var(--color-surface-alt);
  font-weight: 600;
  color: var(--color-text-muted);
}

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

.sector-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: var(--spacing-xs);
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================
   Dossier Métiers
   ========================================== */
.intro-text {
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-xl);
  font-size: var(--font-size-lg);
}

.dossier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
}

.dossier-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.dossier-card .btn-cta {
  margin-top: auto;
}

.dossier-card:hover {
  box-shadow: var(--shadow-md);
}

.dossier-card h4 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--color-primary);
}

.dossier-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}

.dossier-stat {
  text-align: center;
}

.dossier-stat-value {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
}

.dossier-stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.dossier-salary {
  margin-bottom: var(--spacing-md);
}

.dossier-salary h5 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--color-text-muted);
}

.salary-range {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: var(--font-size-sm);
}

.salary-bar {
  flex: 1;
  height: 8px;
  background: linear-gradient(to right, var(--color-success), var(--color-warning));
  border-radius: var(--radius-sm);
}

.dossier-employers h5 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--color-text-muted);
}

.employer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.employer-tag {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--color-text);
}

/* ==========================================
   Footer
   ========================================== */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: var(--spacing-2xl);
}

.footer-content {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--spacing-xl);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-xl);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.footer-logo {
  height: 100px;
  width: auto;
}

.footer-brand p {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 200px;
}

.footer-info {
  flex: 1;
  text-align: center;
}

.data-attribution {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.data-attribution a,
.footer-info a {
  text-decoration: underline;
  /* Accessibility: links distinguishable by more than color */
}

.footer-links {
  display: flex;
  gap: var(--spacing-md);
}

.footer-links a {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.footer-links a:hover {
  color: var(--color-primary);
}

.footer-copyleft {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  text-align: center;
  width: 100%;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

.footer-copyleft span {
  cursor: help;
}

.copyleft-symbol {
  display: inline-block;
  transform: scaleX(-1);
}

/* ==========================================
   Mobile-First Responsive Design
   Base = Mobile (<768px), enhance upwards
   ========================================== */

/* Mobile Base (default - no media query) */
:root {
  --header-height: 60px;
  --sidebar-width: 100%;
}

/* Hide sidebar on mobile - use bottom sheet instead */
.sidebar {
  display: none;
}

/* Show mobile filter button */
.mobile-filter-btn {
  display: flex;
}

/* Mobile header */
.header-content {
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
}

.logo {
  height: 40px;
}

.header-title h1 {
  font-size: var(--font-size-base);
}

.header-title .subtitle {
  font-size: var(--font-size-xs);
}

.data-source {
  display: none;
}

/* Mobile navigation */
.nav-tabs {
  overflow-x: auto;
  justify-content: flex-start;
  padding: 0 var(--spacing-md);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: var(--spacing-md);
  min-height: 44px;
  white-space: nowrap;
  font-size: var(--font-size-sm);
}

/* Mobile main content */
.main-content {
  flex-direction: column;
  padding: var(--spacing-md);
  gap: var(--spacing-md);
}

/* Mobile metrics */
.metrics-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
}

.metric-card {
  padding: var(--spacing-md);
}

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

/* Mobile charts */
.charts-row {
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

.chart-card {
  padding: var(--spacing-md);
  min-height: auto;
  /* Override desktop min-height to prevent white space */
}

.chart-card canvas {
  max-height: 300px;
}

/* Mobile salary table - horizontal scroll */
.salary-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.salary-table {
  min-width: 600px;
  /* Ensure table doesn't compress columns too much */
}

/* Mobile salary toggles */
.salary-toggles {
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
}

/* Mobile map */
.map-container {
  flex-direction: column;
  padding: var(--spacing-md);
  position: static;
  /* INV2: No relative positioning needed - legend is below map */
}

#france-map {
  min-height: var(--map-height-mobile);
  max-height: var(--map-height-mobile);
  /* INV7: Consistent height */
}

/* INV1+INV2: Legend positioned BELOW map on mobile, never overlapping */
.map-legend {
  position: static;
  /* Not absolute - prevents overlap with map */
  width: 100%;
  margin-top: var(--spacing-md);
  background: var(--color-surface-alt);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: none;
  /* INV4: Ensure readability */
  min-height: 80px;
}

/* Mobile dossier */
.dossier-grid {
  grid-template-columns: 1fr;
}

/* Mobile footer */
.footer-content {
  flex-direction: column;
  text-align: center;
  padding: var(--spacing-lg) var(--spacing-md);
  gap: var(--spacing-md);
}

.footer-brand {
  flex-direction: column;
}

.footer-brand p {
  max-width: none;
}

.footer-links {
  flex-direction: column;
  align-items: center;
}

.footer-copyleft {
  margin-top: 0;
  padding-top: var(--spacing-sm);
  border-top: none;
}

/* Touch-friendly targets (44px minimum) */
.checkbox-group input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 44px;
  min-height: 44px;
}

.checkbox-group label {
  min-height: 44px;
  padding: var(--spacing-sm) 0;
}

.btn,
.toggle-btn {
  min-height: 44px;
  padding: var(--spacing-sm) var(--spacing-md);
}

.pagination-btn {
  min-width: 44px;
  min-height: 44px;
}

/* ==========================================
   Tablet (768px - 1024px)
   ========================================== */
@media (min-width: 768px) {
  :root {
    --header-height: 70px;
  }

  /* Hide sidebar on tablet - use floating filter button instead */
  .sidebar {
    display: none;
  }

  /* Show mobile filter button on tablet */
  .mobile-filter-btn {
    display: flex;
  }

  .header-content {
    flex-wrap: nowrap;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .logo {
    height: 70px;
  }

  .header-title h1 {
    font-size: var(--font-size-lg);
  }

  .data-source {
    display: flex;
  }

  .nav-tabs {
    justify-content: center;
    padding: 0 var(--spacing-lg);
  }

  .main-content {
    padding: var(--spacing-lg);
    gap: var(--spacing-lg);
  }

  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .charts-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-card {
    min-height: 300px;
    /* Tablet: use smaller min-height to prevent excessive white space */
  }

  .chart-card canvas {
    max-height: 300px;
  }

  /* Reset salary table scroll behavior - more space available */
  .salary-table-container {
    overflow-x: visible;
  }

  .salary-table {
    min-width: 0;
  }

  .salary-toggles {
    flex-direction: row;
    gap: var(--spacing-xl);
  }

  .map-container {
    flex-direction: row;
    position: static;
  }

  #france-map {
    min-height: var(--map-height-tablet);
    max-height: var(--map-height-tablet);
    /* INV7: Consistent height */
  }

  .map-legend {
    position: static;
    width: 150px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .dossier-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-content {
    flex-direction: row;
    text-align: left;
    padding: var(--spacing-xl);
  }

  .footer-brand {
    flex-direction: row;
  }

  .footer-brand p {
    max-width: 200px;
  }

  .footer-links {
    flex-direction: row;
    align-items: center;
  }

  .footer-copyleft {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
  }
}

/* ==========================================
   Desktop (>1024px)
   ========================================== */
@media (min-width: 1024px) {
  :root {
    --header-height: 80px;
    --sidebar-width: 280px;
  }

  /* Hide sidebar on desktop - use floating filter button instead */
  .sidebar {
    display: none;
  }

  /* Show mobile filter button on desktop */
  .mobile-filter-btn {
    display: flex;
  }

  .main-content {
    flex-direction: column;
    padding: var(--spacing-xl);
    gap: var(--spacing-xl);
  }

  .header-content {
    padding: var(--spacing-md) var(--spacing-xl);
    gap: var(--spacing-xl);
  }

  .logo {
    height: 120px;
  }

  .header-title h1 {
    font-size: var(--font-size-xl);
  }

  .nav-tabs {
    padding: 0 var(--spacing-xl);
  }

  #france-map {
    min-height: var(--map-height-desktop);
    max-height: var(--map-height-desktop);
    /* INV7: Consistent height */
  }

  .dossier-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  }
}

/* ==========================================
   Utilities
   ========================================== */
.text-success {
  color: var(--color-success);
}

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

.text-error {
  color: var(--color-error);
}

.text-muted {
  color: var(--color-text-muted);
}

.bg-success {
  background-color: var(--color-success);
}

.bg-warning {
  background-color: var(--color-warning);
}

.bg-error {
  background-color: var(--color-error);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

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

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

/* Loading State */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--color-text-muted);
}

/* CLS fix: Hide main content during initial JS load to batch all DOM changes */
body.loading .main-content {
  visibility: hidden;
}

body.loading .main-content::before {
  content: 'Chargement...';
  visibility: visible;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
}

/* CLS fix: Skeleton loading for filter checkboxes */
.checkbox-group:empty::before,
.skeleton-placeholder {
  content: '';
  display: block;
  height: 100%;
  min-height: 180px;
  background: linear-gradient(90deg,
      var(--color-surface-alt) 0%,
      var(--color-border) 50%,
      var(--color-surface-alt) 100%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* CLS fix: Skeleton for stat values */
.stat-value:empty::before,
.metric-value:empty::before {
  content: '---';
  opacity: 0.3;
}

.loading::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: var(--spacing-sm);
}

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

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--color-text);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  pointer-events: none;
  z-index: 1000;
  max-width: 250px;
  box-shadow: var(--shadow-lg);
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: var(--color-text) transparent transparent;
}

/* ==========================================
   Offers Modal
   ========================================== */
.offers-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: var(--spacing-lg);
}

.offers-modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.offers-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.offers-modal-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0;
}

/* INV8: Modal count visibility - prominent count in header */
.offers-modal-count {
  font-weight: 400;
  color: var(--color-primary);
  font-size: var(--font-size-lg);
}

.offers-modal-context {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--spacing-xs);
}

.offers-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: var(--spacing-xs);
  line-height: 1;
  transition: color var(--transition-fast);
}

.offers-modal-close:hover {
  color: var(--color-text);
}

.offers-modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-lg);
}

.offers-modal-stats {
  display: flex;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.offers-modal-stats strong {
  color: var(--color-text);
}

.offers-table-container {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.offers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  table-layout: fixed;
}

/* Fixed column widths */
.offers-table th:nth-child(1),
.offers-table td:nth-child(1) {
  width: 30%;
}

/* Poste */
.offers-table th:nth-child(2),
.offers-table td:nth-child(2) {
  width: 18%;
}

/* Entreprise */
.offers-table th:nth-child(3),
.offers-table td:nth-child(3) {
  width: 18%;
}

/* Lieu */
.offers-table th:nth-child(4),
.offers-table td:nth-child(4) {
  width: 14%;
}

/* Contrat */
.offers-table th:nth-child(5),
.offers-table td:nth-child(5) {
  width: 14%;
}

/* Salaire */
.offers-table th:nth-child(6),
.offers-table td:nth-child(6) {
  width: 6%;
}

/* Voir */

.offers-table th,
.offers-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offers-table th {
  background: var(--color-surface-alt);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.offers-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.offers-table th.sortable:hover {
  background: var(--color-border);
}

.offers-table th.sortable.sorted {
  color: var(--color-primary);
  background: var(--color-primary-light)10;
}

.offers-table th .sort-icon {
  font-size: 10px;
  opacity: 0.7;
}

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

.offer-title {
  white-space: normal;
  line-height: 1.3;
}

.offer-title>span:last-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offer-family-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-bottom: 4px;
}

.contract-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.offer-link {
  display: inline-block;
  padding: 4px 8px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

/* Ensure last column doesn't overflow */
.offers-table td:last-child {
  overflow: visible;
  text-align: center;
  padding: var(--spacing-xs);
}

.offer-link:hover {
  background: var(--color-primary-dark);
  color: white;
}

.offers-modal-pagination {
  margin-top: var(--spacing-md);
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-xs);
}

.pagination-btn {
  padding: var(--spacing-xs) var(--spacing-sm);
  min-width: 36px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--color-surface-alt);
  border-color: var(--color-border-dark);
}

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

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 0 var(--spacing-xs);
  color: var(--color-text-muted);
}

/* Infinite scroll loading indicator */
.infinite-scroll-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loaded-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* CTA Button for viewing offers */
.btn-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin: var(--spacing-md) auto 0;
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
  text-align: center;
}

.btn-cta:hover {
  background: var(--color-primary-dark);
}

.btn-cta::before {
  content: '';
}

/* ==========================================
   Logo Responsive Sizing
   ========================================== */

/* Tablet and below: Smaller logo */
@media (max-width: 1024px) {
  .logo {
    height: 70px;
  }

  .footer-logo {
    height: 60px;
  }
}

/* Mobile: Crop logo to show only circular icon */
@media (max-width: 768px) {
  .logo {
    height: 50px;
    width: 50px;
    object-fit: cover;
    object-position: left;
  }

  .footer-logo {
    height: 40px;
    width: 40px;
    object-fit: cover;
    object-position: left;
  }

  .offers-modal-overlay {
    padding: var(--spacing-sm);
  }

  .offers-modal-content {
    max-height: 95vh;
  }

  .offers-table th:nth-child(2),
  .offers-table td:nth-child(2),
  .offers-table th:nth-child(4),
  .offers-table td:nth-child(4),
  .offers-table th:nth-child(6),
  .offers-table td:nth-child(6) {
    display: none;
  }

  .offer-title {
    max-width: 150px;
  }
}

/* ==========================================
   Count Badge (n=X) for cardinality display
   ========================================== */
.count-badge {
  font-size: var(--font-size-xs);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: var(--spacing-xs);
}

/* ==========================================
   Info Tooltip
   ========================================== */
.info-tooltip {
  cursor: help;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-left: var(--spacing-xs);
}

/* ==========================================
   PWA Components
   ========================================== */

/* Offline Indicator */
.offline-indicator {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-warning);
  color: white;
  padding: var(--spacing-xs) var(--spacing-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  z-index: 99;
  box-shadow: var(--shadow-sm);
}

.offline-indicator[hidden] {
  display: none;
}

.offline-icon {
  font-size: var(--font-size-base);
}

/* Mobile Filter Button */
.mobile-filter-btn {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 50;
  transition: all var(--transition-fast);
}

.mobile-filter-btn:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

.mobile-filter-btn:active {
  transform: scale(0.98);
}

.mobile-filter-btn svg {
  flex-shrink: 0;
}

.filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--spacing-xs);
  background: var(--color-error);
  color: white;
  border-radius: 50%;
  font-size: var(--font-size-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-badge[hidden] {
  display: none;
}

/* Bottom Sheet Overlay */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.bottom-sheet-overlay.visible {
  opacity: 1;
}

.bottom-sheet-overlay[hidden] {
  display: none;
}

/* Bottom Sheet */
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--transition-slow) cubic-bezier(0.32, 0.72, 0, 1);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet[hidden] {
  display: none;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  position: relative;
}

.bottom-sheet-handle {
  position: absolute;
  top: var(--spacing-sm);
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background: var(--color-border-dark);
  border-radius: 2px;
}

.bottom-sheet-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0;
  padding-top: var(--spacing-sm);
}

.bottom-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.bottom-sheet-close:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.bottom-sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet-content .filter-group {
  margin-bottom: var(--spacing-xl);
}

.bottom-sheet-content .checkbox-group {
  max-height: 180px;
}

.bottom-sheet-footer {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.bottom-sheet-footer .btn {
  flex: 1;
}

.bottom-sheet-footer .btn-primary {
  background: var(--color-primary);
  color: white;
}

.bottom-sheet-footer .btn-primary:hover {
  background: var(--color-primary-dark);
}

/* INV10: Bottom Sheet Responsive Layout for Large Desktops */
@media (min-width: 1024px) {

  /* Transform to anchored modal style */
  .bottom-sheet {
    left: auto;
    right: var(--spacing-lg);
    bottom: calc(var(--spacing-lg) + 60px);
    /* Above filter button */
    max-width: 380px;
    max-height: 70vh;
    border-radius: var(--radius-xl);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
  }

  .bottom-sheet.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Hide the drag handle on desktop */
  .bottom-sheet-handle {
    display: none;
  }

  /* Adjust header padding without handle */
  .bottom-sheet-header {
    padding-top: var(--spacing-md);
  }

  .bottom-sheet-header h3 {
    padding-top: 0;
  }

  /* Overlay less prominent on desktop */
  .bottom-sheet-overlay {
    background: rgba(0, 0, 0, 0.3);
  }
}

/* Extra large desktops - use floating filter bubble instead of sidebar */
@media (min-width: 1280px) {

  /* Hide sidebar - filters available via floating bubble */
  .sidebar {
    display: none;
  }

  /* Show the floating filter button */
  .mobile-filter-btn {
    display: flex;
    right: var(--spacing-xl);
    bottom: var(--spacing-xl);
  }

  /* Content area takes full width */
  .main-content {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
  }

  .content-area {
    width: 100%;
    max-width: 100%;
  }

  /* Bottom sheet positioned further from edge */
  .bottom-sheet {
    right: var(--spacing-xl);
    bottom: calc(var(--spacing-xl) + 60px);
    max-width: 400px;
  }
}

/* 2XL desktops */
@media (min-width: 1536px) {
  .logo {
    height: 120px;
  }

  .bottom-sheet {
    right: var(--spacing-2xl, 48px);
    bottom: calc(var(--spacing-2xl, 48px) + 60px);
  }

  .mobile-filter-btn {
    right: var(--spacing-2xl, 48px);
    bottom: var(--spacing-2xl, 48px);
  }
}

/* Update Toast */
.update-toast {
  position: fixed;
  bottom: var(--spacing-lg);
  left: var(--spacing-lg);
  right: var(--spacing-lg);
  max-width: 400px;
  background: var(--color-text);
  color: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transform: translateY(100%);
  transition: all var(--transition-slow);
}

.update-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.update-toast[hidden] {
  display: none;
}

.update-toast-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.update-toast-icon {
  display: flex;
  align-items: center;
  color: var(--color-primary);
}

.update-toast-icon svg {
  flex-shrink: 0;
}

.update-toast-text {
  display: flex;
  flex-direction: column;
}

.update-toast-text strong {
  font-size: var(--font-size-sm);
}

.update-toast-text span {
  font-size: var(--font-size-xs);
  opacity: 0.8;
}

.update-toast-btn {
  background: white;
  color: var(--color-text);
  border: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.update-toast-btn:hover {
  background: var(--color-surface-alt);
}

.update-toast-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: white;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.update-toast-dismiss:hover {
  opacity: 1;
}

/* ==========================================
   Error Toast
   ========================================== */
.error-toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--spacing-md));
  right: var(--spacing-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  pointer-events: none;
}

.error-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--color-surface);
  border-left: 4px solid var(--color-error);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.error-toast.visible {
  transform: translateX(0);
  opacity: 1;
}

.error-toast.dismissing {
  transform: translateX(120%);
  opacity: 0;
}

.error-toast-icon {
  flex-shrink: 0;
  color: var(--color-error);
  line-height: 1;
}

.error-toast-content {
  flex: 1;
  min-width: 0;
}

.error-toast-content strong {
  display: block;
  color: var(--color-error);
  margin-bottom: var(--spacing-xs);
  font-size: var(--font-size-sm);
}

.error-toast-content p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.4;
}

.error-toast-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.error-toast-close:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

/* Mobile: toast slides from top */
@media (max-width: 767px) {
  .error-toast-container {
    top: calc(var(--header-height) + var(--spacing-sm));
    left: var(--spacing-sm);
    right: var(--spacing-sm);
  }

  .error-toast {
    max-width: none;
    transform: translateY(-120%);
  }

  .error-toast.visible {
    transform: translateY(0);
  }

  .error-toast.dismissing {
    transform: translateY(-120%);
  }
}

/* Safe area insets for notch devices */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-sheet {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-filter-btn {
    bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
  }

  .update-toast {
    bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
    left: calc(var(--spacing-lg) + env(safe-area-inset-left));
    right: calc(var(--spacing-lg) + env(safe-area-inset-right));
  }
}

/* Tablet and up - center update toast */
@media (min-width: 768px) {
  .update-toast {
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
  }

  .update-toast.visible {
    transform: translateX(-50%) translateY(0);
  }
}