:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --border: #dfe7f1;
    --text: #1f2937;
    --muted: #667085;
    --primary: #1d4ed8;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 12px 28px rgba(15, 23, 42, 0.12);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* ===== HEADER ===== */
.header {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Logo */
.header-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

/* Logo */
.header-logo img {
    max-width: 120px; /* Augmente la taille du logo à 120px */
    height: auto;
    display: block;
}

/* Texte "Rechercher" aligné au bas du logo */
.header-text {
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 700;
    color: #16345f;
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-height: 36px;
}

/* Conteneur de la ligne de recherche et des inputs */
.search-wrap {
    flex: 1 1 auto;
    min-width: 280px;
    position: relative;
}


/* Alignement des inputs avec "Rechercher" */
.search-form {
    display: grid;
    grid-template-columns: 260px 120px 180px 95px 145px 90px 80px;
    gap: 8px;
    align-items: center;
}

/* Ajuste la hauteur des inputs pour qu'ils soient alignés avec "Rechercher" */
.search-form input[type="text"],
.search-form input[type="date"],
.search-form select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
    background: #fff;
    color: var(--text);
}

.search-form input,
.search-form select {
    height: 36px; /* Ajuste la hauteur des inputs pour qu'ils soient alignés exactement avec "Rechercher" */
}

.search-form input:focus,
.search-form select:focus {
    outline: none;
    border-color: rgba(29, 78, 216, 0.45);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.10);
}
.search-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap; /* Empêche le texte de passer à la ligne suivante */
    height: 28px;
    line-height: 28px;
    box-sizing: border-box;
    width: 100%; /* Permet au conteneur d'occuper toute la largeur disponible */
    min-width: 140px; /* S'assure qu'il y a assez de place */
    overflow: hidden; /* Cache tout dépassement du texte */
}

.search-checkbox span {
    white-space: nowrap; /* Empêche que le texte "En cours" passe à la ligne */
}



.search-checkbox input[type="checkbox"] {
    margin: 0;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

#search {
    max-width: 260px;
}

.btn-reset {
    border: 0;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: #e9eef5;
    color: #14233d;
}

.btn-reset:hover {
    background: #dde6f1;
}

.search-status {
    font-size: 12px;
    color: var(--muted);
    min-height: 16px;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-hover);
    z-index: 30;
    overflow: hidden;
    display: none;
}

.search-suggestions.open {
    display: block;
}

.suggestion-item {
    padding: 10px 14px;
    border-bottom: 1px solid #eef3f8;
    cursor: pointer;
}

.suggestion-item:last-child {
    border-bottom: 0;
}

.suggestion-item:hover {
    background: #f8fbff;
}

.suggestion-main {
    font-weight: 700;
    font-size: 14px;
    color: #16345f;
}

.suggestion-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

/* ===== LAYOUT ===== */

.main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px;
    padding: 18px;
    flex: 1;
    align-items: start;
}

.main > aside {
    position: sticky;
    top: 76px;
    align-self: start;
    max-height: calc(100vh - 90px);
    overflow: hidden;
    z-index: 2;
}

/* ===== LEFT ===== */

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    overflow: hidden;
    isolation: isolate;
}

.panel-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    color: #16345f;
    position: relative;
    z-index: 2;
}

.panel-body {
    padding: 14px;
    position: relative;
    z-index: 2;
}

#selected-event-info {
    padding-top: 2px;
    position: relative;
    z-index: 2;
}

.selection-title {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #16345f;
    padding-bottom: 6px;
    border-bottom: 1px solid #e6edf6;
}

.selection-line {
    margin: 4px 0;
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
}

#selected-event-info .selection-line:first-of-type {
    color: #64748b;
    font-size: 13px;
}

#selected-event-info .selection-line strong {
    font-weight: 700;
    color: #1f3a66;
}

#selected-event-info .selection-line + .selection-line {
    margin-top: 6px;
}

#map {
    width: 100%;
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
    display: block;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.leaflet-container {
    width: 100% !important;
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
    position: relative;
    z-index: 1 !important;
}

.leaflet-pane,
.leaflet-top,
.leaflet-bottom,
.leaflet-control {
    z-index: 1 !important;
}



/* ===== RIGHT ===== */

.results-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.results-count {
    font-weight: 700;
    color: #16345f;
    font-size: 15px;
}

.results-info {
    color: var(--muted);
    font-size: 13px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

.event-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: transform .18s ease, box-shadow .18s ease;
    cursor: pointer;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.event-card.active {
    border-color: var(--primary);
}

/* ===== IMAGE + BADGE ===== */

.event-image {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #e2e8f0;
}

.event-thumb {
    width: 100%;
    height: 190px;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

.event-image::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60%;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.55),
        rgba(0, 0, 0, 0.0)
    );
    pointer-events: none;
}

.event-card:hover .event-thumb {
    transform: scale(1.06);
}

.event-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 8px;
    letter-spacing: .3px;
    text-transform: uppercase;
    backdrop-filter: blur(2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
    z-index: 2;
}

.event-card:hover .event-badge {
    transform: translateY(-1px);
    transition: transform .18s ease;
}

/* Couleurs par rubrique */
.badge-salon {
    background: rgba(37, 99, 235, 0.88);
}

.badge-concert {
    background: rgba(139, 92, 246, 0.88);
}

.badge-brocante {
    background: rgba(249, 115, 22, 0.88);
}

.badge-sport {
    background: rgba(34, 197, 94, 0.88);
}

.badge-exposition {
    background: rgba(236, 72, 153, 0.88);
}

.badge-festival {
    background: rgba(234, 179, 8, 0.92);
    color: #1f2937;
}

.badge-marche {
    background: rgba(20, 184, 166, 0.90);
}

.badge-theatre {
    background: rgba(225, 29, 72, 0.88);
}

.badge-cinema {
    background: rgba(15, 23, 42, 0.88);
}

.badge-conference {
    background: rgba(14, 165, 233, 0.90);
}

/* ===== TEXTE CARTE ===== */

.event-content {
    padding: 12px 12px 14px;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

.event-city {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #16345f;
}

.event-meta {
    margin: 2px 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
}

.event-meta + .event-meta {
    margin-top: 4px;
}

.event-row {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.event-pill {
    background: #e8f0ff;
    color: #19429d;
    font-size: 11px;
    padding: 4px 7px;
    border-radius: 12px;
}

.empty-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 26px;
    text-align: center;
    color: var(--muted);
    box-shadow: var(--shadow);
}

/* ===== VIEWER ===== */

.viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 24px;
}

.viewer.open {
    display: flex;
}

.viewer-inner {
    position: relative;
    width: min(96vw, 1200px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.viewer img {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #111;
}

.viewer-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 0;
    background: #fff;
    color: #111827;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 20001;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.viewer-caption {
    margin-top: 10px;
    text-align: center;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    max-width: 100%;
}

/* ===== FOOTER ===== */

.footer {
    background: #16345f;
    color: #fff;
    padding: 20px;
    margin-top: 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.footer h4 {
    margin: 0 0 6px 0;
    font-size: 15px;
}

.footer p {
    margin: 4px 0;
    font-size: 13px;
    line-height: 1.5;
}

/* ===== FIX LEAFLET ===== */

.leaflet-tooltip {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #dfe7f1;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10);
    color: #1f2937;
    padding: 6px 8px;
}

.leaflet-tooltip-top:before {
    border-top-color: #dfe7f1;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1100px) {
    .main {
        grid-template-columns: 1fr;
    }

    .main > aside {
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 700px) {
    .search-form {
        grid-template-columns: 1fr;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 14px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .viewer {
        padding: 12px;
    }

    .viewer-inner {
        width: 100%;
        max-height: 94vh;
    }

    .viewer img {
        max-height: 78vh;
    }

    .viewer-close {
        top: 8px;
        right: 8px;
        position: fixed;
    }
}

@media (min-width: 1400px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

#map {
    cursor: default;
}

#filter-distance {
    height: 38px;
    border-radius: 10px;
}
.selection-title a {
    color: inherit;
    text-decoration: none;
}

.selection-title a:hover {
    text-decoration: underline;
}
.search-status{
    margin-top:8px;
    font-size:14px;
    color:#475569;
}



.event-hint{
    margin:6px 0 0;
    font-size:12px;
    color:#64748b;
}