:root{
    --mobile-bottom-nav-height: 0px;
    --header-height: 0px;
    --map-side-gap: 12px;
}

.custom-marker-icon {
    background: transparent;
    border: 0;
}

#mainMap {
    width: 100%;
    height: 100dvh;
    z-index: 1;
    background: #f6f8fb;
}

/* =======================
   Marker
======================= */
.marker-card {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    min-width: 90px;
    max-width: 220px;
    background: rgba(255,255,255,0.97);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    white-space: nowrap;
}

.marker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
    border-color: rgba(13, 110, 253, 0.22);
}

.marker-card::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 10px;
    height: 10px;
    background: inherit;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    transform: translateX(-50%) rotate(45deg);
    border-bottom-right-radius: 2px;
}

.marker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0d6efd;
    flex: 0 0 auto;
}

.marker-content {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.marker-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

.marker-rating {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.10);
    border-radius: 999px;
    padding: 3px 7px;
    line-height: 1.2;
}

.marker-plan-1 {
    background: linear-gradient(135deg, #0d6efd, #2563eb);
    border-color: rgba(13,110,253,0.35);
    box-shadow: 0 10px 24px rgba(13,110,253,0.22);
}

.marker-plan-1 .marker-dot {
    background: #ffffff;
}

.marker-plan-1 .marker-title {
    color: #ffffff;
}

.marker-plan-1 .marker-rating {
    color: #ffffff;
    background: rgba(255,255,255,0.18);
}

.marker-plan-2 {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 10px 24px rgba(245, 158, 11, 0.22);
}

.marker-plan-2 .marker-dot {
    background: #111827;
}

.marker-plan-2 .marker-title {
    color: #111827;
}

.marker-plan-2 .marker-rating {
    color: #111827;
    background: rgba(255,255,255,0.36);
}

/* =======================
   Cluster
======================= */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large,
.marker-cluster {
    background: transparent;
}

.marker-cluster div {
    width: 46px !important;
    height: 46px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    background: radial-gradient(circle at 30% 30%, #3b82f6, #0d6efd 60%, #1d4ed8);
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow:
            0 10px 22px rgba(13, 110, 253, 0.28),
            0 0 0 6px rgba(13, 110, 253, 0.10);
}

/* =======================
   Minimal Header / Filter Bar
======================= */
.map-filter-bar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 1000;
    border-radius: 14px;
    background: rgba(255,255,255,0.84);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.map-filter-bar .card-body {
    padding: 10px;
}

.map-filter-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.map-filter-inline .form-select,
.map-filter-inline .btn,
.map-filter-inline .app-btn {
    height: 40px;
    border-radius: 10px;
}

.map-filter-inline .form-select {
    min-width: 0;
    border: 1px solid #e8edf3;
    background: rgba(248,250,252,0.92);
    box-shadow: none;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.map-filter-inline .form-select:focus {
    border-color: rgba(13,110,253,0.3);
    background: #fff;
    box-shadow: 0 0 0 0.18rem rgba(13,110,253,0.10);
}

.map-filter-inline .filter-city {
    flex: 1 1 160px;
}

.map-filter-inline .filter-category {
    flex: 1 1 160px;
}

.map-filter-inline .filter-action {
    flex: 0 0 120px;
}

/* =======================
   Locate button
======================= */
.locate-me-btn {
    position: absolute;
    left: 16px;
    bottom: 24px;
    z-index: 1000;
    border: 0;
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.94);
    color: #0d6efd;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    font-weight: 700;
    transition: all 0.25s ease;
}

.locate-me-btn:hover {
    transform: translateY(-2px);
    background: #fff;
}

.locate-me-btn:active {
    transform: scale(0.98);
}

.locate-me-btn .icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(13,110,253,0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d6efd;
    flex-shrink: 0;
}

.locate-me-btn.loading {
    pointer-events: none;
    opacity: 0.85;
}

.locate-me-btn.loading .icon-wrap {
    animation: pulseLocate 1s infinite;
}

@keyframes pulseLocate {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(13,110,253,0.22); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(13,110,253,0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(13,110,253,0); }
}

.user-location-pulse {
    width: 22px;
    height: 22px;
    background: rgba(13,110,253,0.18);
    border: 2px solid rgba(13,110,253,0.34);
    border-radius: 50%;
    animation: userPulse 1.8s infinite ease-out;
}

@keyframes userPulse {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }
    100% {
        transform: scale(2.6);
        opacity: 0;
    }
}

/* =======================
   Offcanvas custom behavior
======================= */
#businessOffcanvas {
    z-index: 1060;
}

#businessOffcanvas .offcanvas-header {
    padding: 12px 14px;
}

#businessOffcanvas .offcanvas-body {
    padding: 14px;
}

.business-offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.business-meta {
    min-width: 0;
}

.business-meta .offcanvas-title {
    font-size: 14px;
    margin: 0;
    color: #0f172a;
    font-weight: 800;
}

.business-name-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.business-name-line h4 {
    margin: 0;
    font-size: 18px;
    color: #0d6efd;
    font-weight: 800;
    word-break: break-word;
}

.business-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}


/* دسکتاپ */
@media (min-width: 992px) {
    /* محدود کردن عرض هدر در دسکتاپ و قرار دادن در مرکز */
    .map-filter-bar {
        max-width: 700px;
        margin: 0 auto;
    }

    /* آفکانواس از پایین باز شود اما عرض مشخص داشته باشد و در مرکز باشد */
    #businessOffcanvas.offcanvas-bottom {
        max-width: 450px;
        margin: 0 auto;
        left: 0;
        right: 0;
        height: auto !important;
        max-height: 60vh;
        border: 0;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.15);
    }
}

/* موبایل */
@media (max-width: 991.98px) {
    .map-filter-bar {
        top: 10px;
        left: 10px;
        right: 10px;
        border-radius: 12px;
    }

    .map-filter-inline {
        gap: 6px;
    }

    .map-filter-inline .filter-city,
    .map-filter-inline .filter-category {
        flex: 1 1 0;
    }

    .map-filter-inline .filter-action {
        flex: 0 0 auto;
    }

    .map-filter-inline .app-btn {
        padding-inline: 12px;
        min-width: 92px;
    }

    #businessOffcanvas.offcanvas-bottom {
        height: auto !important;
        max-height: min(56vh, calc(100dvh - var(--mobile-bottom-nav-height) - 16px)) !important;
        bottom: calc(var(--mobile-bottom-nav-height) + 8px);
        left: 8px;
        right: 8px;
        width: auto;
        border: 0;
        border-radius: 18px 18px 18px 18px;
        box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    }

    .locate-me-btn {
        left: 12px;
        bottom: 16px;
        padding: 9px 12px;
        border-radius: 14px;
    }

    .locate-me-btn .btn-text {
        font-size: 13px;
    }

    .marker-card {
        min-height: 36px;
        padding: 0 10px;
        max-width: 170px;
    }

    .marker-title {
        max-width: 110px;
        font-size: 11px;
    }

    .marker-rating {
        font-size: 9px;
        padding: 2px 6px;
    }

    .marker-cluster div {
        width: 42px !important;
        height: 42px !important;
        font-size: 12px;
    }
}

@media (max-width: 575.98px) {
    .map-filter-inline {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .map-filter-inline::-webkit-scrollbar {
        display: none;
    }

    .map-filter-inline .filter-city {
        min-width: 120px;
    }

    .map-filter-inline .filter-category {
        min-width: 120px;
    }

    .map-filter-inline .filter-action {
        min-width: 96px;
    }
}