/* =============================================================
   Chantiers Cartographie — Styles carte & panneau fiche
   ============================================================= */

/* ── Wrapper ──────────────────────────────────────────────── */
.chantiers-map-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 0px;
    background: #e8e0d8;
}

/* ── Carte Leaflet ────────────────────────────────────────── */
#chantiers-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Légère désaturation des tuiles CartoDB pour un rendu plus neutre */
#chantiers-map .leaflet-tile-pane {
    filter: grayscale(100%) brightness(1.1);
}

/*ZOOM LEAFLET*/
#chantiers-map .leaflet-control-zoom.leaflet-bar {
    box-shadow:none;
    border:none;
	margin-top:150px;
}

#chantiers-map .leaflet-control-zoom a {
background: #ffffff;
color: #ad0f0a;
border: none;
box-shadow: 0 0 5px rgba(0,0,0,0.25);
text-decoration:none;
padding : 0px 6px 8px 5px;
margin-top:5px;
border-radius:999px;
line-height:1em;
}

#chantiers-map .leaflet-control-zoom a:hover {
background: #ad0f0a;
color:#ffffff;
}


/* ── Message zoom molette ─────────────────────────────────── */
.chantiers-scroll-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: rgba(0, 0, 0, 0.65);
	color: #ffffff;
	padding: 10px 16px;
	border-radius: 0px;
	font-size: 20px;
	text-transform:uppercase;
	line-height: 1.1;
	z-index: 1000;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.25s ease;
	box-shadow: 0 4px 20px rgba(0,0,0,0.1);
	white-space: nowrap;
}

.chantiers-scroll-hint.is-visible {
    opacity: 1;
}

.chantiers-scroll-hint kbd {
    display: inline-block;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    padding: 1px 7px;
    font-family: monospace;
    font-size: 0.9em;
	text-align:center;
}

/* ── Barre de filtres ─────────────────────────────────────── */
.chantiers-filterbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 6;
    display: flex;
    align-items: start;
    gap: 10px;
    padding: 10px 60px 20px 60px;
    background: rgba(255, 255, 255, 1);
    /*backdrop-filter: blur(4px);*/
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-wrap: wrap;
}

/* Groupe boutons catégories */
.filterbar-cats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
	border-right:1px solid #ccc;
}
.filterbar-cats .filter-btn:first-child {
	padding:8px 10px;
}
.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: #f0f0f0;
    color: #000;
    border: 0px solid #ddd;
    border-radius: 0px;
    font-size: 0.7rem;
    font-weight: 600;
	text-transform:uppercase;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    white-space: nowrap;
}

.filter-btn:hover {
    background: #e0e0e0;
	color:#c90d0f;
}

.filter-btn.is-active {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

.filter-btn-icon {
    width: auto;
    height: 20px!important;
    object-fit: contain;
    flex-shrink: 0;
}

.filter-btn.is-active .filter-btn-icon {
    filter: brightness(0) invert(1);
}

/* Champ de recherche texte */
.filterbar-search {
    display: flex;
    align-items: center;
    gap: 6px;
    
    border: 0px solid #ddd;
    border-radius: 0px;
    padding: 0px;
    min-width: 220px;
}

.filterbar-search svg {
	width:20px;
	height:20px;
}

.filterbar-search svg:first-child  {
    flex-shrink: 0;
    color: #c90d0f;
	 
}

.filterbar-search svg:last-child  {
    flex-shrink: 0;
    color: #ffffff;
}

.filterbar-search input {
    border: none;
    background:#f0f0f0;
    outline: none;
    font-size: 0.85rem;
	font-weight:600;
    color: #000;
    width: 100%;
    box-sizing: border-box;
	padding:6px 15px;
	margin:0;
	line-height:1em;
	height:auto;
}

.filterbar-search input::placeholder {
    color: #666;
}

.filterbar-clear-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: #c90d0f;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.18s;
}

.filterbar-clear-btn:hover {
    background: #000000;
}

/* ── Marqueur personnalisé (divIcon) ──────────────────────── */
.chantier-marker-wrap {
    position: relative;
    width: 46px;
    height: 69px;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.40));
}

.chantier-marker-img {
    display: block;
    width: 46px;
    height: 69px;
}

/* Icône de catégorie centrée dans la tête du pointeur */
.marker-cat-icon {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60%;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Variante par défaut (chantier sans catégorie) : pas de fond, icône plus grande et décalée */
.marker-cat-icon--default {
    top: 8px;
    width: 27px;
    height: 45px;
    background-color: transparent;
    background-size: contain;
    border-radius: 0;
    box-shadow: none;
}

.chantier-marker-wrap:hover,
.chantier-marker-wrap.is-active {
    transform: scale(1.2) translateY(-4px);
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.50));
    z-index: 1000 !important;
}

/* ── Info-bulle (tooltip Leaflet) ────────────────────────── */
.chantier-tooltip {
    background: rgba(255, 255, 255, 1) !important;
    border: none !important;
    border-radius: 3px !important;
    color: #111!important;
    font-size: 0.8rem;
    line-height: 1.1em;
    padding: 6px 10px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    pointer-events: none;
}

.chantier-tooltip::before {
    border-top-color: rgba(20, 20, 20, 0.88) !important;
}

.chantier-tooltip strong {
	text-transform:uppercase;
    /*display: block;*/
}

.chantier-tooltip .tooltip-loc {
    opacity: 1;
    font-size: 0.9rem;
}

/* ── Panneau fiche chantier ───────────────────────────────── */
.chantier-panel {
    position: absolute;
    top: 100px;   /* en dessous de la barre de filtres (~56px) + 14px */
    left: 20px;
    width: 360px;
    max-height: calc(100% - 120px);
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.28);
    z-index: 500;
    overflow-y: auto;
    scrollbar-width: thin;

    transform: translateX(420px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity   0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.chantier-panel.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Bouton fermer ────────────────────────────────────────── */
.chantier-panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 28px;
    height: 28px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
    font-family: Arial, sans-serif;
}

.chantier-panel-close:hover,
.chantier-panel-close:focus {
    background: #a93226;
    outline: none;
}

/* ── Photo ────────────────────────────────────────────────── */
.chantier-panel-photo {
    width: 100%;
    height: 190px;
    overflow: hidden;
    background: #ddd;
    border-radius: 3px 3px 0 0;
}

.chantier-panel-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chantier-panel-photo.is-hidden {
    display: none;
}

/* ── Corps du panneau ─────────────────────────────────────── */
.chantier-panel-body {
    padding: 16px 18px 20px;
}

/* ── Titre ─────────────────────────────────────────────────── */
.chantier-panel-title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.1;
    color: #1a1a1a;
    word-break: break-word;
}

/* ── Maîtrise d'ouvrage / d'œuvre (2 colonnes) ────────────── */
.chantier-panel-moa-moe {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.moa-moe-col {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.moa-moe-col.is-hidden {
    display: none;
}

.moa-moe-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5px;
    border: 1px solid #dddddd;
}

.moa-moe-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #888;
}

.moa-moe-logo {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.moa-moe-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.moa-moe-nom {
    margin: 0;
    font-size: 0.78rem;
    color: #555;
    line-height: 1.2;
}

/* ── Adresse postale ──────────────────────────────────────── */
.chantier-panel-adresse {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 0.82rem;
}

.chantier-panel-adresse.is-hidden {
    display: none;
}

.adresse-label {
	display:none;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #222;
    text-transform: uppercase;
    flex-shrink: 0;
}

#chantier-adresse {
    color: #111;
    font-style: normal;
    font-weight:bold;
    line-height: 1.1;
	margin:0;
}

/* ── Badges catégories ────────────────────────────────────── */
.chantier-panel-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.chantier-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 6px;
    background: #c0392b;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 3px;
}

.badge-icone {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

/* ── Bouton « + d'info » ──────────────────────────────────── */
.chantier-panel-plus-info {
    margin-bottom: 14px;
}

.chantier-panel-plus-info.is-hidden {
    display: none;
}

.chantier-plus-info-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #fff;
    color: #111;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
	border:1px solid #111;
    border-radius: 50%;
    transition: background 0.2s;
}

.chantier-plus-info-btn:hover,
.chantier-plus-info-btn:focus {
    background: #111111;
    color: #fff;
	border:1px solid #111111;
}

/* ── Description ──────────────────────────────────────────── */
.chantier-panel-description .desc-label {
    margin: 0 0 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #222;
    text-transform: uppercase;
    display:none;
}

#chantier-desc {
    font-size: 0.875rem;
    line-height: 1.1;
    color: #444;
}

#chantier-desc p { margin: 0 0 0.8em; }
#chantier-desc p:last-child { margin-bottom: 0; }

/* ── Responsive mobile ────────────────────────────────────── */
@media (max-width: 600px) {
	 /* La hauteur est fixée en style inline (PHP + JS) : !important nécessaire pour la surcharger */
    .chantiers-map-wrapper {
        height: 600px !important;
    }
	
    .chantiers-filterbar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 10px;
    }

    /* Catégories sur une seule ligne défilante horizontalement, au lieu de wrapper */
    .filterbar-cats {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        border-right: none;
        padding-bottom: 4px;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .filterbar-cats .filter-btn {
        flex-shrink: 0;
    }

    /* Marge après le dernier bouton : évite qu'il reste collé au bord une fois le scroll au maximum */
    .filterbar-cats .filter-btn:last-child {
        margin-right: 10px;
    }

    .filterbar-search {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .chantier-panel {
        top: 110px;
        bottom: 0;
        left: 5%;
        right: 0;
        width: 90%;
        max-height: 460px;
        border-radius: 5px;
        transform: translateY(100%);
		z-index:999;
    }

    .chantier-panel.is-open {
        transform: translateY(0);
        opacity: 1;
    }

    .chantier-panel-photo {
        height: 150px;
        border-radius: 3px 3px 0 0;
    }
}
