﻿.leaflet-marker-icon.custom-pin {
    position: relative;
}

.custom-pin .inner-icon {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 28px;
    height: 28px;
    pointer-events: none;
}

header.navbar.navbar-sticky {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1030;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

#stickyfilters {
    transition: none !important;
}

/* Google Places PAC */
.pac-container {
    z-index: 5000 !important;
    top: 150px;
}

/* Generic modal plumbing (your custom one, not Bootstrap's) */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    height: 300px;
    padding: 0;
}

.modal-content {
    position: relative;
}

.close {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
}

/* List fade animations */
#businessListContainer {
    transition: opacity 0.5s ease;
}

    #businessListContainer.is-fading-out {
        opacity: 0;
    }

    #businessListContainer.is-fading-in {
        opacity: 1;
    }

/* Filters UI */
.filters-type-dropdown {
    position: relative;
}

    .filters-type-dropdown .dropdown-menu {
        width: 100%;
        min-width: 100% !important;
        box-sizing: border-box;
    }

.type-filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0;
    margin-left: 0;
}

    .type-filter-item .form-check-input {
        position: static;
        margin: 0 !important;
        flex: 0 0 auto;
    }

    /* Ensure the whole icon wrapper is inline and fixed-width */
    .type-filter-item .type-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 1.25rem;
        flex: 0 0 1.25rem;
        line-height: 1;
    }

        /* Whatever the icon library outputs, keep it inline */
        .type-filter-item .type-icon > * {
            display: inline-block !important;
        }

    .type-filter-item .form-check-label {
        margin: 0;
        flex: 1 1 auto;
        white-space: nowrap;
    }

/* --- FIX: keep checkbox + icon + label on ONE line --- */
.filters-type-dropdown .dropdown-menu .type-filter-item {
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding-left: 0;
    margin-left: 0;
}

    /* Bootstrap sets form-check-input { float:left } — remove it */
    .filters-type-dropdown .dropdown-menu .type-filter-item .form-check-input {
        float: none !important;
        margin: 0 !important;
        position: static !important;
        flex: 0 0 auto;
    }

    /* Make the icon column fixed width, regardless of <i> vs <svg> */
    .filters-type-dropdown .dropdown-menu .type-filter-item .type-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 1.25rem;
        flex: 0 0 1.25rem;
        line-height: 1;
    }

        .filters-type-dropdown .dropdown-menu .type-filter-item .type-icon > * {
            display: inline-block !important;
        }

    /* Let label take the remaining space (and prevent flex overflow issues) */
    .filters-type-dropdown .dropdown-menu .type-filter-item .form-check-label {
        margin: 0;
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.chip-remove {
    cursor: pointer;
}

    .chip-remove i {
        pointer-events: none;
    }

/* Marker clusters */
.awesome-marker-cluster-wrapper {
    background: none;
    border: none;
}

.cluster-marker {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .cluster-marker .cluster-count {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -55%);
        color: #fff;
        font-size: 12px;
        font-weight: 700;
        text-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
    }

.custom-cluster-icon {
    border-radius: 50%;
    background: rgba(51, 136, 255, 0.9);
    border: 3px solid #fff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
    color: #fff;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.cluster-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
}

/* Highlight cluster on hover */
.cluster-hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.8);
    z-index: 1000;
}

    .cluster-hover div {
        border: 3px solid red !important;
        border-radius: 50% !important;
    }

.custom-cluster-icon.small {
    background: rgba(0, 153, 255, 0.8);
}

    .custom-cluster-icon.small .cluster-inner {
        font-size: 12px;
    }

.custom-cluster-icon.medium {
    background: rgba(255, 153, 0, 0.8);
}

    .custom-cluster-icon.medium .cluster-inner {
        font-size: 14px;
    }

.custom-cluster-icon.large {
    background: rgba(255, 51, 51, 0.8);
}

    .custom-cluster-icon.large .cluster-inner {
        font-size: 16px;
    }

/* Layout sizing map vs listings (desktop) */
@media (min-width: 992px) {
    main .content-wrapper.d-lg-flex > .d-lg-flex.flex-grow-1 {
        display: flex;
        width: 100%;
    }

    #listingsSection.listings-section {
    flex: 1 1 55%;
    max-width: 55%;

    /* push listings down under fixed navbar */
    padding-top: var(--nav-h) !important;
  }

    main.content-wrapper {
        overflow-x: clip;
    }
}

/* Navbar logo */
.navbar .brand-logo,
.brand-logo {
    height: 56px;
    width: auto;
    display: block;
    transition: height 180ms ease;
}

/* --- Card grid consistency --- */
#businessListContainer .card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#businessListContainer .card-img-top {
    flex: 0 0 auto;
}

/* Cards: use fixed height approach */
:root {
    --card-img-h: 200px;
}

main.content-wrapper {
    padding-top: var(--header-h);
}

@media (min-width: 576px) {
    :root {
        --card-img-h: 190px;
    }
}

@media (min-width: 992px) {
    :root {
        --card-img-h: 210px;
    }
}

#businessListContainer .card-img-top {
    height: var(--card-img-h);
    overflow: hidden;
}

    #businessListContainer .card-img-top img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

#businessListContainer .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

    /* Title clamp */
    #businessListContainer .card-body .h5 {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.2;
        margin-bottom: 0.5rem;
    }

    #businessListContainer .card-body h3 {
        margin-bottom: 0.5rem;
    }

        #businessListContainer .card-body h3 .text-body {
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

    /* Tags clamp */
    #businessListContainer .card-body .fa-sm {
        max-height: 3.1rem;
        overflow: hidden;
        position: relative;
    }

        /* Fade hint that tags are clipped */
        #businessListContainer .card-body .fa-sm::after {
            content: "";
            position: absolute;
            right: 0;
            bottom: 0;
            width: 40%;
            height: 1.2rem;
            pointer-events: none;
            background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--bs-body-bg));
        }

[data-bs-theme="dark"] #businessListContainer .card-body .fa-sm::after {
    background: linear-gradient(to right, rgba(0, 0, 0, 0), var(--bs-body-bg));
}

@media (min-width: 992px) {
    .map-section {
        position: sticky;
        top: var(--nav-h);
        height: calc(100vh - var(--nav-h));
        overflow: hidden;
    }

    #leafletMap {
        height: 100% !important;
    }
}

.marker-hover-popup .leaflet-popup-content-wrapper {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 0.5rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.marker-hover-popup .leaflet-popup-tip {
    background: var(--bs-body-bg);
}

.marker-popup-content {
    min-width: 140px;
    min-height: 40px;
    background-color: white;
    opacity: 80%;
    color: black;
    padding: 5px;
    border: 1px solid black;
    border-radius: 0.5rem;
}

.map-debug-control {
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 12px;
    line-height: 1.25;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    max-width: 380px;
}

    .map-debug-control b {
        font-weight: 700;
    }

/* Sticky filters cd ..must sit below fixed navbar */
#listingsSection #stickyfilters.sticky-top {
    top: var(--nav-h, 84px) !important; /* fallback if var not set */
    z-index: 1020; /* below navbar (1030), above content */
}

/* Optional: ensure it paints over content behind it while stuck */
#listingsSection #stickyfilters {
    background: var(--bs-body-bg);
}

.business-list-loading-bar-track {
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(0,0,0,.12);
}

.business-list-loading-bar-fill {
    height: 100%;
    width: 35%;
    border-radius: 999px;
    background: currentColor; /* inherits text color (nice for theme) */
    animation: loadingBar 1.1s ease-in-out infinite;
    transform-origin: left center;
}

@keyframes loadingBar {
    0% {
        width: 0%;
        transform: none;
    }

    70% {
        width: 100%;
        transform: none;
    }

    100% {
        width: 100%;
        transform: none;
    }
}
