/**
 * Styles unifiés pour les listages châteaux :
 * - Listing châteaux (map_chateaux)
 * - Séjour (map_sejour)
 * - Archives par catégorie : Découverte, Événement, Restaurants (map_archive)
 */

/* Popup Leaflet unifiée (listing, séjour, archives) – même style, sans emoji */
.ikn-map-popup-card {
    min-width: 220px;
    max-width: 265px;
    cursor: pointer;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(60, 100, 60, 0.18);
    border: 1px solid #e0f1db;
}

.ikn-map-popup-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #f1f6ef;
    display: block;
}

.ikn-map-popup-content {
    padding: 12px 15px 14px 15px;
    text-align: left;
}

.ikn-map-popup-title {
    color: #49714b;
    font-weight: 700;
    font-size: 1.07em;
    margin-bottom: 4px;
    line-height: 1.25;
}

.ikn-map-popup-desc {
    font-size: 0.94em;
    color: #4b5a34;
    opacity: 0.94;
    margin-bottom: 8px;
    min-height: 26px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ikn-map-popup-info {
    font-size: 0.9em;
    color: #97b293;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ikn-map-popup-cta {
    display: block;
    background: linear-gradient(135deg, #49714b, #365138);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(73, 113, 75, 0.2);
    text-decoration: none;
    border: none;
    width: 100%;
    cursor: pointer;
}

.ikn-map-popup-cta:hover {
    color: #fff;
    background: linear-gradient(135deg, #365138, #2d3f2e);
}

/* Grilles communes */
.map-chateaux-grid,
.sejour-chateaux-grid,
.map-archive-grid {
    display: grid;
    gap: 32px 24px;
    margin: 0 0 32px 0;
}

@media (min-width: 1200px) {
    .map-chateaux-grid,
    .sejour-chateaux-grid,
    .map-archive-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .map-archive-grid {
        max-width: 1200px;
        margin: 0 auto 32px;
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .map-chateaux-grid,
    .sejour-chateaux-grid,
    .map-archive-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .map-chateaux-grid,
    .sejour-chateaux-grid,
    .map-archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 599px) {
    .map-chateaux-grid,
    .sejour-chateaux-grid,
    .map-archive-grid {
        grid-template-columns: 1fr;
    }
}

/* Cartes châteaux – style unifié */
.chateau-card,
.sejour-chateau-card {
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 4px 28px rgba(108, 150, 105, 0.13);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #354d2e;
    border: 1.5px solid #e0f1db;
    transition: box-shadow 0.17s, border-color 0.16s, transform 0.16s;
    min-width: 0;
    min-height: 340px;
    animation: ikn-popupIn 0.24s cubic-bezier(0.38, 0, 0.63, 1);
    will-change: transform;
}

.chateau-card:hover,
.chateau-card:focus,
.sejour-chateau-card:hover,
.sejour-chateau-card:focus {
    box-shadow: 0 14px 48px rgba(100, 140, 80, 0.19);
    border-color: #b4e1a1;
    transform: translateY(-4px) scale(1.025);
}

.chateau-card img,
.sejour-chateau-card img {
    width: 100%;
    height: 174px;
    object-fit: cover;
    background: #f2f5f1;
    border-radius: 22px 22px 0 0;
    transition: filter 0.15s;
}

.chateau-card:hover img,
.chateau-card:focus img,
.sejour-chateau-card:hover img,
.sejour-chateau-card:focus img {
    filter: brightness(1.06) saturate(1.13);
}

/* Contenu carte */
.chateau-card-content,
.sejour-chateau-content,
.chateau-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 10px 18px;
    min-height: 150px;
}

.chateau-card-content h3,
.sejour-chateau-content h3,
.chateau-title {
    font-size: 1.11em;
    font-weight: 700;
    margin-bottom: 7px;
    color: #49714b;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.chateau-card-content .desc,
.sejour-chateau-content .desc,
.chateau-description {
    font-size: 0.97em;
    color: #4b5a34;
    opacity: 0.93;
    margin-bottom: 11px;
    min-height: 30px;
    line-height: 1.45;
    overflow: hidden;
}

.chateau-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    flex: 1;
}

.chateau-card-content .infos,
.sejour-chateau-content .infos,
.chateau-location {
    font-size: 0.96em;
    color: #97b293;
    margin-bottom: 6px;
    display: flex;
    gap: 12px;
    font-weight: 500;
}

/* Badge nombre de produits (séjour / archive) */
.sejour-chateau-content .products-count,
.chateau-products {
    background: linear-gradient(135deg, #eaf0ea, #f0f5f0);
    color: #5a9250;
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 0.88em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    border: 1px solid #d4e0d4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
}

/* CTA unifié : style commun (listing châteaux = léger, séjour/archive = bouton plein) */
.chateau-card-content .cta {
    margin-top: auto;
    background: #eaf0ea;
    color: #5a9250;
    padding: 7px 0;
    border-radius: 11px;
    text-align: center;
    font-size: 1em;
    font-weight: 600;
    transition: background 0.14s, color 0.13s;
    cursor: pointer;
    margin-bottom: 0;
    margin-top: 10px;
}

.chateau-card:hover .cta,
.chateau-card:focus .cta {
    background: #49714b;
    color: #fff;
}

.sejour-chateau-content .cta,
.chateau-cta {
    margin-top: auto;
    background: linear-gradient(135deg, #49714b, #365138);
    color: #fff;
    padding: 12px 0;
    border-radius: 12px;
    text-align: center;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(73, 113, 75, 0.2);
    margin-top: 15px;
    flex-shrink: 0;
    width: 100%;
}

.sejour-chateau-card:hover .cta,
.chateau-card:hover .chateau-cta {
    background: linear-gradient(135deg, #365138, #2d3f2e);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(73, 113, 75, 0.3);
}

/* Responsive commun */
@media (max-width: 700px) {
    .map-chateaux-grid,
    .sejour-chateaux-grid,
    .map-archive-grid {
        gap: 18px 7px;
    }
    .chateau-card,
    .sejour-chateau-card {
        min-height: 300px;
    }
    .chateau-card img,
    .sejour-chateau-card img {
        height: 125px;
    }
    .chateau-card-content,
    .sejour-chateau-content,
    .chateau-content {
        padding: 11px 10px 7px 10px;
    }
}

@keyframes ikn-popupIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Barre de recherche + tri fixe (séjour, archive – sans filtre univers) */
.ikn-listing-searchbar {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    z-index: 1050;
}
/* Quand la barre est dans body : au-dessus du header et toujours visible */
.ikn-listing-searchbar.ikn-searchbar-in-viewport,
body > #map-chateaux-searchbar.ikn-listing-searchbar {
    z-index: 99999;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 32px rgba(60, 100, 60, 0.15);
    border-radius: 38px;
    padding: 7px 16px 7px 18px;
    width: max(92vw, 340px);
    max-width: 560px;
    gap: 10px;
    min-height: 56px;
    border: 1.5px solid #d9ecd0;
}

.ikn-listing-searchbar #chateau-search-input {
    border: none;
    outline: none;
    font-size: 1.12em;
    background: transparent;
    flex: 1 1 auto;
    font-weight: 500;
    color: #365138;
    padding: 0 7px;
    min-width: 0;
}

.ikn-listing-searchbar #btn-sort-filter {
    background: #49714b;
    color: #fff;
    border: none !important;
    border-radius: 50%;
    font-size: 1.27em;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    box-shadow: 0 2px 10px rgba(120, 170, 120, 0.12);
    cursor: pointer;
    transition: background 0.16s;
}

.ikn-listing-searchbar #btn-sort-filter:hover {
    background: #315c34;
}

@media (max-width: 700px) {
    .ikn-listing-searchbar {
        padding: 5px 10px;
        min-height: 46px;
        bottom: 15px;
    }
    .ikn-listing-searchbar #btn-sort-filter {
        width: 38px;
        height: 38px;
        font-size: 1.03em;
    }
}

/* Modal tri (séjour, archive) */
.modal-bg {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.28);
}
.modal-bg.ikn-sort-modal-in-viewport,
body > #sort-modal-bg.modal-bg {
    z-index: 100000;
}

.modal-bg.active {
    display: block;
}

.modal-popup {
    position: absolute;
    left: 50%;
    top: 48%;
    transform: translate(-50%, -50%);
    min-width: 81vw;
    max-width: 370px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 36px rgba(100, 130, 100, 0.16);
    padding: 24px 19px 15px 19px;
    z-index: 1300;
    text-align: center;
}

.close-modal {
    position: absolute;
    right: 10px;
    top: 6px;
    background: none;
    border: none;
    font-size: 1.3em;
    color: #94ae98;
    cursor: pointer;
}
