/* Reset & base */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Map container */
#map-container {
    position: relative;
    width: 100vw;
    min-width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: 100vw;
    height: 100vh;
    padding: 0;
    box-sizing: border-box;
}
#map {
    width: 100%;
    height: 100%;
}

/* Map title */
.map-title {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.map-title h1 {
    font-size: 24px;
    font-weight: bold;
    color: #2c5aa0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Admin panel */
.admin-panel {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: 250px;
}
.toggle-admin-btn {
    width: 100%;
    padding: 15px;
    background: #2c5aa0;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}
.toggle-admin-btn:hover {
    background: #1e3f73;
}
.admin-content {
    padding: 20px;
    border-top: 1px solid #eee;
}
.admin-content h3 {
    color: #2c5aa0;
    margin-bottom: 15px;
}
.admin-btn {
    width: 100%;
    padding: 10px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 15px;
    font-size: 14px;
}
.admin-btn:hover {
    background: #218838;
}
.agencies-list {
    max-height: 300px;
    overflow-y: auto;
}
.agency-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    background: #fff;
}
.agency-item-info {
    flex: 1;
}
.agency-item-name {
    font-weight: bold;
    color: #2c5aa0;
    font-size: 14px;
}
.agency-item-location {
    font-size: 12px;
    color: #666;
}
.agency-item-actions {
    display: flex;
    gap: 5px;
}
.edit-btn, .delete-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}
.edit-btn {
    background: #ffc107;
    color: #000;
}
.edit-btn:hover {
    background: #e0a800;
}
.delete-btn {
    background: #dc3545;
    color: #fff;
}
.delete-btn:hover {
    background: #c82333;
}

/* Formulaire */
.agency-form {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.form-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.form-content h3 {
    color: #2c5aa0;
    margin-bottom: 20px;
    text-align: center;
}
.form-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}
.form-content input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}
.form-content input:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 5px rgba(44,90,160,0.3);
}
.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.save-btn, .cancel-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}
.save-btn {
    background: #28a745;
    color: #fff;
}
.save-btn:hover {
    background: #218838;
}
.cancel-btn {
    background: #6c757d;
    color: #fff;
}
.cancel-btn:hover {
    background: #5a6268;
}

/* Utilitaires */
.hidden {
    display: none !important;
}

/* Styles des popups personnalisés */
.leaflet-popup-content-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 0;
    width: 350px;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: 350px !important;
}

.leaflet-popup-tip {
    background: white;
}

.leaflet-popup-close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #666;
    text-decoration: none;
    z-index: 1000;
}

.leaflet-popup-close-button:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #333;
}

.leaflet-top.leaflet-left {
    top: 70px;  /* adapte la valeur à la hauteur de ton header (ex : 60–80px) */
}

/* Popup rectangle bien arrondie */
.leaflet-popup-content-wrapper,
.leaflet-popup-content {
    border-radius: 22px !important;
    box-shadow: 0 8px 32px rgba(44,90,160,0.10);
    padding: 0 !important;
    width: 100% !important;
    max-width: 98vw !important;
    border: none;
}

/* Popup principale */
.agency-popup {
    width: 400px;
    max-width: 98vw;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    border: none;
    box-shadow: 0 8px 32px rgba(44,90,160,0.10);
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* Image */
.agency-popup-image {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: cover;
    display: block;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    margin-bottom: -39px;
    position: relative;
    z-index: 2;
}

/* Vague */
.agency-popup-wave {
    width: 100%;
    height: 39px;
    line-height: 0;
    overflow: hidden;
    background: transparent;
    position: relative;
    z-index: 3;
    margin-bottom: -6px;
}
.agency-popup-wave svg {
    display: block;
    width: 100% !important;
    height: 39px !important;
    min-width: 100% !important;
    max-width: 100% !important;
    min-height: 39px;
    max-height: 39px;
    position: relative;
    z-index: 3;
    pointer-events: none;
    margin: 0 auto;
}

/* Contenu */
.agency-popup-content {
    padding: 32px 32px 28px 32px;
    border-radius: 0 0 22px 22px;
    background: #fff;
    position: relative;
    z-index: 2;
}

/* Titre */
.agency-popup-title {
    font-size: 2rem;
    font-weight: bold;
    color: #2c5aa0;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Segoe UI', Arial, sans-serif;
	line-height: 1.2 !important;
}

/* Localisation */
.agency-popup-location {
    display: flex;
    align-items: center;
    color: #666;
    margin-bottom: 18px;
    font-size: 1.08rem;
    font-weight: 400;
    gap: 8px;
}

.agency-popup-location .location-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 4px;
}

.agency-popup-location .location-pin svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Stats */
.agency-popup-stats {
    margin-bottom: 18px;
}
.agency-popup-stat {
    margin-bottom: 6px;
    font-size: 1.08rem;
    color: #222;
    font-weight: 400;
}
.agency-popup-stat strong {
    font-weight: 700;
    color: #2c5aa0;
    margin-right: 4px;
}

/* Email */
.agency-popup-email {
    color: #888;
    font-size: 1.05rem;
    margin-bottom: 22px;
    word-break: break-all;
    font-weight: 400;
}

/* Boutons */
.agency-popup-buttons {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-top: 10px;
    width: 100%;
}

.agency-popup-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 32px;
    padding: 0 28px;
    height: 54px;
    min-width: 180px;
    border: 2px solid #0b3954;
    background: #fff;
    color: #0b3954;
    box-shadow: none;
    outline: none;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border 0.18s;
    text-decoration: none;
    margin: 0;
    position: relative;
}

.agency-popup-button.primary {
    border: none;
    background: none;
    color: #0b3954;
    font-weight: 700;
    font-size: 1.18rem;
    line-height: 1.2;
    padding: 0;
    height: auto;
    min-width: 0;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.agency-popup-button.primary .arrow {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    width: 28px;
    height: 24px;
    vertical-align: middle;
    position: relative;
    top: 1px;
}

.agency-popup-button.primary .arrow svg {
    display: block;
    width: 28px;
    height: 24px;
}

.agency-popup-button.primary:hover .arrow svg path {
    stroke: #184b7a;
}

.agency-popup-button.secondary {
    background: #fff;
    color: #0b3954;
    border: 2px solid #0b3954;
    font-weight: 600;
    font-size: 1.18rem;
    width: 220px;
    justify-content: center;
    margin-top: 0;
}
.agency-popup-button.secondary:hover {
    background: #0b3954;
    color: #fff;
    border-color: #0b3954;
}

/* Marqueurs personnalisés */
.custom-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Animation bounce pour le marqueur actif */
@keyframes marker-bounce {
  0%   { transform: translateY(0); }
  10%  { transform: translateY(-18px); }
  20%  { transform: translateY(0); }
  30%  { transform: translateY(-12px); }
  40%  { transform: translateY(0); }
  50%  { transform: translateY(-8px); }
  60%  { transform: translateY(0); }
  100% { transform: translateY(0); }
}
.bouncing-marker {
  animation: marker-bounce 1.6s infinite;
  will-change: transform;
}
.leaflet-marker-icon.bouncing-marker {
  z-index: 5000;
}

/* Responsive */
@media (max-width: 768px) {
    .map-title {
        top: 15px;
        left: 15px;
        padding: 10px 15px;
    }
    .map-title h1 {
        font-size: 18px;
    }
    .admin-panel {
        top: 15px;
        right: 15px;
        min-width: 200px;
    }
    .form-content {
        width: 95%;
        padding: 20px;
    }
    .agency-popup {
        width: 300px;
    }
    .leaflet-popup-content-wrapper,
    .leaflet-popup-content {
        width: 300px !important;
    }
    
    .agency-popup-button.secondary{
        width: 100%;
    }

    .agency-popup-content{
        padding:16px;
    }
}

@media (max-width: 500px) {
    .agency-popup-content {
        padding: 16px;
    }
}

#fixed-agency-popup {
    position: absolute;
    top: 64px;
    left: 24px;
    z-index: 3000;
    max-width: 400px;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 8px 32px rgba(44,90,160,0.10);
    padding: 0;
}

.agency-social-icons {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 6px 0 12px;
}
.agency-social-icons .social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 999px;
  transition: transform .12s ease, opacity .12s ease;
}
.agency-social-icons .social-icon img {
  width: 24px; height: 24px; display: block;
}
.agency-social-icons .social-icon:hover {
  transform: scale(1.06);
  opacity: .9;
}
