/* ici gratuit - Mobile-first styles */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #222;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

/* === Carte plein écran === */
#carte {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* Desaturated, lighter map tiles */
.leaflet-tile-pane {
    filter: saturate(0.7) contrast(0.9) brightness(1.1);
}

/* === Barre de filtres temporels === */
#filtres-temps {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 101;
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    background: #00A86B;
    justify-content: center;
}

.filtre-temps {
    padding: 6px 12px;
    border-radius: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filtre-temps:active {
    transform: scale(0.96);
}

.filtre-temps.actif {
    background: white;
    color: #00A86B;
}

/* === Menu démographique === */
#demographic-menu {
    position: fixed;
    top: 52px;
    right: 12px;
    z-index: 100;
}

.demo-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.demo-trigger:active {
    transform: scale(0.94);
}

.demo-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 6px;
    width: 180px;
    max-height: 400px;
    overflow-y: auto;
}

.demo-dropdown.hidden {
    display: none;
}

/* Single-select demographic options */
.demo-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.demo-option:hover {
    background: #f5f5f5;
    color: #222;
}

.demo-option.actif {
    background: #e8f5e9;
    color: #00A86B;
    font-weight: 500;
}

/* === Barre de filtres catégories === */
#filtres {
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#filtres::-webkit-scrollbar {
    display: none;
}

.filtre {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1.5px solid #ddd;
    background: white;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filtre:active {
    transform: scale(0.96);
}

.filtre.actif {
    background: #222;
    color: white;
    border-color: #222;
}

.filtre .badge {
    font-size: 11px;
    opacity: 0.6;
}

.filtre.actif .badge {
    opacity: 0.8;
}

/* === Bouton géolocalisation === */
#btn-geoloc {
    position: fixed;
    bottom: 24px;
    right: 16px;
    z-index: 100;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #222;
    transition: all 0.15s ease;
}

#btn-geoloc:active {
    transform: scale(0.94);
    background: #f5f5f5;
}

#btn-geoloc.loading {
    color: #00A86B;
}

#btn-geoloc.loading svg {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === Bottom sheet === */
#detail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 70vh;
    overflow-y: auto;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom);
}

#detail.visible {
    transform: translateY(0);
}

#overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Detail content - compact */
.detail-item {
    padding: 16px;
}

.detail-item header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.detail-emoji {
    font-size: 32px;
    line-height: 1;
}

.detail-item h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.btn-fermer {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-fermer:active {
    background: #e0e0e0;
}

.detail-summary {
    color: #666;
    line-height: 1.5;
    font-size: 14px;
    margin: 0 0 16px 0;
}

.detail-restrictions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.restriction-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.detail-when {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 10px;
    margin-bottom: 12px;
}

.when-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.when-time {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.btn-calendar {
    font-size: 20px;
    text-decoration: none;
    padding: 4px;
}

.btn-details {
    display: block;
    padding: 16px;
    text-align: center;
    color: white;
    font-weight: 600;
    text-decoration: none;
    background: #00A86B;
    border-radius: 12px;
    font-size: 15px;
}

.btn-details:active {
    background: #008f5a;
}

/* === Marqueurs Leaflet custom === */
.marqueur-icon {
    font-size: 22px;
    text-align: center;
    width: 40px;
    height: 40px;
    line-height: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    border: 3px solid #00A86B;
    transition: all 0.2s ease;
}

.marqueur-icon.viewed {
    border-color: #ccc;
    opacity: 0.7;
}

/* === Toast === */
#toast {
    position: fixed;
    bottom: 88px;
    left: 16px;
    right: 16px;
    z-index: 300;
    padding: 12px 16px;
    background: #333;
    color: white;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

#toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Marker clusters === */
.marker-cluster {
    background: rgba(0, 168, 107, 0.6);
    border-radius: 50%;
}

.marker-cluster div {
    background: #00A86B;
    color: white;
    font-weight: 600;
    font-size: 13px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster-small {
    background: rgba(0, 168, 107, 0.5);
}

.marker-cluster-small div {
    width: 30px;
    height: 30px;
}

.marker-cluster-medium {
    background: rgba(0, 168, 107, 0.6);
}

.marker-cluster-medium div {
    width: 36px;
    height: 36px;
}

.marker-cluster-large {
    background: rgba(0, 168, 107, 0.7);
}

.marker-cluster-large div {
    width: 44px;
    height: 44px;
    font-size: 14px;
}

/* === Leaflet overrides === */
.leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.8) !important;
}

.leaflet-control-zoom {
    display: none;
}

/* === Desktop: side panel === */
@media (min-width: 768px) {
    #detail {
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: 380px;
        max-height: none;
        border-radius: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    #detail.visible {
        transform: translateX(0);
    }

    #filtres-temps {
        left: 16px;
        right: auto;
        border-radius: 20px;
        top: 16px;
        padding: 6px 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    #filtres {
        left: 16px;
        right: auto;
        max-width: calc(100% - 32px);
        border-radius: 12px;
        top: 60px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    #btn-geoloc {
        bottom: 32px;
        right: 24px;
    }

    #toast {
        left: auto;
        right: 24px;
        width: 300px;
        bottom: 100px;
    }
}
