/*
 * Annuaire Thérapeutes Leaflet - Stylesheet
 * Version: 5.0 (Interface dynamique)
 */

:root {
  --atl-primary-color: #305699;
  --atl-primary-dark: #1e3a66;
  --atl-accent-color: #22c55e;
  --atl-light-gray: #f0f2f5;
  --atl-medium-gray: #e1e5e9;
  --atl-dark-gray: #64748b;
  --atl-bg-color: #f9f9fb;
  --atl-surface-color: #ffffff;
  --atl-radius-md: 8px;
  --atl-radius-lg: 12px;
  --atl-shadow-sm: 0 2px 10px rgba(0,0,0,0.05);
  --atl-shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

/* --- Conteneur principal --- */
.atl-container { 
  max-width: 1200px; margin: 40px auto; padding: 20px;
  background: var(--atl-bg-color); border-radius: 18px;
  box-shadow: 0 4px 20px rgba(187, 178, 170, 0.15);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Grille de Filtres --- */
.atl-filtres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px;
    background: var(--atl-surface-color);
    border-radius: var(--atl-radius-lg);
    box-shadow: var(--atl-shadow-sm);
    margin-bottom: 20px;
}

.atl-filtre-group {
    display: flex;
}

.atl-filtre-item {
    font-size: 14px;
    padding: 10px 14px;
    border-radius: var(--atl-radius-md);
    border: 2px solid var(--atl-medium-gray);
    background: var(--atl-surface-color);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}
.atl-filtre-item:focus {
    outline: none;
    border-color: var(--atl-primary-color);
    box-shadow: 0 0 0 3px rgba(48, 86, 153, 0.1);
}

/* Spécificités des boutons dans les groupes */
#atl-recherche-adresse {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
#atl-adresse-btn {
    border-radius: 0 var(--atl-radius-md) var(--atl-radius-md) 0;
    border: 2px solid var(--atl-medium-gray);
    padding: 0 16px;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
    color: var(--atl-primary-color);
}
#atl-adresse-btn:hover {
    background: #e9ecef;
}

.atl-filtre-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    color: var(--atl-primary-color);
}
.atl-ico-geoloc { width: 20px; height: 20px; fill: currentColor; }
#atl-geoloc-btn.loading .atl-ico-geoloc { animation: spin 1.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#atl-reset { 
  background: var(--atl-primary-color);
  color: white;
  cursor: pointer;
  font-weight: 600;
}
#atl-reset:hover { background: var(--atl-primary-dark); }

/* --- En-tête de la liste --- */
.atl-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--atl-light-gray);
  color: var(--atl-dark-gray);
  font-size: 0.9em;
  flex-shrink: 0; /* Empêche le header de rétrécir */
}
#atl-results-count { font-weight: 600; }
.atl-tri-wrapper label { margin-right: 8px; }
#atl-tri {
  border: 1px solid var(--atl-medium-gray); border-radius: 6px;
  padding: 4px 8px; font-size: 0.95em; background-color: var(--atl-surface-color);
}

/* --- Layout et Liste --- */
.atl-layout { display: flex; gap: 24px; min-height: 600px; }
#atl-listing-wrapper {
  flex: 0 0 380px; max-width: 380px; min-width: 280px;
  background: var(--atl-surface-color); border-radius: var(--atl-radius-lg);
  overflow: hidden; box-shadow: var(--atl-shadow-md);
  max-height: var(--atl-dynamic-height, 70vh);
  display: flex; flex-direction: column;
}
#atl-listing {
  flex-grow: 1; /* Fait en sorte que la liste prenne l'espace restant */
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ddd transparent;
}
.atl-item { 
  border-bottom: 1px solid var(--atl-light-gray);
  padding: 16px; display: flex; gap: 16px; align-items: flex-start;
  transition: all 0.2s ease; cursor: pointer;
}
.atl-item:last-child { border-bottom: none; }
.atl-item:hover { background: #f8f9fa; }
.atl-item.atl-selected { 
  background: linear-gradient(135deg, #e8fff2, #f0fff4) !important;
  border-left: 4px solid var(--atl-accent-color); padding-left: 12px;
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.15);
}
.atl-item-left { flex: 0 0 80px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.atl-item-right { flex: 1; min-width: 0; }
.atl-photo { width: 80px; height: 80px; object-fit: cover; border-radius: 50%; background: #e4e9f4; flex-shrink: 0; border: 3px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.atl-photo-placeholder { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #e4e9f4, #d1d9e6); display: flex; align-items: center; justify-content: center; font-size: 32px; color: #8896a8; }
.atl-nom { font-weight: 700; color: var(--atl-primary-color); font-size: 1.1em; margin-bottom: 4px; }
.atl-adresse { color: var(--atl-dark-gray); font-size: 0.9em; margin-bottom: 10px; }
.atl-meta { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.atl-tag { display: inline-block; padding: 4px 8px; border-radius: 12px; font-size: 0.8em; font-weight: 500; }

/* Tags de taxonomies par défaut */
.atl-tag-statut { background: #e0f2fe; color: #0277bd; }
.atl-tag-statut-stf { background: #e0f2fe; color: #0277bd; }
.atl-tag-cadre { background: #f3e5f5; color: #7b1fa2; }
.atl-tag-cadre-intervention { background: #f3e5f5; color: #7b1fa2; }

/* Couleurs supplémentaires pour d'autres taxonomies */
.atl-tag-specialite { background: #fce4ec; color: #c2185b; }
.atl-tag-formation { background: #e8f5e9; color: #388e3c; }
.atl-tag-langue { background: #fff3e0; color: #f57c00; }
.atl-tag-public { background: #e3f2fd; color: #1976d2; }
.atl-tag-modalite { background: #f3e5f5; color: #7b1fa2; }
.atl-tag-tarif { background: #e0f2f1; color: #00796b; }

/* Fallback pour toute taxonomie non définie */
.atl-tag[class*="atl-tag-"]:not(.atl-tag-statut):not(.atl-tag-cadre):not(.atl-tag-statut-stf):not(.atl-tag-cadre-intervention):not(.atl-tag-specialite):not(.atl-tag-formation):not(.atl-tag-langue):not(.atl-tag-public):not(.atl-tag-modalite):not(.atl-tag-tarif) {
    background: #f5f5f5;
    color: #616161;
}

.atl-contact { margin-bottom: 0; }
.atl-contact-line { margin-bottom: 4px; font-size: 0.9em; }
.atl-contact-line a { color: var(--atl-primary-color); text-decoration: none; }
.atl-contact-line a:hover { text-decoration: underline; }
.atl-ico { font-size: 1em; margin-right: 6px; opacity: 0.7; }
.atl-fiche-btn { width: 100%; text-align: center; box-sizing: border-box; background: var(--atl-primary-color); color: white; border-radius: var(--atl-radius-md); border: none; padding: 8px 0; font-weight: 600; text-decoration: none; display: inline-block; transition: all 0.2s ease; font-size: 0.85em; }
.atl-fiche-btn:hover { background: var(--atl-primary-dark); transform: translateY(-1px); color: white; }

/* --- Carte, Popups & Marqueurs --- */
#atl-carte { 
  flex: 1; min-width: 320px; min-height: 540px;
  height: var(--atl-dynamic-height, 70vh); border-radius: var(--atl-radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1); overflow: hidden;
}
.atl-custom-popup .leaflet-popup-content { margin: 12px; }
.atl-popup-btn { background: var(--atl-primary-color); color: white !important; padding: 8px 12px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 0.85em; display: inline-block; transition: all 0.2s ease; }
.atl-popup-btn:hover { background: var(--atl-primary-dark); transform: translateY(-1px); }
.atl-popup-btn-itineraire { background: #4285F4 !important; }
.atl-popup-btn-itineraire:hover { background: #3367D6 !important; }
.atl-popup-btn-website { background: #607D8B !important; }
.atl-popup-btn-website:hover { background: #455A64 !important; }

.atl-svg-marker { transition: transform 0.2s ease-in-out; filter: drop-shadow(1px 2px 2px rgba(0,0,0,0.3)); }
.atl-svg-marker.selected { transform: scale(1.2); filter: drop-shadow(2px 4px 4px rgba(0,0,0,0.4)); }
.atl-svg-marker .marker-pin { transition: fill 0.2s ease; }
.atl-svg-marker.selected .marker-pin { stroke: var(--atl-accent-color); stroke-width: 2px; }

/* --- Skeleton Loader & Responsive --- */
#atl-skeleton-loader { display: flex; gap: 24px; }
.atl-skeleton-list { flex: 0 0 380px; max-width: 380px; min-width: 280px; }
.atl-skeleton-item { height: 120px; background-color: var(--atl-surface-color); padding: 20px; border-radius: var(--atl-radius-lg); margin-bottom: 16px; position: relative; overflow: hidden; }
.atl-skeleton-item::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); animation: shimmer-skelet 1.5s infinite; }
@keyframes shimmer-skelet { 100% { transform: translateX(100%); } }
.atl-skeleton-map { flex: 1; border-radius: var(--atl-radius-lg); background-color: var(--atl-medium-gray); position: relative; overflow: hidden; }
.atl-skeleton-map::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent); animation: shimmer-skelet 1.5s infinite; }
.atl-no-results, .atl-error-msg { padding: 40px 20px; text-align: center; color: var(--atl-dark-gray); font-style: italic; background: #f8f9fa; margin: 20px; border-radius: var(--atl-radius-md); }

@media (max-width: 950px) {
  .atl-layout, #atl-skeleton-loader { flex-direction: column; }
  #atl-listing-wrapper, .atl-skeleton-list { max-width: 100%; max-height: 50vh; }
  #atl-carte, .atl-skeleton-map { min-height: 340px; height: 50vh; }
  .atl-filtres-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}