/* =========================================================
   APIMO INTEGRATION — v3.1
   Style Swixim · angles droits · cartes +50% · carrousel
   ========================================================= */

/* Variables ----------------------------------------------- */
.apimo-wrap,
.apimo-detail {
    --apimo-primary: #001839;
    --apimo-primary-soft: #002b5e;
    --apimo-accent: #e30613;
    --apimo-text: #1a1a1a;
    --apimo-muted: #6b7280;
    --apimo-border: #e5e7eb;
    --apimo-bg: #ffffff;
    --apimo-bg-soft: #f7f7f8;
    --apimo-shadow: 0 2px 10px rgba(0, 24, 57, 0.08);
    --apimo-shadow-hover: 0 8px 24px rgba(0, 24, 57, 0.14);
    color: var(--apimo-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.apimo-wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Pas de soulignement nulle part dans nos blocs ----------- */
.apimo-wrap a,
.apimo-wrap a:hover,
.apimo-wrap a:focus,
.apimo-wrap a:visited,
.apimo-detail a,
.apimo-detail a:hover,
.apimo-detail a:focus,
.apimo-detail a:visited {
    text-decoration: none !important;
}

/* Sections ------------------------------------------------ */
.apimo-section {
    margin: 40px 0 60px;
}
.apimo-section-title {
    font-size: 30px;
    font-weight: 300;
    color: var(--apimo-primary);
    margin: 0 0 24px;
    letter-spacing: 0.5px;
}
.apimo-section-title strong { font-weight: 700; }

.apimo-section-sold .apimo-section-title {
    border-top: 1px solid var(--apimo-border);
    padding-top: 40px;
}

/* Barre de recherche (toujours visible) ------------------ */
.apimo-searchbar {
    background: #fff;
    border: 1px solid var(--apimo-border);
    padding: 18px 20px;
    margin-bottom: 24px;
    box-shadow: var(--apimo-shadow);
}

.apimo-searchbar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.apimo-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--apimo-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}
.apimo-field input,
.apimo-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--apimo-border);
    font-size: 14px;
    background: #fff;
    color: var(--apimo-text);
    box-sizing: border-box;
    border-radius: 0;
}
.apimo-field input:focus,
.apimo-field select:focus {
    outline: none;
    border-color: var(--apimo-primary);
    box-shadow: 0 0 0 2px rgba(0, 24, 57, 0.10);
}

.apimo-searchbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--apimo-border);
}

.apimo-btn-primary {
    background: var(--apimo-primary);
    color: #fff;
    border: none;
    padding: 10px 26px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 0;
}
.apimo-btn-primary:hover { background: var(--apimo-primary-soft); }

.apimo-btn-ghost {
    background: transparent;
    color: var(--apimo-muted);
    border: 1px solid var(--apimo-border);
    padding: 10px 22px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 0;
}
.apimo-btn-ghost:hover {
    background: var(--apimo-bg-soft);
    color: var(--apimo-text);
}

.apimo-btn-toggle-map {
    background: var(--apimo-primary);
    color: #fff;
    border: 1px solid var(--apimo-primary);
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 0;
    transition: background 0.15s;
}
.apimo-btn-toggle-map:hover { background: var(--apimo-primary-soft); border-color: var(--apimo-primary-soft); }
.apimo-btn-toggle-map[aria-pressed="true"] {
    background: var(--apimo-accent);
    border-color: var(--apimo-accent);
    color: #fff;
}
.apimo-btn-toggle-map[aria-pressed="true"]:hover { background: #c00510; }
.apimo-toggle-svg { display: block; flex: 0 0 16px; }

.apimo-count-wrap {
    margin-left: auto;
    font-size: 14px;
    color: var(--apimo-muted);
}
.apimo-count-wrap #apimo-count {
    color: var(--apimo-primary);
    font-weight: 700;
}

/* Layout principal --------------------------------------- */
.apimo-main { display: block; }
.apimo-main--with-map {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.apimo-list { min-width: 0; }

.apimo-map-side {
    position: sticky;
    top: 20px;
    height: calc(100vh - 60px);
    min-height: 560px;
    overflow: hidden;
    box-shadow: var(--apimo-shadow);
    border-radius: 0;
}
#apimo-map { width: 100%; height: 100%; }

/* Bouton "me localiser" sur la map */
.apimo-locate-btn {
    position: absolute;
    bottom: 24px;
    right: 14px;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 1px solid var(--apimo-border);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    font-size: 18px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: background 0.15s;
}
.apimo-locate-btn:hover { background: var(--apimo-bg-soft); }

/* Grille de cartes (cards x1.5 = 3 colonnes par défaut) - */
.apimo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}
.apimo-main--with-map .apimo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1100px) {
    .apimo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .apimo-main--with-map .apimo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .apimo-main--with-map { grid-template-columns: 1fr; }
    .apimo-map-side { position: relative; height: 400px; top: 0; }
    .apimo-grid,
    .apimo-main--with-map .apimo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 520px) {
    .apimo-grid,
    .apimo-main--with-map .apimo-grid { grid-template-columns: 1fr; }
}

/* Card ---------------------------------------------------- */
.apimo-card {
    background: #fff;
    overflow: hidden;
    box-shadow: var(--apimo-shadow);
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 0;
}
.apimo-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--apimo-shadow-hover);
}

.apimo-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eef0f3;
}
.apimo-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
    border-radius: 0;
}
.apimo-card:hover .apimo-card-media img { transform: scale(1.04); }

.apimo-card-noimg {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8;
    font-size: 14px;
}

/* Badges -------------------------------------------------- */
.apimo-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    border-radius: 0;
}
.apimo-badge-excl { background: var(--apimo-accent); }
.apimo-badge-offer { background: #f59e0b; left: auto; right: 12px; }
.apimo-badge-compromis { background: #6366f1; left: auto; right: 12px; }
.apimo-badge-sold {
    background: rgba(0, 0, 0, 0.82);
    top: auto;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    padding: 7px 20px;
}

/* Card body ---------------------------------------------- */
.apimo-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.apimo-card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--apimo-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apimo-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 14px;
    color: var(--apimo-muted);
}
.apimo-card-meta span:not(:last-child)::after {
    content: "·";
    margin-left: 10px;
    color: #cbd5e1;
}

/* Card features avec icônes ----------------------------- */
.apimo-card-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 14px;
    color: var(--apimo-muted);
}
.apimo-card-features li {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
}
.apimo-card-features svg {
    width: 16px;
    height: 16px;
    fill: var(--apimo-primary);
    flex: 0 0 16px;
    opacity: 0.85;
}
.apimo-card-features span { font-size: 13px; }

.apimo-card-price {
    margin-top: auto;
    padding-top: 10px;
    font-size: 21px;
    font-weight: 700;
    color: var(--apimo-accent);
}

/* Cartes vendues ----------------------------------------- */
.apimo-card-sold {
    cursor: default;
}
.apimo-card-sold:hover {
    transform: none;
    box-shadow: var(--apimo-shadow);
}
.apimo-card-sold .apimo-card-media img { filter: grayscale(20%) brightness(0.95); }
.apimo-card-sold:hover .apimo-card-media img { transform: none; }
.apimo-card-sold .apimo-card-price { display: none; }

/* Empty / Charger plus ----------------------------------- */
.apimo-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--apimo-muted);
    padding: 40px 20px;
    background: var(--apimo-bg-soft);
}

.apimo-loadmore-wrap {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}
.apimo-btn-loadmore {
    background: transparent;
    color: var(--apimo-primary);
    border: 1px solid var(--apimo-primary);
    padding: 12px 36px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 400;
    transition: all 0.15s;
    border-radius: 0;
}
.apimo-btn-loadmore strong { font-weight: 700; }
.apimo-btn-loadmore:hover { background: var(--apimo-primary); color: #fff; }

/* Marker prix sur la map -------------------------------- */
.apimo-price-marker-wrap {
    background: transparent !important;
    border: none !important;
}
.apimo-price-marker {
    background: var(--apimo-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 16px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    border: 2px solid #fff;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    position: relative;
}
.apimo-price-marker:hover {
    background: var(--apimo-accent);
    transform: scale(1.06);
}
.apimo-price-marker::after {
    content: "";
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid #fff;
}

/* Marker cluster par ville ------------------------------ */
.apimo-cluster-marker-wrap {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}
.apimo-cluster-marker {
    background: var(--apimo-primary);
    color: #fff;
    font-weight: 700;
    text-align: center;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(0, 24, 57, 0.35);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    position: relative;
    z-index: 2;
}
.apimo-cluster-marker:hover {
    background: var(--apimo-accent);
    transform: scale(1.08);
}
.apimo-cluster-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    background: #fff;
    color: var(--apimo-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    pointer-events: none;
    z-index: 1;
}

/* Marker utilisateur ------------------------------------ */
.apimo-user-marker-wrap {
    background: transparent !important;
    border: none !important;
}
.apimo-user-marker {
    width: 22px;
    height: 22px;
    background: #1a73e8;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.5);
    position: relative;
}
.apimo-user-pulse {
    position: absolute;
    top: -6px; left: -6px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(26, 115, 232, 0.35);
    animation: apimo-pulse 1.8s ease-out infinite;
}
@keyframes apimo-pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* Popup leaflet stylée ---------------------------------- */
.leaflet-popup-content-wrapper {
    border-radius: 0 !important;
    padding: 0 !important;
}
.leaflet-popup-tip { border-radius: 0 !important; }
.leaflet-popup-content {
    margin: 0 !important;
    width: 260px !important;
}
.apimo-popup img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.apimo-popup-body { padding: 12px 14px 14px; }
.apimo-popup-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--apimo-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}
.apimo-popup-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--apimo-accent);
    margin-bottom: 10px;
}
.apimo-popup-link {
    display: inline-block;
    color: var(--apimo-primary);
    font-size: 13px;
    font-weight: 600;
}

/* =========================================================
   PAGE DÉTAIL D'UN BIEN
   ========================================================= */
.apimo-detail {
    max-width: 1280px;
    margin: 0 auto;
    padding: 30px 16px 60px;
}

.apimo-detail-h1 {
    font-size: 28px;
    font-weight: 300;
    color: var(--apimo-primary);
    margin: 0 0 20px;
    letter-spacing: 0.3px;
}

/* ======= Carrousel ======================================= */
.apimo-carousel {
    margin-bottom: 30px;
}

.apimo-carousel-main {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #000;
    overflow: hidden;
    border-radius: 0;
}

.apimo-carousel-stage {
    position: relative;
    width: 100%;
    height: 100%;
}

.apimo-carousel-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 0;
}
.apimo-carousel-img.is-active { opacity: 1; }

.apimo-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    transition: background 0.15s;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.apimo-carousel-nav:hover { background: rgba(0, 0, 0, 0.85); }
.apimo-carousel-prev { left: 0; }
.apimo-carousel-next { right: 0; }

.apimo-carousel-counter {
    position: absolute;
    bottom: 14px;
    right: 14px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    z-index: 5;
}

.apimo-carousel-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.apimo-carousel-thumbs::-webkit-scrollbar { height: 6px; }
.apimo-carousel-thumbs::-webkit-scrollbar-thumb { background: #cbd5e1; }

.apimo-carousel-thumb {
    flex: 0 0 110px;
    height: 78px;
    padding: 0;
    border: 2px solid transparent;
    background: none;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, opacity 0.15s;
    opacity: 0.7;
    border-radius: 0;
}
.apimo-carousel-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}
.apimo-carousel-thumb:hover { opacity: 1; }
.apimo-carousel-thumb.is-active {
    opacity: 1;
    border-color: var(--apimo-accent);
}

/* ======= Layout détail (main + aside) ===================== */
.apimo-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 30px;
    align-items: start;
}

.apimo-detail-main { min-width: 0; }

.apimo-detail-h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--apimo-primary);
    margin: 0 0 14px;
    text-transform: capitalize;
}

.apimo-detail-specs {
    display: flex;
    gap: 28px;
    background: var(--apimo-bg-soft);
    padding: 18px 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    align-items: baseline;
    border-radius: 0;
}
.apimo-detail-specs > div {
    font-size: 14px;
    color: var(--apimo-primary);
}
.apimo-detail-specs strong {
    font-size: 22px;
    font-weight: 700;
    color: var(--apimo-primary);
    margin-right: 4px;
}
.apimo-detail-specs span {
    font-weight: 400;
    color: var(--apimo-muted);
    font-size: 14px;
}
.apimo-detail-specs-price strong {
    color: var(--apimo-accent) !important;
}

.apimo-detail-h3 {
    font-size: 19px;
    font-weight: 700;
    color: var(--apimo-primary);
    margin: 24px 0 14px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.apimo-detail-h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--apimo-primary);
    margin: 32px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--apimo-accent);
    display: inline-block;
}

.apimo-detail-description {
    line-height: 1.7;
    color: #333;
    margin-bottom: 32px;
}
.apimo-detail-description p { margin: 0 0 12px; }
.apimo-detail-price-line strong { color: var(--apimo-accent); }

.apimo-detail-blocks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 32px;
}
.apimo-detail-block {
    background: var(--apimo-bg-soft);
    padding: 22px;
    border-radius: 0;
}
.apimo-detail-block h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--apimo-primary);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--apimo-accent);
    display: inline-block;
}
.apimo-detail-block p { margin: 6px 0; font-size: 14px; }

.apimo-detail-map {
    height: 380px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: var(--apimo-shadow);
    border-radius: 0;
}

/* ======= Aside agent ====================================== */
.apimo-detail-aside {
    position: sticky;
    top: 20px;
}

.apimo-agent-card {
    background: #fff;
    border: 1px solid var(--apimo-border);
    padding: 22px;
    text-align: center;
    box-shadow: var(--apimo-shadow);
    border-radius: 0;
}
.apimo-agent-photo {
    width: 96px;
    height: 96px;
    object-fit: cover;
    margin: 0 auto 12px;
    display: block;
    border-radius: 0;
}
.apimo-agent-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--apimo-primary);
    margin-bottom: 4px;
}
.apimo-agent-role {
    font-size: 12px;
    color: var(--apimo-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}
.apimo-agent-phone {
    display: inline-block;
    color: var(--apimo-primary);
    font-weight: 600;
    font-size: 15px;
    padding: 8px 18px;
    border: 1px solid var(--apimo-primary);
    transition: all 0.15s;
    border-radius: 0;
}
.apimo-agent-phone:hover {
    background: var(--apimo-primary);
    color: #fff !important;
}

.apimo-detail-ref {
    margin-top: 16px;
    padding: 10px 16px;
    background: var(--apimo-bg-soft);
    color: var(--apimo-muted);
    font-size: 13px;
    text-align: center;
    letter-spacing: 0.5px;
    border-radius: 0;
}

/* Responsive --------------------------------------------- */
@media (max-width: 900px) {
    .apimo-detail-grid {
        grid-template-columns: 1fr;
    }
    .apimo-detail-aside { position: relative; top: 0; }
    .apimo-detail-blocks { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .apimo-detail-h1 { font-size: 22px; }
    .apimo-carousel-main { aspect-ratio: 4 / 3; }
    .apimo-carousel-thumb { flex: 0 0 84px; height: 60px; }
    .apimo-carousel-nav { width: 40px; height: 40px; font-size: 22px; }
    .apimo-detail-specs strong { font-size: 18px; }
}
