/* Karto Map Plugin Styles */

/* Intégration dans une page (accueil, builder) : pas de sticky 100vh sur toute la hauteur du contenu */
#karto-map-container.karto-embed {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    isolation: isolate;
    flex-shrink: 0;
    clear: both;
}

#karto-map-container.karto-embed .karto-layout {
    flex: 1;
    min-height: 0 !important;
    height: 100%;
    max-height: 100%;
    /* flex-start laisse la sidebar à la hauteur de son contenu → débordement et chevauchement avec la suite de la page */
    align-items: stretch;
    align-content: stretch;
}

/* Colonne gauche : une seule zone scrollable (liste + pagination), hauteur bornée par le bloc embed.
   min-height: 0 évite que le flex « mange » toute la hauteur du contenu → plus de cartes rognées sans scroll. */
#karto-map-container.karto-embed .karto-sidebar {
    min-height: 0;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    position: relative;
    top: auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    flex: 1 1 50%;
}

#karto-map-container.karto-embed .karto-header {
    flex-shrink: 0;
    z-index: 40;
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

#karto-map-container.karto-embed .karto-list {
    flex: 1 0 auto;
    min-height: 0;
}

#karto-map-container.karto-embed .karto-pagination {
    flex-shrink: 0;
}

#karto-map-container.karto-embed .karto-map-container {
    /* Carte figée dans la section, avec hauteur viewport */
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    min-width: 0;
    flex: 1 1 50%;
    overflow: hidden;
}

#karto-map-container.karto-embed .karto-layout:not(.compact) .karto-map-container {
    height: 100vh;
}

#karto-map-container.karto-embed #karto-map {
    min-height: 0;
}

/* Mode normal : carte prend 100vh (hauteur de l'écran visible) */
.karto-layout:not(.compact) .karto-map-container {
    height: 100vh;
}

@media (max-width: 768px) {
    #karto-map-container.karto-embed .karto-layout {
        flex-direction: column;
        min-height: 0;
        height: 100%;
    }

    #karto-map-container.karto-embed .karto-map-container {
        order: 1;
        height: 50vh;
        min-height: 0;
        max-height: 50vh;
        flex-shrink: 0;
    }

    #karto-map-container.karto-embed .karto-layout:not(.compact) .karto-map-container {
        height: 50vh !important;
    }

    #karto-map-container.karto-embed .karto-sidebar {
        order: 2;
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        max-width: 100%;
        flex-basis: auto;
    }

    #karto-map-container.karto-embed .karto-map-container {
        flex: 0 0 auto;
        width: 100%;
    }
}

.karto-layout {
    display: flex;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
    background: #ffffff;
   /* box-shadow: 0 0 20px rgba(0,0,0,0.1);*/
    align-items: flex-start;
}

.karto-layout.karto-limited,
.karto-limited-wrapper {
    background: transparent;
    box-shadow: none;
}

/* Mode réduit pour la carte */
.karto-layout.compact {
    flex-direction: column;
}

.karto-layout.compact .karto-sidebar {
    width: 100%;
    min-width: auto;
    max-height: none;
    position: static;
    order: 1;
    border-radius: 0;
    box-shadow: none;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
}

.karto-layout.compact .karto-map-container {
    width: 100%;
    height: 500px;
    position: static;
    order: 2;
    border-radius: 0;
    overflow: hidden;
    margin: 0;
}

.karto-layout.compact #karto-map {
    border-radius: 0;
}

.karto-layout.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #ffffff;
    min-height: 100vh;
}

.karto-layout.fullscreen .karto-sidebar {
    display: none;
}

.karto-layout.fullscreen .karto-map-container {
    width: 100%;
    height: 100vh !important;
}

.karto-layout.fullscreen #karto-map {
    height: 100vh !important;
    border-radius: 0;
}

/* Sidebar */
.karto-sidebar {
    width:50%;
    min-width: 400px;
    background: #ffffff;
  /*  border-right: 1px solid #e0e0e0;*/
    display: flex;
    flex-direction: column;
    height: auto;
    /* La colonne gauche doit suivre le flux naturel pour permettre un scroll complet de la liste */
    position: relative;
    top: auto;
    max-width: 100%;
    box-sizing: border-box;
  /*  border-radius: 0 12px 12px 0;*/
  /*  box-shadow: 2px 0 10px rgba(0,0,0,0.1);*/
}

/* Mode compact : sidebar prend la hauteur de son contenu */
.karto-layout.compact .karto-sidebar {
    height: auto;
    max-height: none;
    overflow-y: visible;
}

.karto-layout.karto-limited .karto-sidebar {
    border-right: none;
    box-shadow: none;
}

.karto-header {
    padding: 0 40px 40px 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.karto-header-box {
    background: #F7F7F7;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    align-items: center;
}

.karto-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 20px 0;
}

/* Categories */
.karto-categories-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.karto-categories {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow: hidden;
    scroll-behavior: smooth;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.karto-cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
    font-weight: 500;
    color: #039FA5;
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    flex-shrink: 0;
    text-align: center;
}

.karto-cat-btn .icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #039FA5;
    background: rgba(3, 159, 165, 0.14); /* #039FA524 */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #039FA5;
    transition: all 0.2s ease;
}

.karto-cat-btn .icon .karto-category-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Pour les images (PNG, JPG, etc.) - appliquer un filtre pour obtenir #039FA5 */
.karto-cat-btn .icon .karto-category-icon {
    filter: brightness(0) saturate(100%) invert(48%) sepia(99%) saturate(2476%) hue-rotate(158deg) brightness(95%) contrast(101%);
    transition: filter 0.2s ease;
}

/* Pour les SVG inline - utiliser fill avec currentColor */
.karto-cat-btn .icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: fill 0.2s ease;
    background: transparent;
    display: block;
}

.karto-cat-btn span:last-child {
    color: #039FA5;
    letter-spacing: 0.4px;
    line-height: 1.3;
}

.karto-cat-btn:hover .icon {
    background: rgba(3, 159, 165, 0.24);
}

.karto-cat-btn.active .icon {
    background: #039FA5;
    border-color: #039FA5;
    color: #ffffff;
}

/* Pour les images actives (non-SVG) - filtre blanc */
.karto-cat-btn.active .icon .karto-category-icon {
    filter: brightness(0) invert(1);
}

/* Pour les SVG inline actifs - fill blanc */
.karto-cat-btn.active .icon svg {
    fill: #ffffff;
}

.karto-cat-btn.active span:last-child {
    color: #039FA5;
}

/* Flèches de navigation des catégories */
.karto-categories-nav {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    color: #039FA5;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.karto-categories-nav:hover {
    background: #039FA5;
    color: #ffffff;
    border-color: #039FA5;
}

.karto-categories-nav:disabled,
.karto-categories-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Filtres de date */
.karto-date-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
    padding: 0 20px;
    flex-wrap: nowrap;
}

.karto-date-filters-left {
    display: flex;
    gap: 10px;
}

.karto-date-filters-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.karto-count {
    flex: 1;
    text-align: center;
    color: #666;
    font-size: 14px;
    min-width: 90px;
}

.karto-date-filter-btn {
    flex: 1;
    padding: 10px 16px;
    border: 0px;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #1C1C1C;
    transition: all 0.3s ease;
    text-align: center;
}

.karto-date-filter-btn:hover {
    /*border-color: #20b2aa;*/
    color: #20b2aa;
    background: #f0f9f8;
}

.karto-date-filter-btn.active {
    /*background: #20b2aa;
    border-color: #20b2aa;*/
    background: #1C1C1C;
    color: #ffffff;
}

/* Category header */
.karto-category-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.karto-category-header span {
    color: #666;
    font-size: 14px;
    text-align: center;
}

.karto-filters-btn {
    background: #000000;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.karto-filters-btn img {
    display: block;
    flex-shrink: 0;
}

.karto-filters-btn span {
    text-transform: uppercase;
    color: #ffffff;
}

.karto-filters-btn:hover {
    background: #333333;
}

.karto-calendar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.karto-calendar-icon svg {
    display: block;
}

/* Bouton Date inversé par rapport à Filtres */
.karto-calendar-btn {
    background: #ffffff;
    color: #111111;
    border: 1px solid #111111;
}

.karto-calendar-btn span {
    color: #111111;
}

.karto-calendar-btn:hover {
    background: #f4f4f4;
    color: #000000;
}

/* Mode recherche (shortcode karto_map_search) */
.karto-search-mode .karto-search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 0 20px;
}

.karto-search-mode .karto-search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    color: #1C1C1C;
    background: #ffffff;
}

.karto-search-mode .karto-search-input:focus {
    outline: none;
    border-color: #039FA5;
}

.karto-search-mode .karto-search-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background: #1C1C1C;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.karto-search-mode .karto-search-btn:hover {
    background: #333333;
}

.karto-search-mode .karto-count {
    display: block;
    text-align: center;
    padding: 0 20px;
    margin-bottom: 10px;
}

/* Version compacte du titre en mode recherche */
.karto-search-mode .karto-header h2 {
    font-size: 19px;
    margin: 0;
    line-height: 1.2;
    flex: 0 1 auto;
    width: 200px;
    max-width: 100%;
}

/* Mode recherche (desktop) : recherche puis carte */
.karto-layout.karto-search-mode .karto-map-container {
    order: 2;
}

.karto-layout.karto-search-mode .karto-sidebar {
    order: 1;
}

.karto-search-empty {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 15px;
}

.karto-search-empty p {
    margin: 0;
}

/* Filtres avancés */
.karto-filters-panel {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.karto-calendar-panel {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 14px;
    display: none;
    overflow-x: hidden;
}

.karto-calendar-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.karto-calendar-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.karto-calendar-field label {
    font-size: 12px;
    color: #4f4f4f;
    font-weight: 600;
}

.karto-calendar-field input[type="date"] {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #d5d5d5;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

/* Correctif Safari iOS : évite le léger débordement visuel des input date */
@supports (-webkit-touch-callout: none) {
    .karto-calendar-field input[type="date"] {
        width: -webkit-fill-available;
        max-width: 100%;
    }
}

.karto-calendar-help {
    margin: 10px 0 0;
    font-size: 12px;
    color: #707070;
}

.karto-calendar-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.karto-calendar-reset,
.karto-calendar-apply {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.karto-calendar-reset {
    background: #fff;
    border-color: #111;
    color: #111;
}

.karto-calendar-apply {
    background: #111;
    border-color: #111;
    color: #fff;
}

/* Ecrans intermédiaires : éviter l'écrasement de la barre filtres/date */
@media (max-width: 1360px) {
    .karto-date-filters {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .karto-date-filters-left {
        order: 1;
        flex: 1 1 auto;
        min-width: 320px;
    }

    .karto-date-filters-right {
        order: 2;
        margin-left: auto;
    }

    .karto-count {
        order: 3;
        flex: 1 1 100%;
        text-align: right;
        min-width: 0;
    }
}

.karto-filters-panel.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.karto-filter-group {
    margin-bottom: 20px;
}

.karto-filter-group h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* Grille responsive pour les filtres dans un groupe */
.karto-filter-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

/* Très petit mobile : revenir à 1 colonne pour éviter l'écrasement */
@media (max-width: 360px) {
    .karto-filter-checkboxes {
        grid-template-columns: 1fr;
    }
}

/* Tablette : 2 colonnes (481px - 1023px) */
@media (min-width: 481px) {
    .karto-filter-checkboxes {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop : 3 colonnes (>= 1024px) */
@media (min-width: 1024px) {
    .karto-filter-checkboxes {
        grid-template-columns: repeat(3, 1fr);
    }
}

.karto-filter-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.karto-filter-checkboxes label:hover {
    background: #e9ecef;
}

.karto-filter-checkboxes input[type="checkbox"] {
    margin: 0;
    accent-color: #20b2aa;
}

/* Conteneur pour les selects dans la grille */
.karto-filter-checkboxes .karto-filter-select-wrapper {
    display: flex;
    width: 100%;
}

.karto-filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #ffffff;
    color: #333;
    box-sizing: border-box;
}

.karto-filter-select:focus {
    outline: none;
    border-color: #20b2aa;
    box-shadow: 0 0 0 2px rgba(32, 178, 170, 0.2);
}

.karto-filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.karto-filter-reset,
.karto-filter-apply {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.karto-filter-reset {
    background: transparent;
    border-color: #000000;
    color: #000000;
}

.karto-filter-reset:hover {
    background: #000000;
    color: #ffffff;
}

.karto-filter-apply {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
}

.karto-filter-apply:hover {
    background: #111111;
}

.karto-filter-reset:focus-visible,
.karto-filter-apply:focus-visible {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

/* Points list */
.karto-list {
    flex: 1;
    padding: 0 40px 40px 40px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    align-content: start;
    overflow: visible;
}

/* Mode compact : grille responsive */
.karto-layout.compact .karto-list {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1540px) {
    .karto-layout.compact .karto-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 560px) {
    .karto-header-search.is-open .karto-header-search-input {
        right: 0 !important;
        width: 180px !important;
        min-width: 180px !important;
        /* Hérite de top: calc(100% + 8px) depuis la règle <=1540px */
    }

    .karto-header-search.is-open .karto-header-search-submit {
        right: -120px !important;
        min-width: 110px !important;
    }
}

@media (max-width: 900px) {
    .karto-layout.compact .karto-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .karto-layout.compact .karto-list {
        grid-template-columns: 1fr;
    }
}

.karto-point-card {
    background: #ffffff;
    /*border: 1px solid #e0e0e0;*/
    border-radius: 12px;
    margin-bottom: 0;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0px 10px 20px #00000029;
    display: flex;
    flex-direction: column;
}

.karto-point-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.karto-point-card.active {
    border-color: #20b2aa;
    box-shadow: 0 0 0 2px rgba(32, 178, 170, 0.2);
}

.karto-point-image {
    width: 100%;
    height: 180px;
    background: #f5f5f5;
    background-size: cover;
    background-position: center;
    position: relative;
    flex-shrink: 0;
    border-radius:12px;
}

/* Image sans thumbnail : fond gris clair avec icône centrée */
.karto-point-image-no-thumbnail {
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: auto;
}

.karto-point-image-no-thumbnail .karto-default-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    opacity: 0.6;
}

/* Positionner le bouton favoris en overlay sur l'image */
.karto-point-image .karto-favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

.karto-point-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.karto-point-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.karto-point-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.3;
    /*flex: 1;*/
}

.karto-point-meta {
    /*color: #20b2aa;*/
    color: #b1b1b1;
    font-size: 14px;
    font-weight: 500;
    line-height: 150%;
    margin: 0 0 8px 0;
}

.karto-point-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    display:none;
}

.karto-point-adresse {
    font-size: 14px;
    line-height: 150%;
    font-weight: 400;
    margin: 0 0 8px 0;
    display:none;
}

.karto-point-contact {
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 8px 0;
    display:none;
}

/* Map container */
.karto-map-container {
    flex: 1;
    position: sticky;
    top: 0;
    height: 100vh;
    background: #f5f5f5;
    border-radius: 12px 0 0 12px;
    overflow: hidden;
    margin: 0;
    align-self: flex-start;
}

/* Mode compact : carte a une hauteur fixe de 500px */
.karto-layout.compact .karto-map-container {
    height: 500px;
    position: static;
    border-radius: 0;
}

#karto-map {
    width: 100%;
    height: 100%;
    position: relative;
    top: auto;
    border-radius: 12px 0 0 12px;
}

/* Garde-fou : la carte doit rester dans sa section (pas fixed sur toute la page). */
.karto-layout:not(.fullscreen) #karto-map {
    position: relative !important;
    top: auto !important;
    left: auto !important;
}

/* Mode hauteur limitée (shortcode [karto_map_limited]) */
.karto-limited-wrapper {
    height: var(--karto-height, 500px);
    max-height: none;
}

.karto-layout.karto-limited {
    height: 100%;
    min-height: 0;
    flex-direction: row;
}

.karto-layout.karto-limited .karto-sidebar {
    height: 100%;
    overflow: hidden;
}

.karto-layout.karto-limited .karto-header {
    flex-shrink: 0;
}

.karto-layout.karto-limited .karto-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 16px;
}

.karto-layout.karto-limited .karto-map-container {
    position: relative;
    top: auto;
    height: 100%;
}

.karto-layout.karto-limited:not(.compact) .karto-map-container {
    height: 100%;
}

.karto-layout.karto-limited .karto-map-controls {
    top: 16px;
}

/* Lisibilité des cartes en mode limité */
.karto-layout.karto-limited .karto-point-card {
    height: 200px;
    min-height: 0;
}

.karto-layout.karto-limited .karto-point-image {
    height: 120px;
}

.karto-layout.karto-limited .karto-point-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.karto-layout.karto-limited .karto-point-title {
    margin: 0;
    line-height: 1.3;
    font-size: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.karto-layout.karto-limited .karto-point-meta {
    margin: 0;
}

.karto-layout.karto-limited .karto-point-description,
.karto-layout.karto-limited .karto-point-adresse,
.karto-layout.karto-limited .karto-point-contact {
    margin: 0;
    line-height: 1.4;
    font-size: 13px;
}

.karto-layout.karto-limited .karto-point-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Grille limitée : 3 colonnes */
.karto-layout.karto-limited .karto-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .karto-layout.karto-limited .karto-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .karto-layout.karto-limited .karto-list {
        grid-template-columns: 1fr;
    }
}

/* Pagination */
.karto-pagination {
    padding: 12px 20px 20px 20px;
}

.karto-pagination-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.karto-page-btn,
.karto-page-dot {
    border: 1px solid #e0e0e0;
    background: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    min-width: 34px;
    transition: all 0.2s ease;
}

.karto-page-btn[disabled] {
    opacity: 0.5;
    cursor: default;
}

.karto-page-dot.active {
    background: #20b2aa;
    border-color: #20b2aa;
    color: #fff;
}

.karto-page-btn:hover:not([disabled]),
.karto-page-dot:hover {
    border-color: #20b2aa;
    color: #20b2aa;
}

.karto-page-ellipsis {
    padding: 6px 4px;
    color: #666;
    font-size: 13px;
    user-select: none;
    pointer-events: none;
}

/* Map controls */
.karto-map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.karto-control-btn {
    width: 40px;
    height: 40px;
    background: #20b2aa;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.karto-control-btn:hover {
    background: #1a9b94;
    transform: scale(1.1);
}

/* Marqueurs personnalisés */
.karto-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.karto-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Icône dans les marqueurs */
.karto-marker-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Couleurs par catégorie */
.karto-marker.patrimoine {
    background: #20b2aa;
}

.karto-marker.balade {
    background: #32cd32;
}

.karto-marker.hebergement {
    background: #4169e1;
}

.karto-marker.sport {
    background: #ff6347;
}

.karto-marker.restaurant {
    background: #ff8c00;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-width: 250px;
}

.karto-popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px;
    min-width: 200px;
}

.karto-popup-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f5f5f5;
    background-size: cover;
    background-position: center;
    margin-bottom: 12px;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Popup image sans thumbnail : fond gris clair avec icône centrée */
.karto-popup-image-no-thumbnail {
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: auto;
}

.karto-popup-image-no-thumbnail .karto-default-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    opacity: 0.6;
}

.karto-popup-text {
    width: 100%;
}

.karto-popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.karto-popup-meta {
    font-size: 13px;
    color: #20b2aa;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.karto-popup-description {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

.karto-popup-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.karto-popup-actions .karto-favorite-btn {
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.karto-popup-fiche-link {
    font-size: 13px;
    font-weight: 500;
    color: #039FA5;
    text-decoration: none;
}

.karto-popup-fiche-link:hover {
    text-decoration: underline;
}

/* Loading state */
.karto-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-size: 14px;
}

.karto-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #20b2aa;
    border-radius: 50%;
    animation: karto-spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes karto-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.karto-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.karto-empty h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

.karto-empty p {
    margin: 0;
    font-size: 14px;
}

/* Contrôle des couches Leaflet - Positionné à gauche */
.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    z-index: 1000 !important;
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    /*min-width: 150px !important;*/
    max-width: 200px !important;
}

.leaflet-control-layers-toggle {
    background: #ffffff !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important;
    width: 30px !important;
    height: 30px !important;
    font-size: 14px !important;
    font-weight: normal !important;
}

.leaflet-control-layers-toggle:hover {
    background: #f5f5f5 !important;
}

/* État replié : afficher une icône SVG dans le bouton */
.leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-toggle {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%231f1f1f'%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 18px 18px !important;
    text-indent: -9999px;
    overflow: hidden;
}

.leaflet-control-layers-expanded {
    padding: 8px !important;
    font-size: 12px !important;
    background: #ffffff !important;
    border-radius: 4px !important;
    min-width: 150px !important;
}

.leaflet-control-layers label {
    font-weight: 400 !important;
    color: #333 !important;
    margin-bottom: 4px !important;
    display: block !important;
    cursor: pointer !important;
    padding: 2px 0 !important;
    font-size: 12px !important;
}

.leaflet-control-layers label:hover {
    background: #f0f8ff !important;
    border-radius: 2px !important;
    padding: 2px 4px !important;
}

.leaflet-control-layers input[type="radio"] {
    margin-right: 6px !important;
    accent-color: #20b2aa !important;
}

/* Masquer les contrôles de zoom natifs de Leaflet */
.leaflet-control-zoom {
    display: none !important;
}

/* Responsive design */
@media (max-width: 1280px) {
    /* Tablette : 1 colonne (un événement par ligne) */
    .karto-layout:not(.compact) .karto-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .karto-date-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .karto-date-filters-left,
    .karto-date-filters-right {
        width: 100%;
    }

    .karto-date-filters-right {
        justify-content: flex-end;
    }

    .karto-count {
        width: 100%;
        text-align: center;
        min-width: 0;
    }

    .karto-calendar-fields {
        grid-template-columns: 1fr 1fr;
    }

    /* Evite le zoom iOS à la saisie des dates */
    .karto-calendar-field input[type="date"] {
        font-size: 1em;
    }

    /* Evite le zoom iOS sur les champs de recherche */
    .karto-search-mode .karto-search-input,
    .karto-header-search-input {
        font-size: 16px;
    }

    .karto-header-box {
        flex-direction: column;
    }

    .karto-categories-nav {
        display: none;
    }

    .karto-categories {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        overflow: hidden;
        scroll-behavior: smooth;
        flex: 1;
        min-width: 0;
        box-sizing: border-box;
        align-items: flex-start;
    }

    .karto-categories-wrapper.can-scroll-right::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        width: 36px;
        height: 100%;
        pointer-events: none;
        background: linear-gradient(to left, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 45%, rgba(0, 0, 0, 0) 100%);
    }

    .karto-categories-wrapper.can-scroll-left::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 28px;
        height: 100%;
        pointer-events: none;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.09) 0%, rgba(0, 0, 0, 0.04) 45%, rgba(0, 0, 0, 0) 100%);
    }

    /* Mode recherche : basculer en colonne sur tablette */
    .karto-layout.karto-search-mode {
        flex-direction: column;
        min-height: auto;
    }

    .karto-layout.karto-search-mode .karto-map-container {
        width: 100%;
        height: 45vh;
        min-height: 320px;
        order: 1;
    }

    .karto-layout.karto-search-mode .karto-sidebar {
        width: 100%;
        order: 2;
    }

    .karto-search-mode .karto-header {
        padding: 0 16px 16px 16px;
    }

    .karto-search-mode .karto-header-box {
        gap: 10px;
        padding: 12px;
        align-items: stretch;
    }

    .karto-search-mode .karto-header h2 {
        width: 100%;
        font-size: 18px;
        line-height: 1.25;
    }

    .karto-search-mode .karto-search-form {
        width: 100%;
        padding: 0;
        margin-bottom: 0;
    }

    .karto-search-mode .karto-count {
        padding: 0;
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .karto-layout:not(.compact) .karto-map-container {
        height: 50vh;
    }

    .karto-layout {
        flex-direction: column;
        min-height: auto;
    }
    
    .karto-sidebar {
        width: 100%;
        min-width: auto;
        max-height: none;
        position: static;
        order: 2;
    }
    
    .karto-map-container {
        position: static;
        height: 50vh;
        min-height: 0;
        order: 1;
        border-radius: 0;
        flex: 0 0 auto;
        width: 100%;
        display: block;
    }
    
    #karto-map {
        width: 100%;
        height: 100%;
        min-height: 0;
        border-radius: 0;
    }
    
    .karto-categories-wrapper {
        flex-wrap: wrap;
    }

    .karto-header-box {
        flex-direction: column;
    }
    
    .karto-categories {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        overflow: hidden;
        scroll-behavior: smooth;
        flex: 1;
        min-width: 0;
        box-sizing: border-box;
        align-items: flex-start;
    }

    /* Indice visuel : ombre à droite tant qu'il reste du contenu à scroller */
    .karto-categories-wrapper.can-scroll-right::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        width: 36px;
        height: 100%;
        pointer-events: none;
        background: linear-gradient(to left, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 45%, rgba(0, 0, 0, 0) 100%);
    }

    /* Optionnel : légère ombre gauche quand on a déjà scrollé */
    .karto-categories-wrapper.can-scroll-left::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 28px;
        height: 100%;
        pointer-events: none;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.09) 0%, rgba(0, 0, 0, 0.04) 45%, rgba(0, 0, 0, 0) 100%);
    }
    
    .karto-categories-nav {
        display: none;
    }
    
    .karto-cat-btn {
        flex: 1;
        min-width: 80px;
        max-width: none;
        width: auto;
        justify-content: center;
    }
    
    /* Mode normal : 1 colonne sur mobile */
    .karto-layout:not(.compact) .karto-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .karto-point-card {
        margin-bottom: 0;
    }
    
    .karto-point-image {
        height: 175px;
    }
}

@media (max-width: 480px) {
    .karto-header {
        padding: 15px;
    }
    
    .karto-list {
        padding: 0 15px 15px 15px;
    }
    
    .karto-categories-nav {
        display: none;
    }
    
    .karto-cat-btn {
        padding: 10px 8px;
        font-size: 10px;
        width: 70px;
        min-width: 70px;
        max-width: 70px;
    }
    
    .karto-cat-btn .icon {
        font-size: 14px;
    }

    .karto-date-filters-right {
        justify-content: stretch;
    }

    .karto-date-filters-right .karto-filters-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 10px;
    }

    .karto-date-filters-left {
        gap: 6px;
    }

    .karto-date-filter-btn {
        padding: 9px 10px;
        font-size: 14px;
    }

    .karto-calendar-fields {
        grid-template-columns: 1fr;
    }

    .karto-calendar-field input[type="date"] {
        font-size: 1em;
    }

    .karto-calendar-actions {
        justify-content: stretch;
    }

    .karto-calendar-reset,
    .karto-calendar-apply {
        flex: 1 1 auto;
        text-align: center;
    }

    /* Mobile : bloc de recherche compact et lisible */
    .karto-search-mode .karto-header {
        padding: 12px;
    }

    .karto-search-mode .karto-header-box {
        padding: 10px;
        gap: 8px;
        margin-bottom: 10px;
    }

    .karto-search-mode .karto-header h2 {
        font-size: 16px;
        width: 100%;
    }

    .karto-search-mode .karto-search-form {
        gap: 8px;
    }

    .karto-search-mode .karto-search-input {
        min-width: 0;
        font-size: 16px;
        padding: 9px 12px;
    }

    .karto-search-mode .karto-search-btn {
        padding: 9px 12px;
        font-size: 13px;
    }

    .karto-search-mode .karto-count {
        font-size: 13px;
    }
}

/* Leaflet.markercluster – harmonisation avec le thème Karto */
.marker-cluster {
    background-color: rgba(3, 159, 165, 0.4);
}
.marker-cluster div {
    background-color: #039FA5;
    color: #fff;
}
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(3, 159, 165, 0.35);
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: #039FA5;
    color: #fff;
}

/* Shortcode [karto_header_search] */
.karto-header-search {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    position: relative;
    overflow: visible;
}

.karto-header-search.is-open {
    gap: 8px;
}

.karto-header-search-toggle,
.karto-header-search-submit {
    height: 40px;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.karto-header-search-toggle {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #333333;
}

.karto-header-search-toggle:hover {
    color: #e91e63;
}

.karto-header-search-icon svg {
    display: block;
    width: 2em;
    height: 2em;
    fill: currentColor;
}

.karto-header-search-input {
    width: 0;
    min-width: 0;
    opacity: 0;
    background: #fff;
    border: 1px solid #000000;
    border-radius: 4px;
    padding: 0;
    height: 40px;
    font-size: 16px;
    pointer-events: none;
    transition: width 0.2s ease, opacity 0.2s ease, padding 0.2s ease;
}

.karto-header-search-submit {
    display: none;
    background: #000000;
    border: 1px solid #000000;
    color: #ffffff;
    white-space: nowrap;
    padding: 0 16px;
}

.karto-header-search-submit:hover {
    background: #111111;
}

.karto-header-search.is-open .karto-header-search-input {
    width: 280px;
    min-width: 220px;
    opacity: 1;
    padding: 0 12px;
    pointer-events: auto;
}

.karto-header-search.is-open .karto-header-search-submit {
    display: inline-flex;
    align-items: center;
}

.karto-header-search-input:focus,
.karto-header-search-toggle:focus-visible,
.karto-header-search-submit:focus-visible {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.karto-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 1540px) {
    /* Ecrans serrés : panneau de recherche sous la loupe, sans chevauchement du header */
    .karto-header-search.is-open {
        z-index: 200;
    }

    .karto-header-search.is-open .karto-header-search-input,
    .karto-header-search.is-open .karto-header-search-submit {
        position: absolute;
        top: calc(100% + 8px);
    }

    .karto-header-search.is-open .karto-header-search-input {
        right: 98px;
        width: 220px;
        min-width: 180px;
        background: #ffffff;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    }

    .karto-header-search.is-open .karto-header-search-submit {
        right: 0;
        height: 40px;
        min-width: 90px;
        justify-content: center;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    }
}
