/* ============================================================
   annuaire.css
   Design partagé : cartouche, cartes de résultats, fiche agence,
   popup contact, footer.
   ============================================================ */

html, body { overflow-x: hidden; max-width: 100%; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  color: #0f1f3d;
  background: #eef1f6;
  padding: 1.5rem;
}

.page-wrapper { max-width: 1000px; margin: 0 auto; width: 100%; }

/* ---- En-tête ---- */
.header { margin-bottom: 1.5rem; }

.header-cartouche {
  display: flex; align-items: center; gap: 1rem;
  background: #fff;
  border: 1px solid #d0d8e8;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  width: 100%;
}
.header-cartouche img { height: 60px; width: auto; display: block; flex-shrink: 0; }
.header h1 { font-size: 28px; font-weight: 700; color: #0f1f3d; }

.header-meta { display: flex; flex-direction: column; gap: 3px; padding-left: 2px; }
.header-meta p { font-size: 15px; color: #4a5a72; display: flex; align-items: center; gap: 6px; }
.header-meta p::before { content: '›'; color: #1a3a6b; font-weight: 700; font-size: 17px; }
.header-meta a { color: #1a3a6b; text-decoration: none; font-weight: 600; }
.header-meta a:hover { text-decoration: underline; }
.header-meta strong { color: #0f1f3d; }

.fil-ariane { font-size: 14px; color: #6b7a8d; margin-bottom: 0.6rem; padding-left: 2px; }
.fil-ariane a { color: #1a3a6b; text-decoration: none; font-weight: 500; }
.fil-ariane a:hover { text-decoration: underline; }

/* ---- Grille de résultats ---- */
.grille {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  row-gap: 24px;
}

/* ---- Carte (vue liste) ---- */
.carte {
  background: #fff;
  border: 1px solid #999999;
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; gap: 11px;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
}
.carte:hover { border-color: #1a3a6b; box-shadow: 0 2px 12px rgba(26,58,107,.08); }

.entete { display: flex; align-items: flex-start; gap: 12px; }

.logo-wrap {
  width: 54px; height: 54px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden;
  background: #eef1f6;
  display: flex; align-items: center; justify-content: center;
}
.logo-wrap.bordure { border: 1.5px solid #d0d8e8; }
.logo-wrap img { width: 100%; height: 100%; object-fit: contain; }

.nom-agence {
  font-size: 18px; font-weight: 700; color: #0f1f3d;
  text-decoration: none; word-break: break-word;
}
.nom-agence:hover { color: #1a3a6b; text-decoration: underline; }
.localisation { font-size: 13px; color: #6b7a8d; margin-top: 3px; }
.ndd-link { color: #1a3a6b; text-decoration: none; font-weight: 500; }
.ndd-link:hover { text-decoration: underline; }

.resume-wrap { font-size: 15px; color: #3a4a5c; line-height: 1.65;
  border-left: 3px solid #1a3a6b; padding-left: 10px; }
.resume-txt {
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.resume-txt.open { display: block; }
.lire-suite {
  font-size: 13px; color: #1a3a6b; cursor: pointer;
  background: none; border: none; padding: 0;
  font-family: inherit; margin-top: 4px;
  display: block; text-align: right; width: 100%; font-weight: 600;
}
.lire-suite:hover { text-decoration: underline; }

.responsable { font-size: 14px; color: #4a5a72; }
.resp-link { color: #1a3a6b; text-decoration: none; font-weight: 600; }
.resp-link:hover { text-decoration: underline; }

.contacts { display: flex; flex-direction: row; gap: 8px; justify-content: center; }
.contact-row { display: flex; align-items: center; flex: 1; max-width: 50%; }

.btn-reveal {
  font-size: 13px; padding: 7px 0; border-radius: 8px;
  font-weight: 600; cursor: pointer; border: none;
  font-family: inherit; transition: background .15s, box-shadow .15s;
  white-space: nowrap; width: 100%; text-align: center;
}
.btn-reveal-phone { background: #1e8449; color: #fff; }
.btn-reveal-phone:hover { background: #196f3d; box-shadow: 0 2px 8px rgba(30,132,73,.3); }
.btn-reveal-mail { background: #1a5fb4; color: #fff; }
.btn-reveal-mail:hover { background: #154d96; box-shadow: 0 2px 8px rgba(26,95,180,.3); }
.btn-reveal:disabled { opacity: .5; cursor: default; }

.divider { border: none; border-top: 1px solid #e2e6ec; }

.socials { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.soc { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.soc img { width: 24px; height: 24px; object-fit: contain; display: block; border-radius: 4px; }
.soc.soc-lg img { width: 30px; height: 30px; }

/* ============================================================
   Fiche agence (vue détaillée, une seule agence)
   ============================================================ */

.fiche-hero {
  background: #fff;
  border: 1px solid #d0d8e8;
  border-radius: 14px;
  padding: 1.6rem;
  margin-bottom: 1.4rem;
}
.fiche-hero-top {
  display: flex; align-items: flex-start; gap: 18px;
  flex-wrap: wrap;
}
.fiche-logo {
  width: 88px; height: 88px; flex-shrink: 0;
  border-radius: 12px; overflow: hidden;
  background: #eef1f6;
  display: flex; align-items: center; justify-content: center;
}
.fiche-logo.bordure { border: 2px solid #d0d8e8; }
.fiche-logo img { width: 100%; height: 100%; object-fit: contain; }

.fiche-titre-bloc { flex: 1; min-width: 220px; }
.fiche-nom { font-size: 26px; font-weight: 700; color: #0f1f3d; line-height: 1.25; }
.fiche-loc { font-size: 15px; color: #6b7a8d; margin-top: 4px; }
.fiche-ndd { margin-top: 6px; }
.fiche-ndd a {
  color: #1a3a6b; text-decoration: none; font-weight: 600; font-size: 15px;
}
.fiche-ndd a:hover { text-decoration: underline; }

.fiche-socials { margin-top: 10px; }

.fiche-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 1.3rem;
  margin-bottom: 12px;
}
.fiche-actions > * {
  flex: 1 1 0;
  min-width: 0;
  max-width: 200px;
}
.fiche-actions .btn-reveal {
  width: 100%; padding: 11px 22px; font-size: 14px;
}
.fiche-btn-visiter {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px; border-radius: 8px; font-size: 14px; font-weight: 600;
  background: #fff; color: #1a3a6b; border: 1.5px solid #1a3a6b;
  text-decoration: none; transition: background .15s;
}
.fiche-btn-visiter:hover { background: #eef1f6; }

/* ---- Corps de la fiche : contenu principal + colonne latérale ---- */
.fiche-corps {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}

.fiche-bloc {
  background: #fff;
  border: 1px solid #d0d8e8;
  border-radius: 12px;
  padding: 1.3rem 1.4rem;
  margin-bottom: 16px;
}
.fiche-bloc-titre {
  font-size: 15px; font-weight: 700; color: #0f1f3d;
  text-transform: uppercase; letter-spacing: .03em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e6ec;
}
.fiche-resume {
  font-size: 15.5px; color: #3a4a5c; line-height: 1.75;
  white-space: pre-line;
}

.fiche-responsable { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #4a5a72; }
.fiche-responsable a { color: #1a3a6b; text-decoration: none; font-weight: 600; }
.fiche-responsable a:hover { text-decoration: underline; }

.info-liste { display: flex; flex-direction: column; gap: 10px; }
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 12px; color: #8b96a8; text-transform: uppercase; letter-spacing: .03em; }
.info-value { font-size: 14.5px; color: #0f1f3d; font-weight: 600; }
.info-value a { color: #1a3a6b; text-decoration: none; }
.info-value a:hover { text-decoration: underline; }

.fiche-cta-note {
  font-size: 13px; color: #6b7a8d; margin-top: 10px; line-height: 1.5;
}

/* ---- Photos responsable / équipe / bureau ---- */
.fiche-photos-equipe{
    display: flex;
    gap: 12px;
    max-width: 100%;
    margin-top: 12px;
}
.fiche-photo-item{
    margin: 0;
    flex: 1 1 0;
    max-width: 50%;
    min-width: 0;
    text-align: center;
}
.fiche-photo-item figcaption{
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.fiche-photo-item img{
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #f9fafb;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

/* ---- Tags (expertises, secteurs d'activité, CMS) ---- */
.fiche-tags{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.fiche-tag{
    background: #f3f6fa;
    border: 1px solid #d7e0ea;
    color: #0a2f5c;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
}

/* ---- Sous-groupes dans "Savoir-faire de l'agence" ---- */
.fiche-savoir-faire-groupe{
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eef1f4;
}
.fiche-savoir-faire-groupe:first-child{
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.fiche-savoir-faire-soustitre{
    font-size: 15px;
    font-weight: 700;
    color: #374151;
    /*text-transform: uppercase;*/
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

/* ---- Questions "Démarquez-vous" ---- */
.fiche-question{
    padding: 12px 0;
    border-bottom: 1px solid #eef1f4;
}
.fiche-question:last-child{
    border-bottom: none;
    padding-bottom: 0;
}
.fiche-question:first-child{
    padding-top: 0;
}
.fiche-question-titre{
    font-weight: 700;
    font-size: 16px;
    color: #0a2f5c;
    margin-bottom: 6px;
}
.fiche-question-reponse{
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}

/* ---- Message "pas encore renseigné" ---- */
.fiche-vide{
    font-size: 14px;
    color: #9ca3af;
    font-style: italic;
    margin: 8px 0 0 0;
}

/* ---- Bloc "Modifier cette fiche" ---- */
.fiche-bloc-modifier{
    text-align: left;
}
.fiche-modifier-texte{
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
    margin: 0 0 16px 0;
}
.fiche-btn-modifier-wrap{
    display: flex;
    justify-content: center;
}
.fiche-bloc-modifier button.fiche-btn-modifier{
    display: inline-block;
    width: auto;
    min-width: 200px;
    background: #0a2f5c !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 28px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(10, 47, 92, 0.25);
    transition: background 0.15s ease, transform 0.1s ease;
}
.fiche-bloc-modifier button.fiche-btn-modifier:hover{
    background: #082548 !important;
    transform: translateY(-1px);
}
.fiche-bloc-modifier button.fiche-btn-modifier:active{
    transform: translateY(0);
}

/* ---- Départements (bas de page liste) ---- */
.dept-section-title { font-size: 20px; font-weight: 700; color: #0f1f3d; margin-bottom: 1rem; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.dept-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: #fff; border: 1px solid #d0d8e8; border-radius: 8px;
  text-decoration: none; color: #0f1f3d;
  transition: border-color .15s, box-shadow .15s;
}
.dept-link:hover { border-color: #1a3a6b; box-shadow: 0 2px 8px rgba(26,58,107,.08); }
.dept-badge {
  font-size: 16px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #e8edf5; color: #1a3a6b; flex-shrink: 0; min-width: 28px; text-align: center;
}
.dept-name { font-size: 15px; font-weight: 500; }

/* ---- Popup contact (partagée) ---- */
.popup-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,31,61,.45);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.popup-overlay.open { display: flex; }

.popup-box {
  background: #fff;
  border-radius: 14px;
  padding: 1.8rem 2rem;
  max-width: 420px; width: 90%;
  box-shadow: 0 8px 40px rgba(15,31,61,.18);
  position: relative;
  display: flex; flex-direction: column; gap: 1rem;
}
.popup-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #e74c3c; border: 2px solid #fff;
  color: #fff; font-size: 20px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.popup-close:hover { background: #c0392b; }
.popup-header { display: flex; align-items: center; gap: 12px; padding-right: 30px; }
.popup-logo {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden;
  background: #eef1f6;
  display: flex; align-items: center; justify-content: center;
}
.popup-logo.bordure { border: 1.5px solid #d0d8e8; }
.popup-logo img { width: 100%; height: 100%; object-fit: contain; }
.popup-agence-nom { font-size: 16px; font-weight: 700; color: #0f1f3d; }
.popup-label { font-size: 13px; color: #6b7a8d; margin-bottom: 6px; }
.popup-value-row { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.popup-value {
  font-size: 26px; font-weight: 700; color: #fff;
  font-family: monospace; letter-spacing: .03em; text-align: center;
}
.popup-value.mail { font-size: 18px; word-break: break-all; text-align: center; }
.popup-value a { color: #fff; text-decoration: none; display: block; }
.popup-value-inner {
  border: none; border-radius: 8px;
  padding: 10px 32px; background: #1e8449;
  display: inline-block; text-align: center; cursor: pointer;
  box-shadow: 0 5px 0px #145c30, 0 6px 12px rgba(0,0,0,.25);
  transition: background .15s, box-shadow .1s, transform .1s;
}
.popup-value-inner:hover {
  background: #196f3d;
  box-shadow: 0 5px 0px #145c30, 0 6px 14px rgba(0,0,0,.3);
  transform: translateY(-1px);
}
.popup-value-inner:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0px #145c30, 0 3px 6px rgba(0,0,0,.2);
}
.popup-copy {
  font-size: 13px; padding: 5px 24px; border-radius: 6px;
  background: #e8edf5; color: #0f1f3d; border: 1px solid #a0b0cc;
  cursor: pointer; font-weight: 600; font-family: inherit;
  white-space: nowrap; width: 80px;
  display: flex; align-items: center; justify-content: center;
}
.popup-copy:hover { background: #d0d8e8; }
.popup-copy.copied { background: #d4edda; color: #1a6b35; border-color: #7ec89a; }
.popup-message {
  font-size: 15px; color: #1a3a6b; line-height: 1.6;
  background: #e8edf5; border-radius: 8px; padding: 12px 14px;
  border-left: 3px solid #1a3a6b; font-weight: normal;
}
.popup-message em { font-style: normal; font-weight: bold; color: #0f1f3d; }
.popup-message .merci { display: block; margin-top: 6px; font-weight: normal; color: #1a3a6b; }
.popup-error { font-size: 14px; color: #c0392b; }

/* ---- Responsive ---- */
@media (max-width: 900px) and (min-width: 701px) {
  .grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fiche-corps { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body { padding: 0.6rem; font-size: 15px; }
  .page-wrapper { max-width: 100%; }
  .grille { grid-template-columns: 1fr; }
  .header h1 { font-size: 20px; font-weight: 700; }
  .header-cartouche img { height: 44px; }
  .carte { padding: 0.85rem 0.9rem; }
  .nom-agence { font-size: 16px; }
  .localisation { font-size: 12px; }
  .resume-wrap { font-size: 14px; }
  .responsable { font-size: 13px; }
  .logo-wrap { width: 44px; height: 44px; }

  .fiche-hero { padding: 1.1rem; }
  .fiche-logo { width: 64px; height: 64px; }
  .fiche-nom { font-size: 21px; }
  .fiche-actions { flex-direction: column; flex-wrap: wrap; }
  .fiche-actions > * { flex: 1 1 auto; width: 100%; max-width: none; }

  /* Réordonnancement des sections de la fiche agence en mobile */
  .fiche-corps {
    display: flex;
    flex-direction: column;
  }
  .fiche-main,
  .fiche-sidebar {
    display: contents;
  }
  .fiche-bloc-localisation  { order: 1; }
  .fiche-bloc-savoirfaire   { order: 2; }
  .fiche-bloc-presentation  { order: 3; }
  .fiche-bloc-responsable   { order: 4; }
  .fiche-bloc-questions     { order: 5; }
  .fiche-bloc-modifier      { order: 6; }
}