/* ========================================
   ScicitEau Québec - Interactive Map
   ExB Clone - Exact UI Match
   ======================================== */

:root {
  --primary: #2d6e8e;
  --primary-dark: #1f4f6e;
  --primary-light: #e8f4f8;
  --primary-hover: #3a8ab0;
  --accent: #2b7c7c;
  --accent-dark: #1f5f5f;
  --green: #00b27f;
  --green-dark: #009a6d;
  --text-dark: #323232;
  --text-medium: #595959;
  --text-light: #6e6e6e;
  --bg-white: #ffffff;
  --bg-light: #f4f4f4;
  --bg-sidebar: #fafafa;
  --border: #e0e0e0;
  --border-light: #ececec;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.2);
  --radius: 4px;
  --radius-md: 6px;
  --header-height: 64px;
  --sidebar-width: 340px;
  --timeline-height: 80px;
  --font: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-dark);
  overflow: hidden;
}

/* ========================================
   HEADER
   ======================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  background: #182F41;
  color: white;
  z-index: 100;
}

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

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

.header-logo {
  height: 52px;
  width: auto;
}

.app-title {
  font-size: 16px;
  font-weight: 600;
}

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

/* "Ajouter une initiative" button */
.btn-add-initiative {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 20px;
  background: #BAD2E0;
  color: #182F41;
  text-decoration: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: background 0.15s;
}

.btn-add-initiative:hover {
  background: #2d7ab8;
}

/* Header icon buttons */
.header-icons {
  display: flex;
  gap: 4px;
  position: relative;
}

.header-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  opacity: 0.8;
}

.header-icon-btn:hover {
  background: rgba(255,255,255,0.15);
  opacity: 1;
}

/* Language switch */
.lang-switch {
  display: flex;
  gap: 1px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.lang-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.lang-btn:hover { color: white; }

/* ========================================
   LAYOUT
   ======================================== */
.app-content {
  display: flex;
  height: calc(100% - var(--header-height));
  position: relative;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  position: relative;
}

/* Tabs - Pill style like ExB */
.sidebar-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 6px 18px;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 20px;
}

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

.tab-btn:hover:not(.active) {
  color: var(--primary);
}

/* List title ("Liste des organisations") */
.sidebar-list-title {
  padding: 8px 14px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
}

/* Result counter (floating on map) */
.map-counter {
  display: none;
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  color: var(--text-dark);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 400;
  z-index: 50;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Search */
.sidebar-search {
  padding: 6px 14px 10px;
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.sidebar-search input {
  flex: 1;
  padding: 7px 28px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}

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

.search-clear {
  border: none;
  background: none;
  font-size: 16px;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 4px;
  display: none;
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.search-clear.visible { display: block; }

/* Card list */
.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
}

.sidebar-list.hidden { display: none; }

/* ========================================
   CARDS (ExB style)
   ======================================== */
.card {
  padding: 12px 14px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: #ccc;
}

.card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
  line-height: 1.3;
}

/* Blue localisation text */
.card-subtitle {
  font-size: 11px;
  color: var(--primary);
  margin-bottom: 2px;
}

/* Teal bassin text */
.card-detail {
  font-size: 11px;
  color: var(--accent);
}

.card-email {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* "Voir les initiatives" / "Voir l'initiative" button (ExB dark slate style) */
.card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 18px;
  background: #3d5a6e;
  color: white;
  border: none;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.card-btn:hover {
  background: #2d4757;
}

.card-btn span:first-child {
  font-size: 10px;
}

/* ========================================
   INITIATIVE SIDEBAR CARDS (ExB style with image)
   ======================================== */
.init-sidebar-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}

.init-sidebar-card:hover {
  box-shadow: var(--shadow);
  border-color: #ccc;
}

.init-sidebar-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.init-sidebar-image {
  width: 120px;
  min-height: 100px;
  border-radius: var(--radius);
  background: #e8e8e8;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.init-sidebar-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.init-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  margin-bottom: 3px;
}

.init-sidebar-detail {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.3;
}

.init-sidebar-org {
  font-size: 11px;
  color: var(--primary);
  line-height: 1.3;
  margin-bottom: 6px;
}

.init-sidebar-card .card-btn {
  margin-top: auto;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: absolute;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 48px;
  border: 1px solid var(--border);
  border-left: none;
  background: white;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-medium);
  z-index: 51;
}

.no-results {
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  padding: 20px 10px;
}

/* ========================================
   MAP
   ======================================== */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#viewDiv {
  width: 100%;
  height: 100%;
}

/* ========================================
   HOME BUTTON (top left)
   ======================================== */
.home-btn {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 36px;
  height: 36px;
  border: none;
  background: #36546B;
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 40;
  transition: all 0.15s;
}

.home-btn:hover {
  background: #2a4356;
}

.esri-ui-top-left {
  top: 60px !important;
}

/* ========================================
   FILTER TOOLBAR (right side, ExB style)
   ======================================== */
.filter-toolbar {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 40;
}

.filter-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #36546B;
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: white;
}

.filter-btn:hover {
  background: #2a4356;
  color: white;
}

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

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

.filter-icon-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.filter-option-info {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #555;
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  margin-left: auto;
  position: relative;
}

.filter-option-info:hover {
  background: #ccc;
}

.filter-tooltip {
  display: none;
  position: fixed;
  background: #333;
  color: white;
  font-size: 11px;
  font-style: normal;
  font-family: var(--font);
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 4px;
  width: 200px;
  white-space: normal;
  line-height: 1.4;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* tooltip shown via JS mouseenter */

/* ========================================
   FILTER PANEL
   ======================================== */
.filter-panel {
  position: absolute;
  top: 50%;
  right: 56px;
  transform: translateY(-50%);
  width: 300px;
  max-height: calc(100% - var(--timeline-height) - 20px);
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 45;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.filter-panel.hidden { display: none; }

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--primary);
  color: white;
}

.filter-panel-header h3 {
  font-size: 13px;
  font-weight: 600;
}

.filter-panel-close {
  border: none;
  background: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.filter-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
}

.filter-toggle-all {
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--border-light);
}
.filter-toggle-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}
.filter-toggle-btn:hover {
  text-decoration: underline;
}

.filter-reset-btn {
  background: #c0392b !important;
}
.filter-reset-btn:hover {
  background: #a93226 !important;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.filter-option:last-child { border-bottom: none; }

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

.filter-option-content { flex: 1; }

.filter-option-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
}

.filter-option-desc {
  font-size: 10.5px;
  color: var(--text-light);
  margin-top: 2px;
  line-height: 1.4;
}

/* ========================================
   TIMELINE (ExB style - teal bar, controls at bottom)
   ======================================== */
.timeline-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: var(--timeline-height);
  padding: 0;
}

/* Row 1: date range info */
.timeline-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 12px 0;
  font-size: 10px;
  color: var(--text-light);
}

.timeline-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}

.timeline-date-range {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.timeline-date-range::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-stats {
  font-size: 10px;
  color: var(--text-light);
}

/* Row 2: slider */
.timeline-slider-row {
  padding: 2px 12px 0;
  position: relative;
}

.timeline-track-wrapper {
  position: relative;
  height: 10px;
  display: flex;
  align-items: center;
}

.timeline-track-bg {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  top: 50%;
  transform: translateY(-50%);
}

.timeline-track-fill {
  position: absolute;
  left: 0;
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 65%;
  transition: left 0.1s, width 0.1s;
}

/* Dual range sliders - overlaid on top of each other */
.timeline-range {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  cursor: pointer;
  z-index: 3;
  pointer-events: none;
}

.timeline-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 20px;
  background: var(--text-dark);
  cursor: ew-resize;
  border-radius: 3px;
  pointer-events: all;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.timeline-range::-moz-range-thumb {
  width: 14px;
  height: 20px;
  background: var(--text-dark);
  cursor: ew-resize;
  border: none;
  border-radius: 3px;
  pointer-events: all;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Start thumb: left-pointing arrow */
.timeline-range-start::-webkit-slider-thumb {
  background: var(--text-dark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='20' viewBox='0 0 14 20'%3E%3Cpolygon points='8,7 4,10 8,13' fill='white'/%3E%3C/svg%3E") no-repeat center;
}
.timeline-range-start::-moz-range-thumb {
  background: var(--text-dark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='20' viewBox='0 0 14 20'%3E%3Cpolygon points='8,7 4,10 8,13' fill='white'/%3E%3C/svg%3E") no-repeat center;
}

/* End thumb: right-pointing arrow */
.timeline-range-end::-webkit-slider-thumb {
  background: var(--text-dark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='20' viewBox='0 0 14 20'%3E%3Cpolygon points='6,7 10,10 6,13' fill='white'/%3E%3C/svg%3E") no-repeat center;
  z-index: 4;
}
.timeline-range-end::-moz-range-thumb {
  background: var(--text-dark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='20' viewBox='0 0 14 20'%3E%3Cpolygon points='6,7 10,10 6,13' fill='white'/%3E%3C/svg%3E") no-repeat center;
}

/* End handle sits on top */
.timeline-range-end {
  z-index: 4;
}

/* Row 3: year labels */
.timeline-labels-row {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-light);
  padding: 0 10px;
  line-height: 1;
}

/* Row 4: play controls */
.timeline-controls-row {
  display: flex;
  align-items: center;
  padding: 2px 8px 3px;
  gap: 0;
}

.timeline-info-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.timeline-info-btn:hover { background: #f0f0f0; }

.timeline-controls-spacer { flex: 1; }

.timeline-play-controls {
  display: flex;
  gap: 2px;
  align-items: center;
}

.timeline-ctrl-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.1s;
}

.timeline-ctrl-btn:hover {
  background: #eee;
  color: var(--text-dark);
}

.timeline-play-btn {
  color: var(--primary);
}

.timeline-zoom-controls {
  display: flex;
  gap: 2px;
}

/* ========================================
   POPUP OVERLAY (dims background)
   ======================================== */
.popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.15);
  z-index: 59;
}

.popup-overlay.hidden { display: none; }

/* ========================================
   ORGANISATION POPUP (centered dialog, ExB style)
   ======================================== */
.org-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  max-height: 80vh;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popupFadeIn 0.2s ease;
}

.org-popup.hidden { display: none; }

@keyframes popupFadeIn {
  from { opacity: 0; transform: translate(-50%, -48%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

/* Org popup header - dark with org info */
.org-popup-header {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--primary-dark);
  color: white;
}

.org-popup-header-text {
  flex: 1;
}

.org-popup-header-text h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.org-popup-header-info {
  font-size: 12px;
  opacity: 0.9;
  line-height: 1.6;
}

.org-popup-email-text,
.init-popup-email-text {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
  color: white;
}

.org-popup-header-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
}

.popup-close {
  border: none;
  background: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.popup-close:hover { opacity: 1; }

/* Contact button as icon in header */
.btn-contact-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: white;
  text-decoration: none;
  font-size: 10px;
  opacity: 0.85;
  transition: opacity 0.15s;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.btn-contact-icon:hover { opacity: 1; }

.btn-contact-icon svg {
  width: 28px;
  height: 28px;
  padding: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
}

/* Org popup body */
.org-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.org-popup-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  padding: 14px 20px 8px;
}

/* Initiative cards inside org popup (with image) */
#orgPopupInitList {
  padding: 0 16px 16px;
}

.init-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}

.init-card:hover {
  border-color: #bbb;
  box-shadow: var(--shadow);
}

.init-card-image {
  width: 110px;
  min-height: 90px;
  border-radius: var(--radius);
  background: #e8e8e8;
  background-size: cover;
  background-position: center top;
  flex-shrink: 0;
}

.init-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.init-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  margin-bottom: 4px;
}

.init-card-years {
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 2px;
}

.init-card-status {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
}

/* "Voir l'initiative" button inside init card */
.init-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: #3d5a6e;
  color: white;
  border: none;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: auto;
  align-self: flex-start;
}

.init-card-btn:hover {
  background: #2d4757;
}

.init-card-btn span:first-child {
  font-size: 10px;
}

/* ========================================
   INITIATIVE POPUP (ExB style - hero image + info bar)
   ======================================== */
.init-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 580px;
  max-height: 85vh;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 61;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popupFadeIn 0.2s ease;
}

.init-popup.hidden { display: none; }

/* Top bar: "< Retour" + X */
.init-popup-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: white;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.init-popup-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  color: var(--primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.init-popup-back-btn:hover {
  background: var(--bg-light);
}

/* Close button in init popup topbar (dark on white bg) */
.init-popup-topbar .popup-close {
  color: var(--text-dark);
  font-size: 24px;
}

.init-popup-back-btn svg {
  color: var(--primary);
}

/* Hero image */
.init-popup-hero {
  width: 100%;
  height: 160px;
  background: #ddd;
  background-size: cover;
  background-position: center top;
  position: relative;
  flex-shrink: 0;
}

.init-popup-credit {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 10px;
  color: white;
  background: rgba(0,0,0,0.45);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Info bar below image */
.init-popup-infobar {
  display: flex;
  align-items: flex-start;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  background: #182F41;
  color: white;
}

.init-popup-infobar-left {
  flex: 1;
  min-width: 0;
}

.init-popup-infobar-left h2 {
  font-size: 16px;
  font-weight: 700;
  color: white;
  line-height: 1.3;
  margin-bottom: 4px;
}

.init-popup-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  margin-bottom: 3px;
}

.init-popup-years {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.init-popup-status {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.init-popup-org {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  line-height: 1.3;
}

/* Site web / Contacter icon actions */
.init-popup-infobar-right {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.init-popup-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: white;
  font-size: 10px;
  font-weight: 500;
  transition: opacity 0.15s;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.init-popup-action:hover { opacity: 0.7; }

.init-popup-action svg {
  width: 28px;
  height: 28px;
  padding: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  color: white;
}

/* Scrollable detail content */
.init-popup-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}

.init-detail-section {
  margin-bottom: 16px;
}

/* Bold dark section titles (ExB style, not uppercase blue) */
.init-detail-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-info-btn {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #555;
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.detail-info-btn:hover { background: #ccc; }

.detail-tooltip {
  display: none;
  position: fixed;
  background: #333;
  color: white;
  font-size: 11px;
  font-style: normal;
  font-family: var(--font);
  font-weight: 400;
  padding: 8px 12px;
  border-radius: 4px;
  width: 260px;
  white-space: normal;
  line-height: 1.5;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  pointer-events: none;
}

.init-detail-value {
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.6;
}

.init-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ========================================
   ADD INITIATIVE POPUP (centered dialog)
   ======================================== */
.add-init-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 62;
  padding: 40px 48px;
  text-align: center;
  animation: popupFadeIn 0.2s ease;
}

.add-init-popup.hidden { display: none; }

.add-init-popup-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 24px;
  color: var(--text-medium);
  cursor: pointer;
  line-height: 1;
}

.add-init-popup-close:hover { color: var(--text-dark); }

.add-init-popup-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
  line-height: 1.4;
}

.add-init-popup-text {
  font-size: 14px;
  color: var(--text-medium);
  margin-bottom: 28px;
  line-height: 1.5;
}

.add-init-popup-btn {
  display: block;
  margin: 0 auto;
  max-width: 360px;
  width: 100%;
  padding: 10px;
  background: #182F41;
  color: white;
  text-decoration: none;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  font-style: normal;
  border: none;
  transition: background 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.add-init-popup-btn:hover {
  background: #0f1f2d;
}

/* Info Video Popup */
.info-video-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 580px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 62;
  padding: 32px 28px 28px;
  animation: popupFadeIn 0.2s ease;
}
.info-video-popup.hidden { display: none; }

.info-video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: 8px;
  overflow: hidden;
}
.info-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.info-video-text {
  font-size: 14px;
  color: var(--text-medium);
  margin-bottom: 16px;
  line-height: 1.5;
  text-align: center;
}
.info-video-text a {
  color: #1779c2;
  text-decoration: underline;
}

.info-video-dismiss-btn {
  margin-top: 20px;
}

/* Contact Popup */
.contact-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  max-width: 90vw;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 65;
  padding: 28px 24px;
  text-align: center;
  animation: popupFadeIn 0.2s ease;
}
.contact-popup.hidden { display: none; }
.contact-popup .popup-close {
  position: absolute;
  top: 10px;
  right: 14px;
}
.contact-popup-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-dark);
}
.contact-popup-email {
  font-size: 14px;
  color: var(--text-medium);
  margin-bottom: 20px;
  word-break: break-all;
}
.contact-popup-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #182F41;
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.contact-popup-btn:hover {
  background: #0f1f2d;
}

.contact-popup-close-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px 0;
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: var(--text-medium);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.contact-popup-close-btn:hover {
  background: #f0f0f0;
}

.info-video-logos {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.info-logo-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.info-logo-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.logo-ceq-g3e {
  height: 56px;
  width: auto;
  object-fit: contain;
}

.info-logo-supporters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.logo-gouv {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.logo-datastream {
  height: 22px;
  width: auto;
  object-fit: contain;
}

/* Share Popup */
.share-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 320px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 100;
  padding: 20px;
  animation: popupFadeIn 0.15s ease;
}
.share-popup.hidden { display: none; }

.share-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.share-popup-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}
.share-popup-close {
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-medium);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.share-popup-close:hover { color: var(--text-dark); }

.share-url-row {
  display: flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 12px;
  overflow: hidden;
}
.share-url-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-dark);
  background: white;
}
.share-copy-btn {
  border: none;
  background: none;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-medium);
  border-left: 1px solid #ccc;
}
.share-copy-btn:hover { color: var(--text-dark); }

.share-social-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}
.share-social-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}
.share-social-btn:hover { opacity: 0.8; }
.share-facebook { background: #1877F2; }
.share-twitter { background: #000; }
.share-linkedin { background: #0A66C2; }
.share-email { background: #555; }
.share-copy-link {
  background: #36546B;
  border: none;
  color: white;
}

.share-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dark);
  margin-bottom: 8px;
  cursor: pointer;
}
.share-checkbox input[type="checkbox"] {
  accent-color: #1779c2;
  width: 16px;
  height: 16px;
}

.share-icons-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.share-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f57c00;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}
.share-icon-btn:hover { opacity: 0.8; }
.share-icon-btn.share-fb { background: #1877f2; }
.share-icon-btn.share-x { background: #000; }
.share-icon-btn.share-pinterest { background: #e60023; }
.share-icon-btn.share-linkedin { background: #0a66c2; }
#shareQR { background: #333; }
#shareEmail { background: #7c4dff; }

/* ========================================
   UTILITY
   ======================================== */
.hidden { display: none !important; }

/* Scrollbar styling */
.sidebar-list::-webkit-scrollbar,
.org-popup-body::-webkit-scrollbar,
.init-popup-content::-webkit-scrollbar,
.filter-panel-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-list::-webkit-scrollbar-track,
.org-popup-body::-webkit-scrollbar-track,
.init-popup-content::-webkit-scrollbar-track,
.filter-panel-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-list::-webkit-scrollbar-thumb,
.org-popup-body::-webkit-scrollbar-thumb,
.init-popup-content::-webkit-scrollbar-thumb,
.filter-panel-content::-webkit-scrollbar-thumb {
  background: #c8c8c8;
  border-radius: 3px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
/* Hamburger menu — hidden on desktop, shown on mobile */
.header-mobile-menu {
  display: none;
  position: relative;
}

.header-hamburger {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-hamburger:hover {
  background: rgba(255,255,255,0.2);
}

.header-mobile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  min-width: 220px;
  z-index: 200;
  padding: 6px 0;
}

.header-mobile-dropdown.hidden {
  display: none;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
}

.mobile-menu-item:hover {
  background: var(--bg-light);
}

.mobile-menu-item svg {
  flex-shrink: 0;
  color: var(--primary);
}

/* Shrink popups + collapsible sidebar on tablet+mobile */
@media (max-width: 1024px) {
  .org-popup,
  .init-popup,
  .add-init-popup,
  .info-video-popup,
  .contact-popup {
    transform: translate(-50%, -50%) scale(0.9);
    animation: none;
  }

  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 55;
  }

  .sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 300px;
  }

  .org-popup, .init-popup, .add-init-popup {
    width: calc(100% - 20px);
  }

  .add-init-popup {
    padding: 28px 20px;
    max-width: calc(100vw - 20px);
  }

  .filter-toolbar {
    right: 8px;
  }

  .filter-panel {
    right: 48px;
    width: 260px;
  }

  .header-desktop-only {
    display: none !important;
  }

  .header-mobile-menu {
    display: block;
  }

  .timeline-labels-row span:nth-child(odd):not(:first-child):not(:last-child) {
    visibility: hidden;
  }

  .info-video-logos {
    gap: 20px;
  }
  .logo-gouv { height: 40px; }
  .logo-ceq-g3e { height: 34px; }
}

@media (max-width: 480px) {
  .org-popup, .init-popup {
    width: calc(100% - 10px);
    max-height: 85vh;
  }

  .init-card { flex-direction: column; }
  .init-card-image { width: 100%; min-height: 120px; }

  .init-popup-hero { height: 130px; }
  .init-popup-infobar { flex-direction: column; }
  .init-popup-infobar-right { flex-direction: row; }
}
