:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e5e3dd;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --accent: #1e7a5f;
  --accent-light: #e8f5f0;
  --sidebar-w: 320px;
  --topbar-h: 64px;
  --radius: 10px;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2e2e2e;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --accent: #2fd4a5;
  --accent-light: #16352c;
}

[data-theme="dark"] .btn-add,
[data-theme="dark"] .btn-email,
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .social-icon:hover,
[data-theme="dark"] .cat-item.active .count,
[data-theme="dark"] .carousel-dot.active {
  color: #0f2b22;
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--accent);
  color: #0f2b22;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2000;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.logo span { color: var(--accent); }

.logo-block {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.version-tag {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 400;
}

.btn-add {
  margin-left: auto;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-add:hover { opacity: 0.9; }
.btn-add strong { text-transform: uppercase; }

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
}

.layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}

.sidebar h2 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#cat-search, #entreprise-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.cat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.1s;
}
.cat-item:hover { background: var(--bg); }
.cat-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

.cat-item .count {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}
.cat-item.active .count { background: var(--accent); color: #fff; }

.map-area {
  flex: 1;
  position: relative;
}

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

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
}

.popup-card { min-width: 200px; }
.popup-card h3 { font-size: 15px; margin-bottom: 4px; }
.popup-card p { font-size: 13px; color: #555; margin-bottom: 2px; }
.popup-card a {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 18px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.sidebar-overlay.open { display: block; }

/* ─── Homepage hero (compteur + aide, PAS de badges) ─────── */

.home-hero {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-width: 90vw;
  width: auto;
  transition: opacity 0.3s, transform 0.3s;
  text-align: center;
  pointer-events: auto;
}
.home-hero-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-20px);
}

.hero-stats {
  font-size: 14px;
  color: var(--text-secondary);
}
.hero-count {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  display: inline;
}
.hero-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.desktop-hint { display: block; }
.mobile-hint { display: none; }

/* ─── Overlay badges centré sur la carte ─────────────────── */

.map-overlay-badges {
  position: absolute;
  top: calc(50% + 45px);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  width: 380px;
  max-width: 88vw;
  max-height: 44vh;
  pointer-events: none; /* laisse passer clics sur la carte en dehors */
  transition: opacity 0.3s, transform 0.3s;
}
.map-overlay-badges-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.95);
}

/* Zone de scroll — le conteneur visible */
.badges-scroll-zone {
  width: 100%;
  height: 100%;
  max-height: 44vh;
  overflow-y: hidden; /* caché par défaut, le JS scrolle */
  pointer-events: none; /* isolation: seuls les badges visibles cliquent */
  border-radius: 16px;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

/* Les logos et icônes restent 100% opaques dans le bloc badges */
.badges-scroll-zone img,
.badges-scroll-zone .social-btn {
  opacity: 1 !important;
}

.badges-scroll-zone::-webkit-scrollbar {
  width: 4px;
}
.badges-scroll-zone::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

/* Piste: colonne flex, doublée pour boucle infinie */
.badges-scroll-track {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

/* ─── Badges horizontaux modernes ─────────────────── */

.badge-featured-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 60px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.badge-featured-card:not([aria-hidden="true"]):hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.badge-featured-logo {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  overflow: hidden;
  border-radius: 12px 0 0 12px;
}

.badge-featured-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 4px;
}

.badge-featured-logo-placeholder {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: 12px 0 0 12px;
  color: var(--accent);
  opacity: 0.45;
}

.badge-featured-logo-placeholder svg {
  width: 24px;
  height: 24px;
}

.badge-featured-info {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  text-align: left;
}

.badge-featured-info strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-featured-cat {
  display: block;
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-featured-desc {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Réseaux sociaux dans le badge */
.badge-featured-social {
  display: flex;
  gap: 3px;
  padding: 0 8px 0 2px;
  flex-shrink: 0;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-secondary);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.social-btn svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .badges-scroll-zone {
  background: rgba(26,26,26,0.75);
  border-color: #333;
}

[data-theme="dark"] .badge-featured-card {
  border-color: #333;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
[data-theme="dark"] .badge-featured-card:not([aria-hidden="true"]):hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
[data-theme="dark"] .badge-featured-logo-placeholder {
  background: #1a2e28;
}

/* ─── Fin badges overlay ─────────────────────── */

@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .logo { font-size: 16px; }
  .btn-add { font-size: 11px; padding: 8px 10px; white-space: nowrap; }
  .btn-add strong { display: block; font-size: 10px; }
  .menu-toggle { display: block; order: -1; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 1500;
    height: calc(100% - var(--topbar-h));
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .sidebar.open { transform: translateX(0); }

  .home-hero {
    top: 8px;
    padding: 8px 16px;
    max-width: 95vw;
  }
  .hero-count { font-size: 22px; }
  .hero-stats { font-size: 12px; }
  .hero-hint { font-size: 11px; }
  .desktop-hint { display: none; }
  .mobile-hint { display: block; }

  .map-overlay-badges {
    width: 92vw;
    max-height: 38vh;
  }
  .badges-scroll-zone {
    max-height: 38vh;
  }
  .badge-featured-logo {
    width: 52px;
    height: 52px;
  }
  .badge-featured-logo-placeholder {
    width: 52px;
    height: 52px;
  }
  .badge-featured-info strong { font-size: 12px; }
  .badge-featured-cat { font-size: 10px; }
  .badge-featured-desc { font-size: 10px; }
  .badge-featured-logo-placeholder svg { width: 18px; height: 18px; }
  .badge-featured-social { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .badges-scroll-zone {
    overflow-y: auto;
  }
}

.cat-family { font-weight: 600; cursor: pointer; }
.cat-sub { padding-left: 28px; font-size: 13px; color: var(--text-secondary); }
.cat-sub:hover { color: var(--text-primary); }


/* === featured marquee safe === */
#map-overlay-badges {
  pointer-events: none !important;
}
#map-overlay-badges .badges-scroll-zone,
#map-overlay-badges .badges-scroll-track {
  pointer-events: none !important;
}
#map-overlay-badges a.badge-featured-card:not([aria-hidden="true"]) {
  pointer-events: auto !important;
}
#map-overlay-badges a.badge-featured-card[aria-hidden="true"] {
  pointer-events: none !important;
}

#badges-scroll-zone {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 88%, transparent 100%);
}
#badges-scroll-zone::-webkit-scrollbar { display: none; }

.map-overlay-badges-hidden,
#map-overlay-badges.map-overlay-badges-hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* pins taille fixe */
.leaflet-container img.leaflet-marker-icon {
  width: 25px !important;
  height: 41px !important;
  margin-left: -12.5px !important;
  margin-top: -41px !important;
}
@media (max-width: 768px) {
  .leaflet-container img.leaflet-marker-icon {
    width: 22px !important;
    height: 36px !important;
    margin-left: -11px !important;
    margin-top: -36px !important;
  }
}
/* bust 1785341109 */
