/* ── Map wrapper ── */
.mim-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

#mim-map {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* ── Toggle bar ── */
.mim-toggle-bar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.mim-toggle-btn {
    padding: 6px 14px;
    border: 2px solid #ccc;
    border-radius: 5px;
    background: #fff;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mim-toggle-btn:hover {
    border-color: #999;
    background: #f5f5f5;
}

/* Active state — background colour set dynamically via inline style in JS
   for brand-specific colours. This rule provides the base (white text). */
.mim-toggle-btn.mim-active {
    color: #fff;
}

/* ── Map layout (sidebars + map) ── */
.mim-map-layout {
    display: flex;
    gap: 15px;
}

.mim-sidebar {
    width: 180px;
    flex-shrink: 0;
    max-height: 600px;
    overflow-y: auto;
}

.mim-map-col {
    flex: 1;
    min-width: 0;
}

.mim-sidebar-section {
    margin-bottom: 12px;
}

.mim-sidebar-section h4 {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 5px;
    padding: 5px 0;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.mim-product-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mim-product-list li {
    padding: 4px 0;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mim-product-list li:hover {
    background: #f5f5f5;
}

.mim-product-list img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.mim-product-list a,
.mim-sidebar-link {
    color: #333;
    text-decoration: none;
    font-size: 12px;
    line-height: 1.3;
}

.mim-product-list a:hover,
.mim-sidebar-link:hover {
    color: #2B6CB0;
}

.mim-section-empty {
    display: none;
}

/* ── Legend (below map) ── */
.mim-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
    font-size: 13px;
    color: #333;
}

.mim-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mim-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* ── Popup styling ── */
.mim-popup {
    text-align: center;
    min-width: 160px;
}

/* Flipped popup (rectangle is in top half of map) — hide the tip arrow */
.leaflet-popup.mim-popup-flipped .leaflet-popup-tip-container,
.leaflet-popup.mim-popup-flipped .leaflet-popup-tip {
    display: none;
}

.leaflet-popup-content img.mim-popup-img,
.mim-popup-img {
    max-width: 175px !important;
    max-height: 175px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    border-radius: 4px;
    margin: 0 auto 8px auto;
    display: block;
}

.mim-popup-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
    color: #222;
}

.mim-popup-series {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.mim-popup-scale {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.mim-popup-link {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #2B6CB0;
    text-decoration: none;
}

.mim-popup-link:hover {
    text-decoration: underline;
}

/* ── City labels ── */
.mim-city-label {
    font-size: 11px;
    color: #333;
    text-shadow: 1px 1px 2px #fff, -1px -1px 2px #fff, 1px -1px 2px #fff, -1px 1px 2px #fff;
    white-space: nowrap;
    background: none !important;
    border: none !important;
}

.mim-capital {
    font-size: 13px;
    font-weight: 700;
    color: #111;
}

/* ── Divi / theme compatibility ── */
.mim-wrapper,
.mim-wrapper * {
    box-sizing: border-box;
}

#mim-map img {
    max-width: none !important;
    max-height: none !important;
}

.leaflet-popup {
    z-index: 1000 !important;
}

.leaflet-control-zoom {
    z-index: 999 !important;
}

#mim-map .leaflet-control-attribution {
    background: transparent !important;
    color: #999 !important;
}

#mim-map .leaflet-control-attribution a {
    color: #999 !important;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
    .mim-map-layout {
        flex-direction: column;
    }

    .mim-sidebar {
        width: 100%;
        max-height: none;
        overflow-y: visible;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .mim-sidebar-section {
        flex: 1;
        min-width: 120px;
        margin-bottom: 0;
    }
}
