/* ==========================================================================
   LB-MAP — Google Map branding for /rivenditori/
   Pairs with maps.php v2 (styled basemap, teal pins, modern clusters)
   ========================================================================== */

/* ---- map container ---- */
.map-container {
    border: 1px solid #E2E8E8;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(10,51,50,.10);
    background: #F6F7F8;
}

/* ---- zoom / fullscreen controls (custom styled) ---- */
.lb-map-ctl {
    position: absolute;
    right: 12px; top: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lb-map-ctl button {
    width: 38px; height: 38px;
    border: 1px solid #E2E8E8;
    border-radius: 8px;
    background: #FFFFFF;
    color: #0B4B4A;
    font-size: 19px;
    font-weight: 600;
    font-family: Roboto, Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(10,51,50,.10);
    transition: all .25s cubic-bezier(.4,0,.2,1);
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.lb-map-ctl button:hover {
    background: #0B4B4A;
    color: #FFFFFF;
    border-color: #0B4B4A;
}

/* ---- map attribution ---- */
#map-main .gm-style-cc, .gm-style .gm-style-cc a { font-family: Roboto, Arial, sans-serif !important; }

/* ---- InfoBox popup card ---- */
.map-popup-wrap { width: 280px; }
.map-popup {
    background: #FFFFFF !important;
    border: 1px solid #E2E8E8 !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 60px rgba(10,51,50,.18) !important;
    overflow: hidden;
    font-family: Roboto, Arial, sans-serif !important;
}
.map-popup .infoBox-close {
    position: absolute; top: 8px; right: 10px;
    color: #98A7A5; font-size: 15px; z-index: 3;
    cursor: pointer; background: rgba(255,255,255,.9);
    border-radius: 50%; width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
}
.map-popup .infoBox-close:hover { color: #0A3332; }

.map-popup-category {
    display: inline-block;
    background: rgba(11,75,74,.08);
    color: #0B4B4A;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    border-radius: 50px;
    padding: 4px 12px;
    margin: 12px 12px 0;
}

.map-popup .listing-img-content img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
}

.map-popup .listing-content { padding: 12px 14px 14px; }
.map-popup .listing-title h4 { margin: 0 0 6px; font-size: 16px; }
.map-popup .listing-title h4 a {
    color: #0A3332 !important;
    font-weight: 700;
    letter-spacing: -.01em;
    text-decoration: none;
}
.map-popup .listing-title h4 a:hover { color: #0B4B4A !important; }

.map-popup .map-popup-location-info,
.map-popup .map-popup-location-phone {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: #6B7E7D; line-height: 1.5;
}
.map-popup .map-popup-location-info i,
.map-popup .map-popup-location-phone i { color: #0B4B4A; font-size: 12px; }

/* ratings stars */
.map-popup .card-popup-raining i { color: #F4B21A; font-size: 11px; }
.map-popup .map-popup-reviews-count { font-size: 11px; color: #98A7A5; margin-left: 6px; }

/* CTA inside popup */
.map-popup .lb-popup-cta {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 10px;
    font-size: 13px; font-weight: 600;
    color: #0B4B4A;
    text-decoration: none;
}
.map-popup .lb-popup-cta:hover { color: #d9980f; }

/* ---- custom marker pin (SVG via maps.php symbol) ---- */
/* pin label for tier badge */
.lb-pin-tier {
    font-family: Roboto, Arial, sans-serif;
    font-size: 10px; font-weight: 700;
}

/* ---- custom cluster ---- */
.lb-cluster {
    background: rgba(11,75,74,.92);
    border-radius: 50%;
    color: #FFFFFF;
    font-family: Roboto, Arial, sans-serif;
    font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(10,51,50,.35);
    border: 2px solid rgba(255,255,255,.85);
    text-align: center;
}
.lb-cluster-small  { width: 44px;  height: 44px; }
.lb-cluster-medium { width: 54px;  height: 54px; font-size: 15px; }
.lb-cluster-large  { width: 64px;  height: 64px; font-size: 16px; background: rgba(6,61,59,.95); }
.lb-cluster::before {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1.5px dashed rgba(244,178,26,.55);
    animation: lbPulse 3s ease-in-out infinite;
}
@keyframes lbPulse {
    0%, 100% { transform: scale(1); opacity: .8; }
    50%      { transform: scale(1.08); opacity: .35; }
}
@media (prefers-reduced-motion: reduce) { .lb-cluster::before { animation: none; } }

/* ---- fit-bounds toast (filter feedback) ---- */
.lb-map-status {
    position: absolute;
    left: 50%; bottom: 18px;
    transform: translateX(-50%);
    background: rgba(6,61,59,.94);
    color: #FFFFFF;
    font-family: Roboto, Arial, sans-serif;
    font-size: 13px; font-weight: 500;
    padding: 8px 18px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(10,51,50,.35);
    z-index: 6;
    display: none;
    align-items: center; gap: 8px;
}
.lb-map-status .lb-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #F4B21A; display: inline-block;
}

/* ==========================================================================
   MAP SEARCH FORM — anchored bottom of map, floating panel
   ========================================================================== */

.home-map { position: relative; }

.absolute-main-search-input {
    position: static !important;
    z-index: 7;
    pointer-events: auto;
}
.absolute-main-search-input .container { pointer-events: none; }

.main-search-input {
    pointer-events: auto;
    display: flex !important;
    align-items: stretch;
    gap: 10px;
    width: min(880px, calc(100% - 32px)) !important;
    margin: 0 auto !important;         /* centered, no negative offsets */
    padding: 12px !important;
    background: rgba(255, 255, 255, .97) !important;
    backdrop-filter: blur(10px);
    border: 1px solid #E2E8E8 !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 60px rgba(10, 51, 50, .22) !important;
}

.main-search-input .main-search-input-item,
.main-search-input .listsearch-input-item {
    flex: 1 1 0;
    min-width: 0;
    float: none !important;
    width: auto !important;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
}

/* selects inside the bar */
.main-search-input .chosen-container,
.main-search-input select {
    width: 100% !important;
}
.main-search-input .chosen-container-single .chosen-single {
    background: #F6F7F8 !important;
    border: 1px solid #E2E8E8 !important;
    border-radius: 8px !important;
    height: auto !important;
    line-height: normal !important;
    padding: 10px 14px !important;
    color: #0A3332 !important;
    font-family: Roboto, Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: none !important;
}
.main-search-input .chosen-container-single .chosen-single div b {
    background-position: 0 6px !important;
}

/* search button in the bar */
.main-search-input .main-search-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 26px !important;
    border: none !important;
    border-radius: 8px !important;
    background: #F4B21A !important;
    color: #0A3332 !important;
    font-family: Roboto, Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all .25s cubic-bezier(.4, 0, .2, 1);
    text-transform: none !important;
    letter-spacing: 0 !important;
}
.main-search-input .main-search-button:hover {
    background: #d9980f !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(244, 178, 26, .4);
}

/* status pill moves up to clear the search bar */
.lb-map-status { bottom: 96px; }

/* responsive: stack into 2 rows on tablet, full stack on mobile */
@media (max-width: 1024px) {
    .main-search-input { flex-wrap: wrap; }
    .main-search-input .main-search-input-item,
    .main-search-input .listsearch-input-item { flex: 1 1 45%; }
    .main-search-input .main-search-button { flex: 1 1 100%; padding: 12px !important; }
}
@media (max-width: 640px) {
    .main-search-input .main-search-input-item,
    .main-search-input .listsearch-input-item { flex: 1 1 100%; }
}

/* ==========================================================================
   13. SEARCH BAR ANCHOR FIX — override ALL legacy positioning (style.css lines 1032+6573)
   Legacy: position absolute, left:50%, margin-left:-450px, width:900px → left-clipped
   ========================================================================== */

.absolute-main-search-input {
    position: static !important;      /* dedicated strip BELOW the map, in flow */
    left: auto; right: auto;
    margin-left: 0 !important;
    width: 100% !important;
    z-index: 1200 !important;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8E8;
    padding: 14px 0;
    pointer-events: auto;
}

.absolute-main-search-input .container {
    max-width: 960px !important;
    margin: 0 auto !important;
    padding: 0 16px;
}

.absolute-main-search-input .main-search-input {
    margin: 0 auto !important;
    margin-top: 0 !important;
    padding: 12px !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 60px rgba(10, 51, 50, .22) !important;
    float: none !important;
}

/* chosen dropdown must render ABOVE/inside map, not push below */
.main-search-input .chosen-container .chosen-drop {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    width: 100% !important;
    margin-top: 0 !important;
    border: 1px solid #E2E8E8;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(10, 51, 50, .18);
    overflow: hidden;
    background: #FFFFFF;
    z-index: 1100 !important;   /* above map panes and controls */
}
.main-search-input .chosen-container.chosen-with-drop .chosen-drop { display: block; clip: auto; }
.main-search-input .chosen-container .chosen-results {
    max-height: 220px !important;
    padding: 6px;
}
.main-search-input .chosen-container .chosen-results li {
    padding: 10px 14px !important;
    font-size: 14px;
    font-family: Roboto, Arial, sans-serif;
    color: #0A3332;
    border-radius: 6px;
}
.main-search-input .chosen-container .chosen-results li:hover { background: #F6F7F8; }
.main-search-input .chosen-container .chosen-results li.highlighted {
    background: #0B4B4A !important;
    color: #FFFFFF !important;
}
.main-search-input .chosen-container .chosen-results li.no-results { color: #98A7A5; }

/* keep the whole bar above map attribution */
.main-search-input { position: relative; z-index: 10; }

/* map container must not clip children dropdowns */
.map-container, .home-map { overflow: visible; }
#map-main { overflow: hidden; border-radius: 12px; }

@media (max-width: 1024px) {
    .absolute-main-search-input {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* chosen container itself must be above the map too */
.main-search-input .chosen-container { z-index: 1200 !important; }
.main-search-input .chosen-container.chosen-with-drop { z-index: 1250 !important; }

/* map zoom ctl stays below dropdown layer */
.lb-map-ctl { z-index: 900; }

/* ensure infoBox (popups) also sit above */
.infoBox { z-index: 1000 !important; }

/* cluster centering: draw() anchors top-left at pixel minus half size via anchorIcon;
   our DOM circle uses fixed size classes; ensure exact centering */
.lb-cluster {
    position: absolute;
    transform: none;
    box-sizing: border-box;
}

/* ==========================================================================
   14. SEARCH BAR LAYOUT + DROPDOWN ESCAPE FIXES
   ========================================================================== */

/* button: legacy absolute right:0/top:0 with 30px pill radius — kill it, flex child instead */
.main-search-input .main-search-button {
    position: static !important;
    flex: 0 0 auto;
    height: auto !important;
    width: auto !important;
    top: auto !important;
    right: auto !important;
    border-radius: 8px !important;
    margin: 0 !important;
    white-space: nowrap;
}

/* selects may shrink; prevent button from wrapping to a new row at desktop widths */
@media (min-width: 1025px) {
    .absolute-main-search-input .main-search-input { flex-wrap: nowrap !important; }
    .absolute-main-search-input .main-search-input-item,
    .absolute-main-search-input .listsearch-input-item { min-width: 130px; }
}

/* --- dropdown escaping the map into next section --- */
/* the map's ancestor section creates a stacking context that clips/ordering breaks;
   anchor chosen-drop INSIDE the map viewport but above everything */
.home-map { position: relative; }
.map-container { position: relative; }

/* force chosen drop above map and section content */
.absolute-main-search-input {
    z-index: 1300 !important;
}
.main-search-input .chosen-container { position: relative; }
.main-search-input .chosen-container.chosen-container-single .chosen-drop {
    position: absolute;
    top: 100%;
    margin-top: 6px;
    border: 1px solid #E2E8E8;
    border-radius: 10px;
    background: #FFFFFF;
    box-shadow: 0 16px 48px rgba(10, 51, 50, .22);
    z-index: 1350;
    clip: auto !important;
    opacity: 1;
    visibility: visible;
}

/* chosen default: drop hidden via clip until open — our override shows only when open */
.main-search-input .chosen-container:not(.chosen-with-drop) .chosen-drop {
    clip: rect(0, 0, 0, 0) !important;
    opacity: 0;
    visibility: hidden;
}
.main-search-input .chosen-container.chosen-with-drop .chosen-drop {
    clip: auto !important;
    opacity: 1;
    visibility: visible;
    transition: opacity .18s ease;
}

/* ensure nothing in the map container creates a lower-than-dropdown stacking order */
#map-main { z-index: 1; }
.home-map .gm-style { z-index: 0; }

/* NICE-SELECT (actual widget): scripts.js calls $('.chosen-select').niceSelect(),
   so the real dropdown is .nice-select .list. Bar now sits at TOP of map,
   so dropdowns open DOWNWARD naturally — no clipping, no escape.
   Scoped to .main-search-input (map page) ONLY — rivenditori_software.php uses
   .listsearch-input-wrap whose selects must open DOWNWARD, not up over the header. */
.main-search-input .nice-select .list {
    top: auto !important;
    bottom: calc(100% + 6px) !important;   /* strip is BELOW map: open UP over map */
    border-radius: 10px !important;
    border: 1px solid #E2E8E8 !important;
    box-shadow: 0 16px 48px rgba(10, 51, 50, .22) !important;
    z-index: 1350 !important;
    padding: 6px 0 !important;   /* kill plugins.css 52px top-padding legacy hack */
}
/* rivenditori_software.php (legacy split layout): dropdowns open DOWNWARD
   below their select, styled consistently */
.listsearch-input-wrap .nice-select .list {
    top: calc(100% + 6px) !important;
    bottom: auto !important;
    border-radius: 10px !important;
    border: 1px solid #E2E8E8 !important;
    box-shadow: 0 16px 48px rgba(10, 51, 50, .22) !important;
    z-index: 1350 !important;
    padding: 6px 0 !important;
    max-height: 320px;
    overflow-y: auto;
}

/* keep the little arrow pointing up visually consistent */
.main-search-input .nice-select:after { z-index: 1360; }

/* NATIVE SELECTS on the map strip (niceSelect disabled for .absolute-main-search-input
   in scripts.js): OS-level picker overlays the page, covers no layout, best on mobile. */
.absolute-main-search-input select.chosen-select {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 48px;
    padding: 0 40px 0 16px;
    border: 1px solid #E2E8E8;
    border-radius: 10px;
    background: #FFFFFF url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230B4B4A' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center !important;
    font-family: Roboto, Arial, sans-serif;
    font-size: 14px;
    color: #0A3332;
    cursor: pointer;
    outline: none;
}
.absolute-main-search-input select.chosen-select:focus {
    border-color: #0B4B4A;
    box-shadow: 0 0 0 3px rgba(11, 75, 74, .12);
}

/* DROPDOWNS open upward (strip sits below the map) */
.main-search-input .chosen-container.chosen-container-single.chosen-with-drop .chosen-drop {
    top: auto !important;
    bottom: calc(100% + 6px) !important;
}
