/* Éléments propres à l'accueil ; identité et primitives dans shared/. */

/* =========================================================
   RECHERCHE / DÉCOUVERTE
   ========================================================= */

body[data-scope="overview"] .search-grid {
  grid-template-columns: minmax(260px, .85fr) minmax(0, 1.8fr);
  align-items: center;
}

.qr-discovery {
  display: none;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 20px 24px;
  background: #f1ebff;
  border-radius: 20px;
}

body[data-scope="overview"] .qr-discovery {
  display: grid;
}

.qr-discovery h2 {
  font-size: 1.65rem;
  letter-spacing: -.04em;
}

.qr-discovery p {
  max-width: 620px;
  margin-top: 9px;
  color: #5f576c;
  font-size: .83rem;
  line-height: 1.55;
}

.qr-discovery .field-label {
  margin-bottom: 7px;
  color: var(--purple);
  font-size: .63rem;
  letter-spacing: .1em;
}

.qr-sticker {
  padding: 9px 8px 12px;
  background: #fff;
  border: 1px solid #d7c8ef;
  border-radius: 14px;
  box-shadow: 0 5px 0 #d7c8ef;
  text-align: center;
  text-decoration: none;
  transform: rotate(-4deg);
}

.qr-sticker img {
  width: 100%;
  height: auto;
}

.qr-sticker strong {
  color: var(--purple);
  font-size: .59rem;
  letter-spacing: .03em;
}

/* =========================================================
   COUVERTURE : CARTE + LISTE DES ZONES
   ========================================================= */

.coverage-layout {
  --coverage-sticky-top: 106px;

  align-items: start;
  overflow: visible;
}

#coverageMap {
  height: 460px;
  min-height: 460px;
}

.coverage-map-card {
  height: 540px;
  display: flex;
  flex-direction: column;
  height: 532px;
  border-bottom-right-radius: 12px;
}

/* Sticky uniquement lorsque la carte et la liste sont côte à côte. */
@media (min-width: 951px) {
  .coverage-map-card {
    position: sticky;
    top: var(--coverage-sticky-top);
    align-self: start;
  }
}

.coverage-map-head {
  min-height: 70px;
}

.coverage-map-head small {
  display: none;
}

/* La page défile naturellement : plus de scrollbar interne à la liste. */
.zone-list {
  height: auto;
  max-height: none;
  overflow: visible;
  overscroll-behavior: auto;
  padding: 2px 0 4px 2px;
  align-content: start;
}

/* =========================================================
   ZONES PROPOSÉES
   ========================================================= */

.zone-group {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e0d9;
  border-radius: 26px;
  transition:
    transform .2s ease,
    box-shadow .2s ease,
    border-color .2s ease;
}

.zone-group:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--orange) 18%, #e2e0d9);
  box-shadow: 0 10px 30px rgba(20, 20, 20, .045);
}

.zone-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  grid-template-areas:
    "content arrow"
    "content count";
  column-gap: 24px;
  row-gap: 12px;

  min-height: 150px;
  padding: 28px 26px 18px;

  color: inherit;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.zone-card:hover {
  background: #fcfaf5;
  box-shadow: none;
  transform: none;
}

.zone-card > div {
  grid-area: content;
  min-width: 0;
}

.zone-card .field-label {
  display: block;
  margin: 0 0 8px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.zone-card h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: clamp(24px, 2.2vw, 29px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.zone-card p {
  max-width: 520px;
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.55;
}

.zone-card > div > small {
  display: block;
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.4;
}

/* Flèche */
.zone-arrow {
  grid-area: arrow;
  justify-self: end;
  align-self: start;

  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--orange);
  color: var(--ink);
  border-radius: 50%;
  transition:
    transform .18s ease,
    background-color .18s ease;
}

.zone-arrow .icon {
  width: 23px;
  height: 23px;
}

.zone-card:hover .zone-arrow {
  background: color-mix(in srgb, var(--orange) 9%, transparent);
  transform: translateY(-50%) translateX(3px);
  color: var(--ink);
  background: #fff;
}

/* Nombre d'adresses */
.zone-count {
  grid-area: count;
  justify-self: end;
  align-self: end;

  width: 72px;
  min-height: 58px;
  padding: 8px 6px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  color: var(--text-muted);
  background: transparent;
  border: 1px solid #ffe0d2;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
}

.zone-count strong {
  display: block;
  margin-bottom: 3px;
  color: var(--orange);
  font-size: 23px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.03em;
}

/* =========================================================
   VILLES DU COIN MIAMM!
   ========================================================= */

.coverage-city-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 24px;
}

.zone-group .coverage-city-links {
  margin-top: 24px;
}

.coverage-city-links button {
  appearance: none;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  min-height: 40px;
  padding: 9px 13px;

  color: var(--text);
  background: #f4f2ed;
  border: 1px solid transparent;
  border-radius: 12px;

  font: inherit;
  line-height: 1;

  cursor: pointer;
  transition:
    background-color .18s ease,
    border-color .18s ease,
    color .18s ease,
    transform .18s ease;
}


.zone-group .coverage-city-links button {
  min-height: 0;
  color: var(--text, #171717);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
}

.coverage-city-links button strong {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.1;
}

.coverage-city-links button small {
  display: none;
}

.coverage-city-links button:hover {
  color: var(--orange);
  background: #fff;
  border-color: color-mix(in srgb, var(--orange) 30%, #ddd);
  transform: translateY(-1px);
}

.zone-group .coverage-city-links button:hover {
  border-color: color-mix(in srgb, var(--orange) 35%, #ddd);
}

.coverage-city-links button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--orange) 20%, transparent);
  outline-offset: 2px;
}

/* =========================================================
   CARTE / PINS / HEADER DE CARTE
   ========================================================= */

.map-head {
  gap: 10px;
}

.map-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.map-head-actions .link-btn {
  font-size: .75rem;
}

.map-pin {
  border-color: var(--merchant-color, #fff) !important;
  background: color-mix(in srgb, var(--merchant-color, #f6532f) 14%, white) !important;
}

.map-pin .art {
  width: 36px;
  height: 36px;
}

.map-pin.open::after,
.map-pin.soon::after {
  border: 2px solid #fff;
}

.hero-art .art:first-child {
  /* width:180px; left:-15px; top:9px; */
}

.hero-art .art:last-child {
  width: 95px;
  /* right:-8px; top:60px; */
}

/* =========================================================
   VUE GLOBALE MES FAVORIS
   ========================================================= */

body[data-scope="favorites"] .brand-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--orange-dark);
  transform: none;
}

body[data-scope="favorites"] .brand-star .icon {
  width: 38px;
  height: 38px;
  fill: #f6532f20;
}

/* État actuel conservé : logo/baseline/bouton favoris restent affichés. */
body[data-scope="favorites"] .brand-word,
body[data-scope="favorites"] .brand-baseline,
body[data-scope="favorites"] #favoritesButton {
  display: inline-flex;
}

body[data-scope="favorites"] .hero,
body[data-scope="favorites"] .search-panel {
  display: none;
}

body[data-scope="favorites"] .zone-content {
  padding-top: 8px;
}

/* =========================================================
   PUCE DE COULEUR DEVANT LE TITRE DES ZONES
   même principe que .zone-switcher-dot
   ========================================================= */

.zone-card {
  --zone-accent: var(--purple);
  --zone-soft: var(--lilac);
}

/* Côte Basque */
.zone-card[data-zone="cote-basque"] {
  --zone-accent: #345b40;
  --zone-soft: #e4eddf;
}

/* Pays de Dieulefit */
.zone-card[data-zone="dieulefit"] {
  --zone-accent: var(--purple);
  --zone-soft: var(--lilac);
}

.zone-card h3 {
  display: flex;
  align-items: center;
  gap: 11px;
}

.zone-card h3::before {
  content: "";

  width: 9px;
  height: 9px;
  flex: 0 0 9px;

  border-radius: 50%;
  background: var(--zone-accent);

  box-shadow:
    0 0 0 4px var(--zone-soft);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1099px) {
  .header-cart {
    width: 39px;
    height: 42px;
    min-height: 42px;
    padding: 8px;
    border-radius: 12px;
    position: relative;
  }
  .header-cart .header-cart-label { display: none; }
  .header-cart .header-count { display: grid; place-items: center; position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 50%; background: #5d4784; color: #fff; font-size: .65rem; border: 2px solid var(--bg); }

}

@media (max-width: 1050px) {
  body[data-scope="overview"] .search-grid {
    grid-template-columns: 1fr;
  }

  .qr-discovery {
    grid-template-columns: 110px 1fr;
  }

  body[data-scope="overview"] .search-cell-place {
    max-width: none;
  } 
  
}

@media (max-width: 850px) {
  .coverage-layout {
    grid-template-columns: 1fr;
  }

  .zone-list {
    padding: 0;
  }

  .coverage-map-card {
    height: 420px;
  }

  #coverageMap {
    height: 340px;
    min-height: 340px;
  }

  .coverage-map-head {
    min-height: 70px;
  }

  .map-head {
    flex-wrap: wrap;
  }

  .map-head-actions {
    margin-left: auto;
  }

  .coverage-heading h2 {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .zone-card {
    grid-template-columns: minmax(0, 1fr) 62px;
    column-gap: 14px;
    padding: 22px 20px 14px;
  }

  .zone-card h3 {
    font-size: 24px;
  }

  .zone-card p {
    font-size: 15px;
    line-height: 1.5;
  }

  .zone-count {
    width: 62px;
    min-height: 54px;
    border-radius: 12px;
  }

  .zone-count strong {
    font-size: 21px;
  }

  .zone-arrow {
    width: 34px;
    height: 34px;
  }

  .zone-arrow .icon {
    width: 21px;
    height: 21px;
  }

  .coverage-city-links {
    gap: 7px;
    padding: 0 20px 20px;
  }

  .coverage-city-links button {
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 11px;
  }

  .coverage-city-links button strong {
    font-size: 13px;
  }
}

@media (max-width: 550px) {
  .qr-discovery {
    grid-template-columns: 85px minmax(0, 1fr);
    gap: 15px;
    padding: 16px;
  }

  .qr-discovery h2 {
    font-size: 1.28rem;
  }

  .qr-discovery .field-label {
    font-size: .57rem;
  }

  .qr-discovery p {
    font-size: .76rem;
  }

  .qr-sticker {
    padding: 5px 4px 8px;
  }

  .qr-sticker strong {
    font-size: .44rem;
  }

  .coverage-map-head {
    gap: 8px;
    padding: 12px;
  }

  .coverage-map-head strong {
    font-size: .8rem;
  }

  .coverage-map-modes button {
    padding: 7px 9px;
    font-size: .7rem;
  }

  .zone-card {
    padding-right: 43px;
  }

  .zone-card h3 {
    font-size: 1.4rem;
  }

  .hero-art {
    display: none;
  }

  .hero {
    padding-top: 26px;
  }

  .hero h1 {
    font-size: 2.55rem;
  }

  .search-panel {
    padding: 17px;
  }

  .zone-context-bar {
    align-items: flex-start;
  }

  .zone-context-bar .link-btn {
    white-space: nowrap;
  }

  .zone-context-bar > span {
    max-width: 65%;
  }
}

/* =========================================================
   FAVORIS — état du header + navigation non destructive
   ========================================================= */

/* Le cœur remplace l’emblème territorial tant que le filtre favoris est actif,
   y compris lorsqu’on reste dans un territoire chargé. */
body.favorites-active .brand-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--orange-dark);
  transform: none;
}

body.favorites-active .brand-star .icon {
  width: 38px;
  height: 38px;
  fill: #f6532f20;
}

/* Le bouton reste visuellement sélectionné tant que la liste est filtrée. */
body[data-page="home"] [data-favorites-trigger][aria-pressed="true"] {
  background: #ffe7de;
  color: var(--orange-dark);
  box-shadow: inset 0 0 0 1px #f3b8a6;
}

body[data-page="home"] .action-favorites[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--orange);
}

/* En favoris globaux, on ne masque plus la home. Elle reste simplement au-dessus
   de la liste/carte vers lesquelles le clic fait défiler la page. */
body[data-scope="favorites"] .hero,
body[data-scope="favorites"] .search-panel {
  display: flex;
}

body[data-scope="favorites"] .search-panel {
  display: block;
}

body[data-scope="favorites"] .search-grid {
  grid-template-columns: minmax(260px, .85fr) minmax(0, 1.8fr);
  align-items: center;
}

body[data-scope="favorites"] [data-zone-control] {
  display: none;
}

body[data-scope="favorites"] .qr-discovery {
  display: grid;
}

#resultsToolbar {
  scroll-margin-top: calc(var(--header-height, 88px) + 18px);
}

.results-title-block { min-width: 0; }
.results-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.favorites-exit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #efc1b3;
  border-radius: 999px;
  background: #fff6f2;
  color: var(--orange-dark);
  font-size: .75rem;
  font-weight: 750;
  white-space: nowrap;
}

.favorites-exit:hover { background: #ffe9e1; }
.favorites-exit .icon { width: 15px; height: 15px; }

@media(max-width:700px) {
  body[data-scope="favorites"] .search-grid { grid-template-columns: 1fr; }
  body[data-scope="favorites"] .qr-discovery { grid-template-columns: 104px minmax(0,1fr); }
  .results-title-row { gap: 8px; }
  .favorites-exit { min-height: 32px; font-size: .7rem; }
}


/* Carte d'accueil : tête compacte, quel que soit le mode. */
.coverage-map-head {
  min-height: 70px;
}

.coverage-map-head small {
  display: none !important;
}

@media (max-width: 650px) {
  .coverage-map-head {
    min-height: 70px;
  }
}

/* Mobile : la carte garde uniquement le sélecteur Adresses / Secteurs. */
@media (max-width: 650px) {
  .coverage-map-head > div:first-child {
    display: none;
  }

  .coverage-map-head {
    min-height: 70px;
    justify-content: flex-end;
  }
}
