/* Shared Leaflet tile loading progress for every map in the site. */
.leaflet-container {
    position: relative;
}

.melkana-map-loading {
    position: absolute;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: color-mix(in srgb, var(--bs-body-bg, #fff) 94%, transparent);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
}

.melkana-map-loading.is-visible {
    opacity: 1;
    visibility: visible;
}

.melkana-map-loading-card {
    width: min(360px, calc(100% - 1rem));
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .9rem 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--bs-body-bg, #fff) 96%, transparent);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .13);
}

.melkana-map-loading-icon {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: .85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1.2rem;
    color: var(--bs-primary, #0d6efd);
    background: color-mix(in srgb, var(--bs-primary, #0d6efd) 11%, transparent);
}

.melkana-map-loading-content {
    flex: 1 1 auto;
    min-width: 0;
}

.melkana-map-loading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .52rem;
    font-size: .82rem;
}

.melkana-map-loading-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bs-secondary-color, #6c757d);
}

.melkana-map-loading-percent {
    flex: 0 0 auto;
    color: var(--bs-body-color, #212529);
    font-variant-numeric: tabular-nums;
}

.melkana-map-loading-track {
    height: .42rem;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bs-secondary-color, #6c757d) 16%, transparent);
}

.melkana-map-loading-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--bs-primary, #0d6efd);
    transition: width .16s ease;
}

/* After the first render, zoom/pan uses a small non-blocking indicator. */
.melkana-map-loading.is-compact {
    inset: .7rem .7rem auto auto;
    width: min(270px, calc(100% - 1.4rem));
    padding: 0;
    align-items: flex-start;
    justify-content: flex-start;
    background: transparent;
    backdrop-filter: none;
}

.melkana-map-loading.is-compact .melkana-map-loading-card {
    width: 100%;
    padding: .62rem .72rem;
    border-radius: .85rem;
    background: color-mix(in srgb, var(--bs-body-bg, #fff) 92%, transparent);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
}

.melkana-map-loading.is-compact .melkana-map-loading-icon {
    width: 2rem;
    height: 2rem;
    border-radius: .65rem;
    font-size: .95rem;
}

.melkana-map-loading.is-compact .melkana-map-loading-row {
    margin-bottom: .35rem;
    font-size: .73rem;
}

.melkana-map-loading.is-compact .melkana-map-loading-track {
    height: .28rem;
}

.melkana-map-loading.is-error .melkana-map-loading-icon {
    color: var(--bs-warning-text-emphasis, #664d03);
    background: color-mix(in srgb, var(--bs-warning, #ffc107) 18%, transparent);
}

@media (max-width: 575.98px) {
    .melkana-map-loading-card {
        padding: .75rem .8rem;
        border-radius: .9rem;
    }

    .melkana-map-loading-icon {
        width: 2.35rem;
        height: 2.35rem;
    }

    .melkana-map-loading.is-compact {
        inset: .55rem .55rem auto auto;
        width: min(235px, calc(100% - 1.1rem));
    }
}

@media (prefers-reduced-motion: reduce) {
    .melkana-map-loading,
    .melkana-map-loading-bar {
        transition: none;
    }
}


/* Shared Leaflet typography: keep every textual map surface aligned with the site font. */
.leaflet-container,
.leaflet-container .leaflet-popup-content-wrapper,
.leaflet-container .leaflet-popup-content,
.leaflet-container .leaflet-tooltip,
.leaflet-container .leaflet-control,
.leaflet-container .leaflet-control a,
.leaflet-container .leaflet-control button,
.leaflet-container .leaflet-marker-icon,
.leaflet-container .marker-cluster,
.leaflet-container .marker-cluster *,
.leaflet-container .home-map-cluster,
.leaflet-container .home-map-cluster * {
    font-family: "Vazirmatn", "VazirmatnLocal", Tahoma, Arial, sans-serif !important;
}

html[data-melkana-font-source="local"] .leaflet-container,
html[data-melkana-font-source="local"] .leaflet-container .leaflet-popup-content-wrapper,
html[data-melkana-font-source="local"] .leaflet-container .leaflet-popup-content,
html[data-melkana-font-source="local"] .leaflet-container .leaflet-tooltip,
html[data-melkana-font-source="local"] .leaflet-container .leaflet-control,
html[data-melkana-font-source="local"] .leaflet-container .leaflet-control a,
html[data-melkana-font-source="local"] .leaflet-container .leaflet-control button,
html[data-melkana-font-source="local"] .leaflet-container .leaflet-marker-icon,
html[data-melkana-font-source="local"] .leaflet-container .marker-cluster,
html[data-melkana-font-source="local"] .leaflet-container .marker-cluster *,
html[data-melkana-font-source="local"] .leaflet-container .home-map-cluster,
html[data-melkana-font-source="local"] .leaflet-container .home-map-cluster * {
    font-family: "VazirmatnLocal", "Vazirmatn", Tahoma, Arial, sans-serif !important;
}
