/* ==========================================================
   KIOWA — Page Agents agréés
   ========================================================== */
.agents-page {
  --ag-green: #1b6b45;
  --ag-green-dark: #12502f;
  --ag-green-soft: #e8f1ec;
  --ag-zone: #cfe3d7;
  --ag-land: #e7e8e7;
  --ag-line: #e9e9e9;
  --ag-surface: #f7f7f7;
  --ag-text: #1f1f1f;
  --ag-muted: #696c70;
}

/* ---------- Intro ---------- */
.ag-intro { max-width: 720px; }
.ag-eyebrow {
  color: var(--ag-green);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ---------- Grille principale ---------- */
.ag-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-areas:
    "locate map"
    "list   map";
  grid-template-rows: auto 1fr;
  gap: 24px 40px;
  margin-top: 40px;
  align-items: start;
}
.ag-locate-block { grid-area: locate; }
.ag-map-wrap     { grid-area: map; }
.ag-list-block   { grid-area: list; }

@media (max-width: 1023px) {
  .ag-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "locate" "map" "list";
    grid-template-rows: auto;
    gap: 20px;
    margin-top: 28px;
  }
}

/* ---------- Bouton localisation ---------- */
.ag-locate-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--ag-text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  transition: background .3s;
}
.ag-locate-btn i { font-size: 20px; }
.ag-locate-btn:hover { background: var(--ag-green); }
.ag-locate-btn[aria-busy="true"] { opacity: .7; pointer-events: none; }
.ag-locate-btn[aria-busy="true"] i { animation: ag-spin 1s linear infinite; }
@keyframes ag-spin { to { transform: rotate(360deg); } }

.ag-status { margin-top: 10px; min-height: 0; }
.ag-status:empty { display: none; }

/* ---------- Carte "agent le plus proche" ---------- */
.ag-nearest {
  margin-top: 16px;
  padding: 20px;
  border-radius: 16px;
  background: var(--ag-green-soft);
  border: 1px solid var(--ag-zone);
}
.ag-nearest[hidden] { display: none; }
.ag-nearest-label { color: var(--ag-green); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.ag-nearest-name { font-size: 20px; line-height: 28px; font-weight: 600; margin: 6px 0 2px; }
.ag-nearest-actions { display: flex; gap: 10px; margin-top: 16px; }
.ag-btn-dark, .ag-btn-light {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: background .3s, color .3s;
}
.ag-btn-dark { background: var(--ag-green); color: #fff; }
.ag-btn-dark:hover { background: var(--ag-green-dark); }
.ag-btn-light { background: #fff; color: var(--ag-text); border: 1px solid var(--ag-zone); }
.ag-btn-light:hover { border-color: var(--ag-green); color: var(--ag-green); }

/* ---------- Carte de l'Algérie ---------- */
.ag-map-wrap {
  position: relative;
  background: var(--ag-surface);
  border-radius: 32px;
  padding: 32px;
}
@media (max-width: 640px) {
  .ag-map-wrap { padding: 16px; border-radius: 20px; }
}
.ag-map {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 1000 / 993;
}
.dz-map-svg { display: block; width: 100%; height: 100%; }
.dz-map-svg .wilaya {
  fill: var(--ag-land);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  transition: fill .25s;
}
.dz-map-svg .wilaya:hover { fill: #dcdedd; }
.dz-map-svg .wilaya.has-agent { fill: var(--ag-zone); }
.dz-map-svg .wilaya.has-agent:hover,
.dz-map-svg .wilaya.is-active { fill: #b5d4c2; }

/* ---------- Points (marqueurs) ---------- */
.ag-pin {
  position: absolute;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  min-height: 0;
  font-size: 0;
  line-height: 0;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  background: var(--ag-green);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
  transition: transform .2s ease, opacity .25s, background .2s;
}
.ag-pin.is-siege { background: var(--ag-text); width: 18px; height: 18px; }
.ag-pin:hover,
.ag-pin:focus-visible,
.ag-pin.is-active { transform: translate(-50%, -50%) scale(1.45); z-index: 4; outline: none; background: var(--ag-green-dark); }
.ag-pin.is-siege.is-active, .ag-pin.is-siege:hover { background: #000; }
.ag-pin-count {
  position: absolute;
  top: -9px;
  right: -11px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: #fff;
  color: var(--ag-green);
  border: 1.5px solid var(--ag-green);
  font-size: 9px;
  line-height: 12px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}
.ag-pin.is-nearest::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: var(--ag-green);
  opacity: .35;
  animation: ag-pulse 1.8s ease-out infinite;
  z-index: -1;
}
.ag-pin.is-dimmed { opacity: .15; pointer-events: none; }
@keyframes ag-pulse {
  0%   { transform: scale(.6); opacity: .5; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* Wilayas couvertes : survolables comme les points */
.dz-map-svg .wilaya { vector-effect: non-scaling-stroke; }
.dz-map-svg .wilaya.has-agent { cursor: pointer; }

/* ---------- Zoom ---------- */
.ag-zoom {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 5;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.ag-zoom-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ag-muted);
  transition: all .2s;
}
.ag-zoom-btn i { font-size: 14px; vertical-align: -2px; }
.ag-zoom-btn.active { background: var(--ag-text); color: #fff; }
@media (max-width: 640px) {
  .ag-zoom { position: static; margin-bottom: 10px; }
}

/* Position de l'utilisateur */
.ag-user {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1ca3e6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(28,163,230,.25);
  transform: translate(-50%, -50%);
  z-index: 3;
}
.ag-user[hidden] { display: none; }

/* ---------- Infobulle ---------- */
.ag-tip {
  position: absolute;
  z-index: 10;
  left: 24px;
  bottom: 64px;
  width: 280px;
  padding: 18px 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
  animation: ag-fade .2s ease;
}
.ag-tip[hidden] { display: none; }
@keyframes ag-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ag-tip-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ag-surface);
  font-size: 14px;
}
.ag-tip-close:hover { background: var(--ag-text); color: #fff; }
.ag-tip-wilaya { color: var(--ag-green); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding-right: 30px; }
.ag-tip-name { font-size: 18px; line-height: 26px; font-weight: 600; margin-top: 4px; padding-right: 20px; }
.ag-tip { width: 300px; max-height: 380px; overflow-y: auto; }
.ag-tip-count { margin-top: 2px; }
.ag-tip-agents { margin-top: 10px; display: flex; flex-direction: column; }
.ag-tip-agents li { padding: 10px 0; border-top: 1px solid var(--ag-line); }
.ag-tip-agent { display: flex; flex-direction: column; }
.ag-tip-agent .ag-tip-name { font-size: 15px; line-height: 22px; margin: 0; padding: 0; }
.ag-tip-agent .ag-tip-name i { font-size: 13px; color: var(--ag-green); }
.ag-tip-agent:hover .ag-tip-name { color: var(--ag-green); text-decoration: underline; text-underline-offset: 3px; }
.ag-tip-meta { font-size: 13px; line-height: 18px; color: var(--ag-muted); }
.ag-tip-dist { font-size: 12px; font-weight: 600; color: var(--ag-green); }
.ag-tip-tel { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; font-weight: 500; }
.ag-tip-tel:hover { color: var(--ag-green); }
.ag-tip-lines { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.ag-tip-lines li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 20px; color: var(--ag-muted); }
.ag-tip-lines li[hidden] { display: none; }
.ag-tip-lines i { font-size: 18px; color: var(--ag-text); flex-shrink: 0; }
.ag-tip-lines a:hover { color: var(--ag-green); }
.ag-tip-route {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ag-green);
  border-bottom: 1px solid currentColor;
}
.ag-tip-route:hover { color: var(--ag-text); }

/* Sur mobile, l'infobulle devient une fiche sous la carte */
@media (max-width: 640px) {
  .ag-tip {
    position: relative;
    width: auto;
    left: auto !important;
    top: auto !important;
    bottom: auto !important;
    margin-top: 12px;
    box-shadow: none;
    border: 1px solid var(--ag-line);
  }
}

/* ---------- Légende ---------- */
.ag-legend { display: flex; justify-content: center; gap: 24px; margin-top: 16px; }
.ag-legend span { display: inline-flex; align-items: center; gap: 8px; }
.ag-legend-pin { width: 11px; height: 11px; box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.3); border-radius: 50%; background: var(--ag-green); display: inline-block; }
.ag-legend-pin.is-siege { background: var(--ag-text); }
.ag-legend-zone { width: 14px; height: 10px; border-radius: 3px; background: var(--ag-zone); display: inline-block; }

/* ---------- Filtres & liste ---------- */
.ag-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.ag-chip {
  padding: 7px 4px;
  text-align: center;
  border: 1px solid var(--ag-line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: all .25s;
}
.ag-chip:hover { border-color: var(--ag-text); }
.ag-chip.active { background: var(--ag-text); border-color: var(--ag-text); color: #fff; }

.ag-filters-spec { grid-template-columns: 1.4fr 1fr 1.2fr; margin-top: 8px; }
.ag-chip i { font-size: 14px; vertical-align: -2px; }
.ag-count { margin-top: 16px; }

.ag-list {
  margin-top: 8px;
  border-top: 1px solid var(--ag-line);
  max-height: 560px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
@media (max-width: 1023px) { .ag-list { max-height: none; overflow: visible; } }
.ag-list li { display: flex; align-items: center; border-bottom: 1px solid var(--ag-line); transition: background .2s; }
.ag-list li[hidden] { display: none; }
.ag-list li:hover, .ag-list li.is-active { background: var(--ag-surface); }
.ag-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 4px 14px 8px;
}
.ag-item-code {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ag-green-soft);
  color: var(--ag-green);
  font-size: 13px;
  font-weight: 600;
}
.ag-list li.is-active .ag-item-code { background: var(--ag-green); color: #fff; }
.ag-item.is-siege .ag-item-code { background: var(--ag-text); color: #fff; }
.ag-item-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ag-item-name { font-size: 15px; line-height: 22px; font-weight: 600; }
.ag-item:hover .ag-item-name { color: var(--ag-green); text-decoration: underline; text-underline-offset: 3px; }
.ag-item-dist { color: var(--ag-green); font-size: 12px; font-weight: 600; white-space: nowrap; }
.ag-item-dist[hidden] { display: none; }
.ag-item-call {
  width: 36px;
  height: 36px;
  margin-right: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--ag-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #fff;
  transition: all .25s;
}
.ag-item-call:hover { background: var(--ag-green); border-color: var(--ag-green); color: #fff; }

/* Étiquettes de spécialité */
.ag-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.ag-tag {
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ag-tag-froid { background: #e6f4fb; color: #0f78ab; }
.ag-tag-electronique { background: #f1efe9; color: #6b5a2e; }

/* ---------- Contacts ---------- */
.ag-contact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid var(--ag-line);
}
@media (max-width: 1023px) { .ag-contact { grid-template-columns: minmax(0, 1fr); margin-top: 40px; padding-top: 32px; } }
.ag-contact-item { display: flex; flex-direction: column; gap: 6px; }
.ag-contact-item .heading6 { font-size: 18px; line-height: 26px; font-weight: 600; margin-bottom: 4px; }
.ag-contact-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--ag-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 10px;
}
.ag-contact-line { color: var(--ag-muted); width: fit-content; }
.ag-contact-line:hover { color: var(--ag-green); }
.ag-products { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-product {
  font-size: 13px;
  line-height: 20px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ag-surface);
  color: var(--ag-text);
}

/* Titres : pas de capitalisation automatique (français) */
.ag-intro .heading3,
.ag-contact .heading6 { text-transform: none; }
@media (max-width: 767px) {
  .ag-intro .heading3 { font-size: 26px; line-height: 34px; }
}

/* Petits écrans : marqueurs plus discrets */
@media (max-width: 640px) {
  .ag-pin { width: 13px; height: 13px; border-width: 2px; }
  .ag-pin.is-siege { width: 15px; height: 15px; }
  .ag-pin-count { top: -8px; right: -9px; min-width: 13px; height: 13px; font-size: 8px; line-height: 10px; padding: 0 2px; }
  .ag-tip { max-height: none; }
}

/* Liste repliée (mobile) */
.ag-list li.is-extra { display: none; }
.ag-more {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--ag-line);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: all .2s;
}
.ag-more:hover { border-color: var(--ag-text); }
.ag-more[hidden] { display: none; }
@media (max-width: 640px) {
  .ag-legend { flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
}
