/* ============================================
   Previo Map Sidebar – Layout & Styles
   Aktywny motyw: motyw-nr-2 (jasny, błękit/beż)
   ============================================ */

/* Padding wyszukiwarki (jest poza .pmsb-layout) */
.pase-grid-filter-wrap {
    padding: 0 24px;
    padding-top: 12px;
}

/* ---------- Wrapper flex: grid + mapa ---------- */
.pmsb-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding: 0 24px;
}

.pmsb-layout .pase-grid-wrapper {
    flex: 1;
    min-width: 0;
}

/* Siatka 3 kolumny obok mapy */
.pmsb-layout .pase-grid {
    grid-template-columns: repeat(3, 1fr) !important;
}
@media (max-width: 1400px) {
    .pmsb-layout .pase-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 991px) {
    .pmsb-layout .pase-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 575px) {
    .pmsb-layout .pase-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Wyszukiwarka: 2 kolumny zamiast 3 (date fields merged) */
.pmsb-layout .pase-grid-filter-row {
    flex-wrap: wrap;
}
.pmsb-layout .pase-grid-filter-field {
    min-width: 140px;
}

/* ---------- Sidebar z mapą ---------- */
#pmsb-map-sidebar {
    position: sticky;
    top: 162px; /* 150px menu + 12px gap */
    width: 420px;
    min-width: 320px;
    flex-shrink: 0;
    border-radius: 0 !important;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .10);
    background: #F4EFE8;
    border: 1px solid #967e3c;
    max-height: calc(100vh - 174px); /* 150px menu + 12px top + 12px bottom */
}

#pmsb-map-canvas {
    width: 100%;
    height: calc(100vh - 174px); /* 150px menu + paddingi */
}

/* Leaflet: wymuś brak zaokrągleń */
#pmsb-map-sidebar .leaflet-container {
    border-radius: 0 !important;
}

/* ---------- Marker & popup ---------- */
.pmsb-marker-icon {
    background: none;
    border: none;
}

.pmsb-marker-pin {
    width: 30px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: transform .2s ease, filter .2s ease;
}

.pmsb-marker-pin svg {
    width: 30px;
    height: 40px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
    transition: filter .2s ease;
}

.pmsb-marker-pin.is-active svg,
.pmsb-marker-pin:hover svg {
    filter: drop-shadow(0 3px 8px rgba(150, 126, 60, .6));
    transform: scale(1.2);
}

/* Leaflet popup */
.pmsb-popup .leaflet-popup-content-wrapper {
    border-radius: 0;
    font-family: "Montserrat", sans-serif;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.pmsb-popup .leaflet-popup-content {
    margin: 10px 14px;
    font-size: 12px;
    line-height: 1.4;
}
.pmsb-popup .leaflet-popup-tip {
    box-shadow: 0 4px 10px rgba(0,0,0,.12);
}

.pmsb-popup-title {
    font-size: 13px;
    font-weight: 700;
    color: #2f2f2f;
    margin: 0 0 2px 0;
    font-family: "Playfair Display", serif;
}

/* ---------- Multi-pin: licznik na pinezce ---------- */
.pmsb-marker-multi {
    position: relative;
}
.pmsb-marker-count {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Montserrat", sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    pointer-events: none;
}

/* ---------- Multi-pin popup: lista apartamentów ---------- */
.pmsb-popup-multi-wrap .leaflet-popup-content {
    margin: 12px 14px;
}
.pmsb-popup-multi-title {
    font-family: "Montserrat", sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #967e3c;
    margin: 0 0 6px 0;
}
.pmsb-popup-multi-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 45vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.pmsb-popup-multi-list::-webkit-scrollbar {
    width: 5px;
}
.pmsb-popup-multi-list::-webkit-scrollbar-track {
    background: transparent;
}
.pmsb-popup-multi-list::-webkit-scrollbar-thumb {
    background: #d4c9a8;
    border-radius: 3px;
}
.pmsb-popup-multi-list::-webkit-scrollbar-thumb:hover {
    background: #967e3c;
}
.pmsb-popup-multi-item {
    font-family: "Playfair Display", serif;
    font-size: 13px;
    font-weight: 600;
    color: #2f2f2f;
    padding: 5px 0;
    border-bottom: 1px solid #e5ce86;
    cursor: pointer;
    transition: color .15s ease;
}
.pmsb-popup-multi-item:last-child {
    border-bottom: none;
}
.pmsb-popup-multi-item:hover {
    color: #967e3c;
}

/* ---------- Karta apartamentu – podświetlenie ---------- */
.pase-card.pmsb-highlight {
    outline: 3px solid #967e3c !important;
    outline-offset: -3px !important;
    box-shadow: 0 0 20px rgba(150, 126, 60, .35) !important;
    transition: outline .25s ease, box-shadow .25s ease;
}
.pase-card {
    transition: outline .25s ease, box-shadow .25s ease;
}

/* ---------- Przycisk toggle mapy (mobile) ---------- */
.pmsb-toggle-btn {
    display: none;
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9999;
    width: 54px;
    height: 54px;
    border-radius: 0;
    background: #967e3c;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.20);
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background .2s ease;
}
.pmsb-toggle-btn:hover {
    background: #7d6932;
}
.pmsb-toggle-btn svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    fill: none;
    stroke-width: 1.8;
}

/* ---------- Mobile overlay mapy ---------- */
.pmsb-map-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 99998;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.pmsb-map-overlay.is-open {
    display: flex;
}
.pmsb-map-overlay-inner {
    width: 100%;
    height: 70vh;
    background: #F4EFE8;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.pmsb-map-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(150, 126, 60, .25);
}
.pmsb-map-overlay-title {
    font-family: "Montserrat", sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: #2f2f2f;
}
.pmsb-map-overlay-close {
    width: 36px;
    height: 36px;
    border-radius: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.pmsb-map-overlay-close:hover {
    background: rgba(0,0,0,.06);
}
.pmsb-map-overlay-close svg {
    width: 18px;
    height: 18px;
    stroke: #2f2f2f;
    fill: none;
    stroke-width: 2;
}
#pmsb-map-canvas-mobile {
    flex: 1;
    width: 100%;
}

/* ---------- Responsywność ---------- */
@media (max-width: 1024px) {
    /* Ukryj desktop sidebar, pokaż przycisk FAB */
    .pmsb-layout {
        flex-direction: column;
    }
    #pmsb-map-sidebar {
        display: none !important;
    }
    .pmsb-toggle-btn {
        display: flex;
    }
    /* Przywróć 2 kolumny na tablecie */
    .pmsb-layout .pase-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 575px) {
    .pmsb-layout .pase-grid {
        grid-template-columns: 1fr !important;
    }
}
