/**
 * Bloc : lg/store-locator
 *
 * Carte Google Maps interactive des concessions.
 * Section header : badge, titre 2 couleurs, texte intro, liseret SVG.
 * Toolbar filtres en overlay : 2 rangées mobile, 1 rangée tablet+.
 * Contrôles custom : zoom (desktop uniquement) + géolocalisation.
 *
 * Mobile-first. Breakpoints : 768px (tablet), 1200px (desktop).
 *
 * @since 1.0.0
 * @see docs/02-fonctionnalites/STORE-LOCATOR.md
 */

/* ── Section wrapper ─────────────────────────────── */

.lg-store-locator {
  position: relative;
  width: 100%;
  overflow-x: visible;
  background: var(--color-blanc, #fff);
}

/* ── Background wave ─────────────────────────────── */

.lg-store-locator__bg-wave {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.lg-store-locator__bg-wave img {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  /* height: 526px; */
  max-width: none;
  /* opacity: 0.5; */
}

.lg-store-locator__bg-wave::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 61.85%, #fff 100%),
    linear-gradient(180deg, #fff 1.86%, rgba(255, 255, 255, 0) 43.06%);
  z-index: 1;
}

@media (min-width: 1200px) {
  .lg-store-locator__bg-wave img {
    width: 100vw;
    /* height: 886px; */
  }
}

/* ── Header (l-container + grille) ───────────────── */

.lg-store-locator__header {
  position: relative;
  overflow: visible;
  margin-bottom: var(--space-8, 32px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

@media (min-width: 768px) {
  .lg-store-locator__header {
    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: auto auto;
    column-gap: var(--space-8, 32px);
  }
}

@media (min-width: 1200px) {
  .lg-store-locator__header {
    grid-template-columns: 1fr 1fr;
    column-gap: var(--space-12, 48px);
  }
}

/* ── Liseret SVG (positionné top-right, scaleY(-1)) ─ */

.lg-store-locator__liseret {
  position: absolute;
  top: -64px;
  /* left: 0; */
  pointer-events: none;
  z-index: 1;
  right: 1rem;
}

.lg-store-locator__liseret-svg {
  display: block;
  /* transform: scaleY(-1); */
}

/* Responsive : afficher uniquement le bon SVG */
.lg-store-locator__liseret-svg--tablet,
.lg-store-locator__liseret-svg--desktop {
  display: none;
}

@media (min-width: 768px) {
  .lg-store-locator__liseret {
    top: -50px;
  }
  .lg-store-locator__liseret-svg--mobile  { display: none; }
  .lg-store-locator__liseret-svg--tablet  { display: block; }
}

@media (min-width: 1200px) {
  .lg-store-locator__liseret {
    top: -64px;
  }
  .lg-store-locator__liseret-svg--tablet  { display: none; }
  .lg-store-locator__liseret-svg--desktop { display: block; }
}

/* ── Badge "NOS CONCESSIONS" + barres décoratives ── */

.lg-store-locator__badge-group {
  position: relative;
  z-index: 2;
  margin-bottom: var(--space-4, 16px);
}

@media (min-width: 768px) {
  .lg-store-locator__badge-group {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    margin-bottom: var(--space-4, 16px);
  }
}

/* ── Titre (2 lignes : noir + rouge) ─────────────── */

.lg-store-locator__title {
  position: relative;
  z-index: 2;
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-weight: var(--fw-bold, 700);
  font-size: 1.625rem; /* 26px mobile */
  line-height: 1.23;
  text-transform: uppercase;
  text-align: right;
  align-self: flex-start;
  width: 100%;
  margin: 0 0 var(--space-4, 16px);
}

@media (min-width: 768px) {
  .lg-store-locator__title {
    grid-column: 2;
    grid-row: 1 / 3;
    font-size: 1.875rem; /* 30px tablet */
    line-height: 1.067;
    text-align: right;
    align-self: center;
    margin: 0;
    width: auto;
  }
}

@media (min-width: 1200px) {
  .lg-store-locator__title {
    font-size: 4rem; /* 64px desktop */
    line-height: 1;
  }
}

.lg-store-locator__title-line1 {
  display: block;
  color: #141414;
}

.lg-store-locator__title-line2 {
  display: block;
  color: var(--color-rouge-lg, #E52A19);
}

/* ── Texte intro (wysiwyg) ───────────────────────── */

.lg-store-locator__intro {
  position: relative;
  z-index: 2;
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-size: 1rem; /* 16px mobile */
  line-height: 1.5;
  color: var(--color-noir-primary, #1A1A1A);
}

@media (min-width: 768px) {
  .lg-store-locator__intro {
    grid-column: 1;
    grid-row: 2;
    font-size: 1.125rem; /* 18px tablet */
    line-height: 1.444;
    align-self: start;
  }
}

@media (min-width: 1200px) {
  .lg-store-locator__intro {
    font-size: 1.5rem; /* 24px desktop */
    line-height: 1.292;
  }
}

.lg-store-locator__intro p {
  margin: 0;
}

.lg-store-locator__intro p + p {
  margin-top: var(--space-4, 16px);
}

/* ── Carte (container) ───────────────────────────── */

.lg-store-locator__map-container {
  position: relative;
  width: 90%;
  max-width: var(--container-max);
  margin-inline: auto;
  margin-bottom: var(--space-12, 48px);
  height: 528px;
  border-radius: 1.25rem; /* 20px mobile/tablet */
  box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.50);
  overflow: hidden;
}

@media (min-width: 768px) {
  .lg-store-locator__map-container {
    height: 528px;
  }
}

@media (min-width: 1200px) {
  .lg-store-locator__map-container {
    height: 680px;
    border-radius: 2.5rem; /* 40px desktop */
  }
}

/* ── Carte Google Maps ───────────────────────────── */

.lg-store-locator__map {
  width: 100%;
  height: 100%;
}

/* ── Message erreur (clé API manquante) ──────────── */

.lg-store-locator__error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  margin: 0 2rem var(--space-12, 48px);
  padding: var(--space-6, 24px);
  background: var(--color-surface-alt, #f5f5f5);
  border-radius: var(--radius-lg, 12px);
  color: var(--color-rouge-lg, #E52A19);
  font-weight: var(--fw-semibold, 600);
  text-align: center;
}

/* ── Toolbar filtres (overlay top) ───────────────── */
/*
  Mobile  : 2 rangées empilées, chacune est une pill glassmorphisme.
  Tablet+ : 1 seule rangée, la pill globale porte le style glassmorphisme,
            les rangées internes deviennent transparentes.
*/

.lg-store-locator__toolbar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2, 8px);
  /* Pas de style glassmorphisme sur le wrapper en mobile */
}

@media (min-width: 768px) {
  .lg-store-locator__toolbar {
    flex-direction: row;
    align-items: center;
    gap: var(--space-4, 16px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    border-radius: 125rem;
    border: 1px solid #C8C8C8;
    background: rgba(116, 116, 116, 0.30);
    box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.20);
    backdrop-filter: blur(10px);
    max-width: calc(100% - var(--space-6, 24px));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .lg-store-locator__toolbar::-webkit-scrollbar {
    display: none;
  }
}

@media (min-width: 1200px) {
  .lg-store-locator__toolbar {
    padding: var(--space-3, 12px) var(--space-4, 16px);
    gap: 3rem; /* 48px — espacement brand-btn / tabs */
  }
}

/* ── Rangées toolbar ─────────────────────────────── */

.lg-store-locator__toolbar-row {
  display: flex;
  align-items: center;
  padding: var(--space-2, 8px) var(--space-3, 12px);
  border-radius: 125rem;
  border: 1px solid #C8C8C8;
  background: rgba(116, 116, 116, 0.30);
  box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.20);
  backdrop-filter: blur(10px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.lg-store-locator__toolbar-row::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  /* Sur tablet+, les rangées perdent leur style propre
     (c'est le toolbar parent qui porte le glassmorphisme) */
  .lg-store-locator__toolbar-row {
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0;
    overflow: visible;
  }
}

/* ── Bouton "Filtrer par Marques" ────────────────── */

.lg-store-locator__brand-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3, 12px);
  padding: 3px var(--space-4, 16px);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  color: var(--color-blanc, #fff);
  border: none;
  border-radius: var(--radius-pill, 9999px);
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5), inset 0 0 30px 0 rgba(255, 255, 255, 0.25);
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-size: 0.75rem; /* 12px mobile/tablet */
  font-weight: var(--fw-bold, 700);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-base, 0.2s ease);
  flex-shrink: 0;
}

.lg-store-locator__brand-btn:hover {
  background: rgba(0, 0, 0, 0.65);
}

.lg-store-locator__brand-btn-icon {
  width: 17px;
  height: 18px;
  flex-shrink: 0;
}

@media (min-width: 1200px) {
  .lg-store-locator__brand-btn {
    font-size: 0.875rem; /* 14px desktop */
    padding: var(--space-2, 8px) var(--space-6, 24px);
  }
}

/* ── Onglets univers ─────────────────────────────── */

.lg-store-locator__tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1, 4px);
}

@media (min-width: 1200px) {
  .lg-store-locator__tabs {
    gap: var(--space-4, 16px);
  }
}

.lg-store-locator__tab {
  padding: 2px var(--space-2-5, 10px);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  color: var(--color-blanc, #fff);
  border: none;
  border-radius: var(--radius-pill, 9999px);
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5), inset 0 0 30px 0 rgba(255, 255, 255, 0.25);
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-size: 0.625rem; /* 10px mobile/tablet */
  font-weight: var(--fw-bold, 700);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-base, 0.2s ease), box-shadow var(--transition-base, 0.2s ease);
  flex-shrink: 0;
}

.lg-store-locator__tab:hover {
  background: rgba(0, 0, 0, 0.65);
}

.lg-store-locator__tab--active {
  background: var(--color-rouge-lg, #E52A19);
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5), inset 0 0 20px 0 rgba(255, 255, 255, 0.5);
}

.lg-store-locator__tab--active:hover {
  background: var(--color-rouge-lg, #E52A19);
}

@media (min-width: 1200px) {
  .lg-store-locator__tab {
    font-size: 0.875rem; /* 14px desktop */
    padding: var(--space-2, 8px) var(--space-6, 24px);
  }
}

/* ── Dropdown marques ────────────────────────────── */

.lg-store-locator__brand-dropdown {
  position: absolute;
  top: calc(20px + 52px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 320px;
  max-width: calc(100% - var(--space-8, 32px));
  background: var(--color-blanc, #fff);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-modal, 0 8px 30px rgba(0,0,0,0.15));
  overflow: hidden;
}

.lg-store-locator__brand-dropdown[hidden] {
  display: none;
}

.lg-store-locator__brand-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4, 16px) var(--space-5, 20px);
  border-bottom: 1px solid var(--color-gris-100, #eee);
}

.lg-store-locator__brand-dropdown-title {
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-size: var(--fs-body, 1rem);
  font-weight: var(--fw-bold, 700);
  color: var(--color-noir-primary, #1A1A1A);
}

.lg-store-locator__brand-dropdown-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-noir-primary, #1A1A1A);
  border-radius: var(--radius-sm, 4px);
  transition: background var(--transition-base, 0.2s ease);
}

.lg-store-locator__brand-dropdown-close:hover {
  background: var(--color-gris-50, #f5f5f5);
}

.lg-store-locator__brand-list {
  padding: var(--space-3, 12px) var(--space-5, 20px);
  max-height: 280px;
  overflow-y: auto;
}

.lg-store-locator__brand-item {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  padding: var(--space-3, 12px) 0;
}

.lg-store-locator__brand-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--color-rouge-lg, #E52A19);
  cursor: pointer;
  flex-shrink: 0;
}

.lg-store-locator__brand-label {
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-size: var(--fs-body, 1rem);
  font-weight: var(--fw-bold, 700);
  color: var(--color-noir-primary, #1A1A1A);
  cursor: pointer;
}

.lg-store-locator__brand-apply {
  display: block;
  width: calc(100% - var(--space-5, 20px) * 2);
  margin: var(--space-3, 12px) var(--space-5, 20px) var(--space-5, 20px);
  padding: var(--space-3, 12px);
  background: var(--color-rouge-lg, #E52A19);
  color: var(--color-blanc, #fff);
  border: none;
  border-radius: var(--radius-md, 8px);
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-size: var(--fs-body, 1rem);
  font-weight: var(--fw-bold, 700);
  text-align: center;
  cursor: pointer;
  transition: background var(--transition-base, 0.2s ease);
}

.lg-store-locator__brand-apply:hover {
  background: #c9221a;
}

/* ── Contrôles custom (zoom + géolocalisation) ───── */

.lg-store-locator__controls {
  position: absolute;
  bottom: var(--space-6, 24px);
  right: var(--space-4, 16px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
}

.lg-store-locator__control {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--color-blanc, #fff);
  border: none;
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-card, 0 2px 8px rgba(0,0,0,0.1));
  cursor: pointer;
  color: var(--color-noir-primary, #1A1A1A);
  transition: box-shadow var(--transition-base, 0.2s ease), background var(--transition-base, 0.2s ease);
}

.lg-store-locator__control:hover {
  box-shadow: var(--shadow-card-hover, 0 4px 16px rgba(0,0,0,0.15));
}

.lg-store-locator__control:active {
  background: var(--color-gris-50, #f5f5f5);
}

/* Zoom : uniquement sur desktop */
.lg-store-locator__control--zoom-in,
.lg-store-locator__control--zoom-out {
  display: none;
}

@media (min-width: 1200px) {
  .lg-store-locator__control--zoom-in,
  .lg-store-locator__control--zoom-out {
    display: flex;
  }
}

/* ── InfoWindow Google Maps (custom styling) ─────── */

.lg-store-locator__infowindow {
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  min-width: 260px;
  max-width: 340px;
}

.lg-store-locator__infowindow-title {
  font-size: var(--fs-body-lg, 1.125rem);
  font-weight: var(--fw-bold, 700);
  color: var(--color-noir-primary, #1A1A1A);
  margin: 0 0 var(--space-4, 16px);
  line-height: var(--lh-tight, 1.2);
}

.lg-store-locator__infowindow-row {
  display: flex;
  gap: var(--space-3, 12px);
  padding: var(--space-2, 8px) 0;
  font-size: var(--fs-body-sm, 0.875rem);
  line-height: var(--lh-body, 1.6);
  color: var(--color-noir-primary, #1A1A1A);
}

.lg-store-locator__infowindow-label {
  font-weight: var(--fw-bold, 700);
  white-space: nowrap;
  flex-shrink: 0;
}

.lg-store-locator__infowindow-value--open {
  color: #16a34a;
  font-weight: var(--fw-semibold, 600);
}

.lg-store-locator__infowindow-value--closed {
  color: var(--color-rouge-lg, #E52A19);
  font-weight: var(--fw-semibold, 600);
}

.lg-store-locator__infowindow-actions {
  display: flex;
  gap: var(--space-2, 8px);
  margin-top: var(--space-4, 16px);
}

.lg-store-locator__infowindow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2, 8px) var(--space-4, 16px);
  border: none;
  border-radius: var(--radius-pill, 9999px);
  font-family: var(--ff-heading, 'Inria Sans', sans-serif);
  font-size: var(--fs-body-sm, 0.875rem);
  font-weight: var(--fw-bold, 700);
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition-base, 0.2s ease);
}

.lg-store-locator__infowindow-btn:hover {
  opacity: 0.85;
}

.lg-store-locator__infowindow-btn--primary {
  background: var(--color-rouge-lg, #E52A19);
  color: var(--color-blanc, #fff);
}

.lg-store-locator__infowindow-btn--secondary {
  background: var(--color-noir-primary, #1A1A1A);
  color: var(--color-blanc, #fff);
}

/* ── États contrôles (loading / erreur) ──────────── */

.lg-store-locator__control--loading {
  opacity: 0.5;
  pointer-events: none;
  animation: lg-pulse 1s ease-in-out infinite;
}

.lg-store-locator__control--error {
  background: var(--color-rouge-lg, #E52A19);
  color: var(--color-blanc, #fff);
}

@keyframes lg-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Masquer les UI Google Maps par défaut ────────── */

.lg-store-locator__map .gm-bundled-control,
.lg-store-locator__map .gmnoprint,
.lg-store-locator__map .gm-style-cc,
.lg-store-locator__map .gm-fullscreen-control {
  display: none !important;
}

.lg-store-locator__map .gm-style-iw-c {
  padding: var(--space-5, 20px) !important;
  border-radius: var(--radius-lg, 12px) !important;
  box-shadow: var(--shadow-modal, 0 8px 30px rgba(0,0,0,0.15)) !important;
}

.lg-store-locator__map .gm-style-iw-d {
  overflow: auto !important;
}

.lg-store-locator__map .gm-style-iw-c button.gm-ui-hover-effect {
  top: var(--space-2, 8px) !important;
  right: var(--space-2, 8px) !important;
}

.lg-store-locator__map .gm-style-iw-tc {
  display: none !important;
}
