/* ── SCMM Map Frontend — v1.5.0 | Author: Wyarej Ali ────────────────────── */

.scmm-map-wrapper {
    display: flex;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* No border-radius anywhere in the frontend map */
.scmm-map-wrapper,
.scmm-map-wrapper *,
.leaflet-popup,
.leaflet-popup *,
.scmm-leaflet-pin,
.scmm-leaflet-pin * {
    border-radius: 0 !important;
}

.scmm-sidebar {
    width: 350px;
    min-width: 300px;
    background: var(--scmm-c-sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    z-index: 10;
    transition:
        width 0.3s,
        min-width 0.3s;
    overflow: hidden;
}
.scmm-sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.scmm-sidebar-header {
    padding: 16px;
    background: var(--scmm-c-primary);
    color: var(--scmm-c-button-text);
    flex-shrink: 0;
}
.scmm-sidebar-header h3 {
    margin: 0 0 12px;
    font-size: 2rem;
    font-weight: 700;
    color: var(--scmm-c-button-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.scmm-sidebar-header h3 i {
    font-size: 0.95rem;
}

.scmm-search-wrap {
    display: flex;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.2s;
    margin-top: 10px;
}
.scmm-search-wrap:focus-within {
    border-color: rgba(255, 255, 255, 0.8);
}
#scmm-city-search {
    flex: 1;
    border: none;
    padding: 8px 12px;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.15);
    color: var(--scmm-c-button-text);
    outline: none;
}
#scmm-city-search::placeholder {
    color: rgba(255, 255, 255, 0.6);
}
#scmm-city-search:focus {
    background: rgba(255, 255, 255, 0.22);
}
#scmm-search-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--scmm-c-button-text);
    display: flex;
    align-items: center;
    transition: background 0.2s;
}
#scmm-search-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}
#scmm-search-status {
    margin-top: 8px;
    font-size: 0.75rem;
    min-height: 18px;
    color: rgba(255, 255, 255, 0.8);
}
#scmm-search-status.error {
    color: #ff8a80;
}
#scmm-search-status.success {
    color: #b9f6ca;
}
#scmm-search-status.loading {
    color: rgba(255, 255, 255, 0.7);
}

.scmm-city-list {
    list-style: none;
    margin: 0;
    padding: 0 !important;
    overflow-y: auto;
    flex: 1;
}
.scmm-city-list::-webkit-scrollbar {
    width: 4px;
}
.scmm-city-list::-webkit-scrollbar-thumb {
    background: #c0c0c0;
}

.scmm-city-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s;
    color: var(--scmm-c-sidebar-text);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-left: 4px solid transparent;
    width: 100%;
    box-sizing: border-box;
}
.scmm-city-item:hover {
    background: var(--scmm-c-primary-lt);
    border-left-color: var(--scmm-c-primary);
}
.scmm-city-item.active {
    background: var(--scmm-c-primary-lt);
    font-weight: 600;
    color: var(--scmm-c-primary);
    border-left-color: var(--scmm-c-primary);
}
.scmm-city-item.searched {
    color: #795548;
}
.scmm-city-item.searched:hover {
    background: #fff8f0;
}
.scmm-city-item.hidden {
    display: none;
}

.scmm-pin-icon {
    flex-shrink: 0;
    color: var(--scmm-c-pin);
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
}
.scmm-city-item.searched .scmm-pin-icon {
    color: var(--scmm-c-pin-search);
}
.scmm-city-item.active .scmm-pin-icon {
    color: var(--scmm-c-primary);
}
.scmm-city-name {
    flex: 1;
}
.scmm-arrow {
    flex-shrink: 0;
    opacity: 0.4;
    transition:
        opacity 0.15s,
        transform 0.15s;
    font-size: 0.7rem;
}
.scmm-city-item:hover .scmm-arrow {
    opacity: 0.85;
    transform: translateX(2px);
}

.scmm-map-container {
    flex: 1;
    position: relative;
}
#scmm-map {
    width: 100%;
    height: 100%;
}

.scmm-sidebar-toggle {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: #fff;
    border: 2px solid rgba(0, 0, 0, 0.2);
    width: 34px;
    height: 34px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
    color: #333;
}
.scmm-sidebar-toggle:hover {
    background: #f4f4f4;
}

/* ── Custom Leaflet pin (divIcon) ─────────────────────────────────────────── */
.scmm-leaflet-pin {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
}
.scmm-leaflet-pin i {
    font-size: 30px;
    color: var(--scmm-c-pin);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    line-height: 1;
}
.scmm-leaflet-pin.is-search i {
    color: var(--scmm-c-pin-search);
}

/* ── Popup ────────────────────────────────────────────────────────────────── */
.scmm-popup-inner {
    padding: 4px 2px;
    min-width: 200px;
    text-align: center;
}
.scmm-popup-inner h4 {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--scmm-c-primary);
}
.scmm-popup-badge {
    font-size: 0.7rem;
    background: var(--scmm-c-primary-lt);
    color: var(--scmm-c-primary);
    padding: 3px 10px;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}
.scmm-popup-badge.external {
    background: #fff3e0;
    color: var(--scmm-c-pin-search);
}
.scmm-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--scmm-c-primary);
    color: var(--scmm-c-button-text) !important;
    text-decoration: none !important;
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    transition:
        background 0.2s,
        transform 0.15s;
    margin-top: 4px;
}
.scmm-popup-btn:hover {
    background: var(--scmm-c-primary-dk);
    transform: translateY(-1px);
}
.leaflet-popup-content-wrapper {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2) !important;
}
.leaflet-popup-tip-container {
    margin-top: -1px;
}

@media (max-width: 600px) {
    .scmm-map-wrapper {
        flex-direction: column;
    }
    .scmm-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    .scmm-sidebar.collapsed {
        max-height: 0;
    }
    .scmm-map-container {
        min-height: 350px;
    }
    .scmm-sidebar-toggle {
        left: auto;
        right: 10px;
    }
}
