/* Hero accueil — format équilibré */

.hero-abritel.hero-modern {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: clamp(280px, 34vh, 380px);
    max-height: none;
    padding: 0;
    margin-bottom: clamp(40px, 6vh, 56px);
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: transparent !important;
    box-sizing: border-box;
}

/* Avec pub : la hauteur du hero suit le contenu (image + titre) */
.hero-abritel.hero-modern.hero-abritel--has-ad {
    min-height: clamp(300px, 36vh, 420px);
}

.hero-abritel .hero-slider,
.hero-abritel .hero-abritel__slider {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.hero-abritel .slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: none;
    transition: opacity 1s ease-in-out;
}

.hero-abritel .slide.active {
    opacity: 1;
    transform: none;
}

.hero-abritel .hero-overlay,
.hero-abritel .hero-abritel__overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: var(--hero-gradient, linear-gradient(135deg, rgba(0, 51, 102, 0.55) 0%, rgba(26, 75, 115, 0.42) 100%));
}

.hero-abritel__inner,
.hero-abritel__inner.container {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 12px 20px clamp(52px, 8vh, 64px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
}

.hero-abritel--has-ad .hero-abritel__inner,
.hero-abritel--has-ad .hero-abritel__inner.container {
    padding-bottom: clamp(56px, 8vh, 72px);
}

/* Zone publicitaire — hauteur pilotée par l’image, fond transparent */
.biim-ad-hero-slot {
    order: 1;
    flex: 0 0 auto;
    align-self: stretch;
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 10px 0 6px;
    margin: 0;
    color: #fff;
}

.biim-ad-hero-slot--active {
    height: auto;
    overflow: visible;
}

.biim-ad-hero-slot--active .widget,
.biim-ad-hero-slot--active .biim-ad-hero-widget {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.biim-ad-hero-slot--active .biim-ad-hero-widget a,
.biim-ad-hero-slot--active .widget_media_image a,
.biim-ad-hero-slot--active .biim-ad-banner-widget a {
    display: block;
    width: 100%;
    max-width: 100%;
    line-height: 0;
}

.biim-ad-hero-slot--active img {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    margin: 0 auto;
    display: block !important;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
}

/* Sécurité : images très verticales ne débordent pas */
.biim-ad-hero-slot--active img {
    max-height: min(220px, 28vh);
}

/* Widgets admin : image, HTML, texte */
.biim-ad-hero-widget iframe,
.biim-ad-hero-widget video {
    max-width: 100%;
}

.biim-ad-hero-widget .textwidget {
    color: #fff;
}

/* Aperçu pub par défaut (styles de base — renforcés dans biim-ad-zones.css) */
.biim-ad-hero-demo {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 18px;
    width: 100%;
    min-height: 100px;
    padding: 22px 28px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px dashed rgba(255, 255, 255, 0.4);
}

.biim-ad-hero-demo__badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.biim-ad-hero-demo__title {
    margin: 0;
    font-size: clamp(1.1rem, 2.3vw, 1.4rem);
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    text-align: center;
}

.biim-ad-hero-demo__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #c97516 0%, #d4a853 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.biim-ad-hero-demo__cta:hover {
    color: #fff;
}

/* Titre d'accroche — sous la pub, ne doit pas passer sous la barre de recherche */
.hero-abritel__tagline {
    order: 2;
    flex: 0 0 auto;
    flex-shrink: 0;
    display: block;
    margin: 0;
    padding: 8px 0 6px;
    width: 100%;
    text-align: center;
    font-size: clamp(1.15rem, 2.4vw, 1.55rem);
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
}

/* Dock recherche — ancré en bas du hero, déborde vers le bas avec ombre */
.hero-abritel__dock,
.hero-abritel__dock.animate-on-scroll,
.hero-abritel__dock.animate-on-scroll.animated {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    transform: translateY(50%) !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 20;
    box-sizing: border-box;
}

.biim-search-pill {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow:
        0 2px 6px rgba(15, 23, 42, 0.06),
        0 8px 24px rgba(15, 23, 42, 0.1),
        0 16px 36px rgba(15, 23, 42, 0.1);
    overflow: visible;
    min-height: 62px;
    padding: 5px 7px 5px 3px;
    box-sizing: border-box;
}

.biim-search-pill__segment {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    cursor: text;
}

.biim-search-pill__segment.commune-field-modern.hide,
.biim-search-pill__divider--commune {
    display: none;
}

.biim-search-pill__segment.commune-field-modern:not(.hide) + .biim-search-pill__divider--commune {
    display: block;
}

.biim-search-pill__segment:hover,
.biim-search-pill__segment:focus-within {
    background: transparent;
    border-radius: 0;
}

.biim-search-pill__segment:hover .biim-search-pill__field {
    background: #eef2f7;
}

.biim-search-pill__label {
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.biim-search-pill__field {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 5px 9px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.biim-search-pill__segment:focus-within .biim-search-pill__field {
    background: #fff;
    border-color: var(--primary-blue, #003366);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.biim-search-pill__field-icon {
    position: absolute;
    left: 10px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--primary-blue, #003366);
    opacity: 0.55;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
    width: 14px;
    text-align: center;
}

.biim-search-pill__segment input {
    border: 0;
    background: transparent;
    padding: 0 10px 0 30px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    width: 100%;
    min-height: 22px;
    box-shadow: none;
    outline: none;
    font-family: inherit;
    position: relative;
    z-index: 1;
    text-overflow: ellipsis;
}

.biim-search-pill__segment input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.biim-search-pill__divider {
    width: 1px;
    background: #e2e8f0;
    margin: 10px 0;
    flex-shrink: 0;
}

.biim-search-pill__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 0 8px 0 2px;
}

.biim-search-pill__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.biim-search-pill__icon--search {
    background: var(--primary-blue, #003366);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 51, 102, 0.35);
}

.biim-search-pill__icon--search:hover {
    background: #002244;
    transform: scale(1.05);
}

.biim-search-pill__icon--filters {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.biim-search-pill__icon--filters:hover {
    background: #e2e8f0;
    color: var(--primary-blue, #003366);
}

.biim-search-pill .searchable-input-container {
    position: relative;
    width: 100%;
    min-width: 0;
    z-index: 1;
}

/* Pas de double icône (front-page.php ajoute un ::before recherche) */
.biim-search-pill .searchable-input-container::before,
.biim-search-pill .searchable-input-container::after {
    content: none !important;
    display: none !important;
}

.biim-search-pill .searchable-input-container input[type="text"] {
    padding: 0 10px 0 30px !important;
}

.biim-search-pill .searchable-input-container input[type="text"]:focus {
    box-shadow: none !important;
    border-color: transparent !important;
}

.biim-search-pill .searchable-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.08),
        0 16px 40px rgba(15, 23, 42, 0.14);
    max-height: 260px;
    overflow-y: auto;
    z-index: 100;
}

body.home .main-content-wrapper,
body.front-page .main-content-wrapper {
    padding-top: 12px;
}

body.home .featured-properties-section.section-modern,
body.front-page .featured-properties-section.section-modern {
    padding-top: 28px;
    padding-bottom: 44px;
}

body.home .featured-properties-section .section-topbar,
body.front-page .featured-properties-section .section-topbar {
    margin-bottom: 12px;
}

@media (max-width: 900px) {
    .hero-abritel.hero-modern:not(.hero-abritel--has-ad) {
        min-height: clamp(260px, 32vh, 340px);
    }

    .hero-abritel.hero-modern.hero-abritel--has-ad {
        min-height: clamp(280px, 34vh, 380px);
    }

    .hero-abritel__inner,
    .hero-abritel__inner.container {
        padding: 10px 16px clamp(48px, 7vh, 58px);
    }

    .biim-ad-hero-slot {
        padding: 8px 0 4px;
    }

    .biim-ad-hero-slot--active img {
        max-height: min(180px, 24vh);
    }

    .hero-abritel__dock,
    .hero-abritel__dock.animate-on-scroll,
    .hero-abritel__dock.animate-on-scroll.animated {
        padding-left: 16px;
        padding-right: 16px;
        transform: translateY(48%) !important;
    }

    .biim-search-pill {
        flex-wrap: wrap;
        border-radius: 12px;
        padding: 6px;
        min-height: auto;
    }

    .biim-search-pill__divider,
    .biim-search-pill__divider--commune {
        display: none !important;
    }

    .biim-search-pill__segment {
        flex: 1 1 calc(50% - 8px);
        border-radius: 8px;
        padding: 8px 12px;
    }

    .biim-search-pill__segment.commune-field-modern:not(.hide) {
        flex: 1 1 100%;
    }

    .biim-search-pill__actions {
        flex: 1 1 100%;
        justify-content: center;
        padding: 2px 0;
        gap: 8px;
    }

    body.home .main-content-wrapper,
    body.front-page .main-content-wrapper {
        padding-top: 8px;
    }
}

@media (max-width: 640px) {
    .biim-search-pill__segment {
        flex: 1 1 100%;
    }

    .biim-ad-hero-demo {
        min-height: 88px;
        padding: 18px 20px;
    }

    .hero-abritel__tagline {
        font-size: 1.15rem;
        padding-top: 6px;
    }

    .biim-ad-hero-slot--active img {
        max-height: min(150px, 22vh);
    }
}
