/* ============================================================
   Page /affilies — carte des affiliés Propulsecar
   Freelances : bleu #034AAA   Professionnels : navy #0B1F3A
   ============================================================ */

:root {
  --af-freelance: #034AAA;
  --af-freelance-light: #E8F0FB;
  --af-freelance-mid: #2A6FCC;
  --af-pro: #0B1F3A;
  --af-pro-light: #E8ECF2;
  --af-pro-mid: #1A3055;
  --af-navy: #0B1F3A;
  --af-g50:  #f7f8fa;
  --af-g100: #eef0f4;
  --af-g200: #dde1ea;
  --af-g400: #9aa3b8;
  --af-g600: #636d85;
  --af-g900: #111827;
  --af-green: #22c55e;
  --af-amber: #f59e0b;
  --af-r:  10px;
  --af-sd: 0 1px 4px rgba(11,31,58,.07);
  --af-sm: 0 4px 18px rgba(11,31,58,.11);
  --af-sl: 0 10px 40px rgba(11,31,58,.18);
}

html, body { overflow-x: hidden; }

/* ============================================================
   DOTS couleur (réutilisés partout)
   ============================================================ */
.af-dot-freelance { background: var(--af-freelance); }
.af-dot-pro       { background: var(--af-pro); }

/* ============================================================
   HERO EN-TÊTE BRANDÉ
   ============================================================ */
.af-page-title {
  background: var(--af-navy);
  padding: 32px 0 28px;
  border-bottom: none;
  position: relative;
  overflow: hidden;
}

.af-page-title::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.af-page-title::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(3,74,170,0.35) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
}

.af-page-title .container {
  position: relative;
  z-index: 1;
}

.af-page-title h1 {
  font-family: 'League Spartan', sans-serif !important;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 800;
  color: white !important;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.af-page-title p {
  color: rgba(255,255,255,0.7) !important;
  font-size: 15px;
  font-weight: 400;
  margin-bottom: 0;
}

.af-title-badges {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.af-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.af-title-badge-freelance {
  background: rgba(3,74,170,0.45);
  border: 1px solid rgba(42,127,224,0.7);
  color: #8DBFFF;
}

.af-title-badge-pro {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.9);
}

.af-title-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.af-topbar {
  background: #fff;
  border-bottom: 1px solid var(--af-g200);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: clip;
  position: sticky;
  top: var(--site-header-height, 88px);
  z-index: 200;
  box-shadow: 0 2px 8px rgba(11,31,58,.06);
}

.af-search-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 240px;
}

.af-search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 10px 0 32px;
  border: 1.5px solid var(--af-g200);
  border-radius: var(--af-r);
  font-size: 13px;
  background: var(--af-g50);
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}

.af-search-wrap input:focus { border-color: var(--af-freelance); background: #fff; }
.af-search-wrap input::placeholder { color: var(--af-g400); }

.af-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--af-g400);
  font-size: 13px;
  pointer-events: none;
}

/* Chips filtre */
.af-filter-chips {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.af-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--af-g200);
  background: #fff;
  color: var(--af-g600);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}

.af-chip-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.af-chip-all.on,
.af-chip-all:hover {
  background: var(--af-navy);
  color: #fff;
  border-color: var(--af-navy);
}

.af-chip-freelance.on,
.af-chip-freelance:hover {
  background: var(--af-freelance-light);
  color: var(--af-freelance);
  border-color: var(--af-freelance);
}

.af-chip-pro.on,
.af-chip-pro:hover {
  background: var(--af-pro-light);
  color: var(--af-pro);
  border-color: var(--af-pro);
}

/* Sort */
.af-sort {
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--af-g200);
  border-radius: var(--af-r);
  font-size: 13px;
  background: var(--af-g50);
  color: var(--af-g900);
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
}

@media (max-width: 700px) {
  .af-topbar { flex-wrap: wrap; }
  .af-search-wrap { max-width: 100%; width: 100%; flex: 1 0 100%; }
  .af-sort { margin-left: auto; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.af-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: calc(100vh - 200px) auto auto;
  min-height: 500px;
}

.af-panel {
  grid-column: 1;
  grid-row: 1;
  overflow-y: auto;
  border-right: 1px solid var(--af-g200);
  border-top: 3px solid var(--af-freelance);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.af-map-wrap {
  grid-column: 2;
  grid-row: 1;
  position: relative;
}

#af-map {
  width: 100%;
  height: 100%;
  min-height: 340px;
}

.af-list {
  grid-column: 1 / -1;
  grid-row: 2;
  overflow: visible;
  background: var(--af-g50);
  border-top: 1px solid var(--af-g200);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-content: start;
}

/* Mobile : carte + liste empilées, panneau en haut */
@media (max-width: 991.98px) {
  .af-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 320px auto auto;
  }
  .af-panel        { grid-column: 1; grid-row: 1; border-right: none; border-bottom: 1px solid var(--af-g200); }
  .af-map-wrap     { grid-column: 1; grid-row: 2; }
  #af-map          { min-height: 300px; }
  .af-list-header  { grid-column: 1; grid-row: 3 !important; }
  .af-list         { grid-column: 1; grid-row: 4 !important; grid-template-columns: 1fr; padding: 10px; }
}

/* ============================================================
   PANNEAU GAUCHE
   ============================================================ */
.af-panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--af-g100);
  gap: 8px;
}

.af-panel-count {
  font-size: 15px;
  font-weight: 700;
  color: var(--af-g900);
  font-family: 'League Spartan', sans-serif;
}

.af-panel-count em {
  font-style: normal;
  color: var(--af-freelance);
  font-size: 18px;
}

.af-panel-sub {
  font-size: 11px;
  color: var(--af-g400);
  margin-top: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.af-btn-locate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--af-r);
  border: 1.5px solid var(--af-freelance);
  background: var(--af-freelance-light);
  color: var(--af-freelance);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  font-family: inherit;
  flex-shrink: 0;
}

.af-btn-locate:hover {
  background: var(--af-freelance);
  color: #fff;
  border-color: var(--af-freelance);
}

.af-locate-feedback {
  display: none;
  font-size: 12px;
  color: var(--af-g600);
  padding: 6px 14px;
  background: var(--af-g50);
}

/* Légende */
.af-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--af-g100);
}

.af-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--af-g600);
}

.af-legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.1);
}

/* ============================================================
   CARTE : boutons flottants
   ============================================================ */
.af-map-locate-btn {
  position: absolute;
  bottom: 120px;
  right: 12px;
  z-index: 410;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: var(--af-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--af-freelance);
  cursor: pointer;
  transition: box-shadow .15s;
}

.af-map-locate-btn:hover { box-shadow: var(--af-sl); }

.af-map-cta {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 410;
  background: #fff;
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: var(--af-sm);
  text-align: center;
  min-width: 240px;
  max-width: 340px;
}

.af-map-cta strong { font-size: 13px; color: var(--af-g900); display: block; margin-bottom: 3px; }
.af-map-cta p { font-size: 12px; color: var(--af-g400); margin: 0 0 10px; }

.af-map-cta-btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--af-freelance);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}

.af-map-cta-btn:hover { background: var(--af-freelance-mid); color: #fff; }

@media (max-width: 600px) {
  .af-map-cta { display: none; }
}

/* ============================================================
   LISTE — CARTES AFFILIÉS
   ============================================================ */
.af-list-header {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 16px 16px 0;
  background: var(--af-g50);
  border-top: 1px solid var(--af-g200);
  display: flex;
  align-items: center;
}

#af-list-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--af-g600);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.af-list {
  grid-row: 3 !important;
  border-top: none !important;
}

.af-empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: var(--af-g400);
  font-size: 14px;
}

/* La card est un <a> cliquable */
.af-card {
  background: #fff;
  border-radius: 16px;
  border: 1.5px solid var(--af-g200);
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s, transform .18s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  min-height: 200px;
}

.af-card:hover {
  box-shadow: var(--af-sm);
  transform: translateY(-3px);
  color: inherit;
  text-decoration: none;
}

.af-card.sel { outline: 2px solid var(--af-freelance); outline-offset: 2px; }
.af-card.sel.type-pro { outline-color: var(--af-pro); }

/* Bande colorée latérale gauche */
.af-card-stripe {
  height: 5px;
  flex-shrink: 0;
}
.af-card-stripe.type-freelance { background: var(--af-freelance); }
.af-card-stripe.type-pro       { background: var(--af-pro); }

/* Zone principale */
.af-card-main {
  padding: 16px 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Ligne du haut : avatar + nom + type */
.af-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.af-card-head-info { flex: 1; min-width: 0; }

/* Avatar */
.af-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  overflow: hidden;
  background: var(--af-freelance-light);
  color: var(--af-freelance);
  border: 2px solid rgba(3,74,170,.12);
}

.af-avatar-lg {
  width: 52px; height: 52px;
  font-size: 18px;
}

.af-avatar.type-pro {
  background: var(--af-pro-light);
  color: var(--af-pro);
  border-color: rgba(245,114,42,.15);
}

.af-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Nom */
.af-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--af-g900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

/* Badge type */
.af-card-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.af-card-type.type-freelance { background: var(--af-freelance-light); color: var(--af-freelance); }
.af-card-type.type-pro       { background: var(--af-pro-light);       color: var(--af-pro); }

.af-card-type-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.af-card-type.type-freelance .af-card-type-dot { background: var(--af-freelance); }
.af-card-type.type-pro       .af-card-type-dot { background: var(--af-pro); }

/* Méta ville + distance */
.af-card-meta {
  font-size: 12px;
  color: var(--af-g400);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.af-card-city { display: flex; align-items: center; gap: 3px; }
.af-card-dist { color: var(--af-freelance); font-weight: 600; display: flex; align-items: center; gap: 3px; }

/* Note */
.af-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.af-rating-num { color: var(--af-g600); font-weight: 600; }

.af-card-new {
  font-size: 11px;
  color: var(--af-g400);
  font-style: italic;
}

/* Bio */
.af-card-bio {
  font-size: 12px;
  color: var(--af-g600);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer bouton */
.af-card-footer {
  padding: 0 16px 14px;
}

.af-btn-profil {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--af-freelance);
  color: #fff;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: background .15s;
  cursor: pointer;
}

.af-btn-profil:hover { filter: brightness(1.1); }
.af-btn-profil.type-pro { background: var(--af-pro); }

/* ============================================================
   MODAL
   ============================================================ */
.af-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11,31,58,.45);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.af-overlay.open { display: flex; }

.af-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--af-sl);
  position: relative;
}

.af-modal-hd {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--af-g100);
}

.af-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--af-g100);
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--af-g600);
  transition: background .15s;
}

.af-modal-close:hover { background: var(--af-g200); }

.af-modal-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-right: 36px;
}

.af-modal-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.af-modal-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.af-modal-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--af-g900);
  margin-bottom: 4px;
}

.af-modal-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.af-modal-stats {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}

.af-modal-stat-val { font-size: 18px; font-weight: 700; color: var(--af-g900); }
.af-modal-stat-lbl { font-size: 11px; color: var(--af-g400); }

.af-modal-body { padding: 16px 20px; }

.af-modal-section { margin-bottom: 16px; }

.af-modal-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--af-g400);
  margin-bottom: 8px;
}

.af-modal-desc {
  font-size: 14px;
  color: var(--af-g600);
  line-height: 1.6;
  margin: 0;
}

.af-modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.af-modal-info-lbl { font-size: 11px; color: var(--af-g400); margin-bottom: 2px; }
.af-modal-info-val { font-size: 13px; color: var(--af-g900); font-weight: 500; }

.af-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--af-g100);
  display: flex;
  gap: 10px;
}

.af-modal-btn-primary {
  flex: 1;
  padding: 12px;
  background: var(--af-freelance);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.af-modal-btn-primary.type-pro { background: var(--af-pro); }
.af-modal-btn-primary:hover { filter: brightness(1.1); color: #fff; }

.af-modal-btn-secondary {
  padding: 12px 18px;
  background: var(--af-g100);
  color: var(--af-g600);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}

.af-modal-btn-secondary:hover { background: var(--af-g200); }

/* ============================================================
   POPUP LEAFLET
   ============================================================ */
.af-popup { font-family: inherit; }
.af-popup-name { font-size: 14px; font-weight: 700; color: var(--af-g900); margin-bottom: 3px; }
.af-popup-sub { font-size: 12px; color: var(--af-g400); margin-bottom: 8px; }
.af-popup-rating { font-size: 12px; color: var(--af-amber); margin-bottom: 8px; }

.af-popup-btn {
  display: block;
  width: 100%;
  padding: 9px;
  background: var(--af-freelance);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  text-decoration: none;
  transition: filter .15s;
}

.af-popup-btn:hover { filter: brightness(1.1); color: #fff; }
.af-popup-btn.type-pro { background: var(--af-pro); }
