/* === Map View Layout === */
.cfm-wrap {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    grid-template-rows: auto;
    gap: 20px;
    align-items: start;
    font-family: inherit;
}

/* --- Sidebar --- */
.cfm-sidebar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 20px;
}

.cfm-sidebar .cf-filter-group {
    flex: unset;
    width: 100%;
}

.cfm-sidebar .cf-select-wrap {
    width: 100%;
}

.cfm-sidebar .cf-select {
    width: 100%;
    box-sizing: border-box;
}

.cfm-sidebar .cf-reset-btn {
    width: 100%;
    text-align: center;
}

.cfm-count {
    font-size: 12px;
    color: #888;
    text-align: center;
    min-height: 16px;
}

/* --- Map container --- */
.cfm-wrap .leaflet-top,
.cfm-wrap .leaflet-bottom {
    z-index: 400;
}

.cfm-map-container {
    position: relative;
    border-radius: 16px;
    z-index: 1;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}

#cfm-map {
    width: 100%;
    height: 600px;
    background: #f0f0f0;
}

.cfm-map-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* --- List panel --- */
.cfm-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 4px;
}

.cfm-list::-webkit-scrollbar { width: 4px; }
.cfm-list::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 2px; }
.cfm-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* --- List item --- */
.cfm-list-item {
    display: flex;
    gap: 12px;
    background: #fff;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    text-decoration: none;
    color: inherit;
}

.cfm-list-item:hover {
    border-color: #bbb;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.cfm-list-item--active {
    border-color: #ff8300;
    box-shadow: 0 0 0 3px rgba(255,131,0,.15);
}

.cfm-list-item__thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

.cfm-list-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cfm-list-item__thumb--placeholder {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #e8e8e8, #d8d8d8);
    border-radius: 8px;
    flex-shrink: 0;
}

.cfm-list-item__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
}

.cfm-list-item__title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cfm-list-item__desc {
    font-size: 11px;
    color: #888;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Leaflet popup overrides --- */
.cfm-leaflet-popup .leaflet-popup-content-wrapper {
    border-radius: 14px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    border: none;
}

.cfm-leaflet-popup .leaflet-popup-content {
    margin: 0;
    width: 260px !important;
}

.cfm-leaflet-popup .leaflet-popup-tip-container {
    display: none;
}

.cfm-popup {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
}

.cfm-popup__img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.cfm-popup__img--placeholder {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, #e8e8e8, #d8d8d8);
}

.cfm-popup__body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cfm-popup__title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
}

.cfm-popup__desc {
    font-size: 12px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.cfm-popup__address {
    font-size: 11px;
    color: #999;
    margin: 0;
}

.cfm-popup__btn,
.cfm-popup__btn:visited {
    display: inline-block;
    margin-top: 6px;
    background: #ff8300;
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: background .15s;
    align-self: flex-start;
}

.cfm-popup__btn:hover,
.cfm-popup__btn:focus {
    background: #d96e00;
    color: #fff !important;
    text-decoration: none !important;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .cfm-wrap {
        grid-template-columns: 220px 1fr 260px;
        gap: 14px;
    }
}

@media (max-width: 768px) {
    .cfm-wrap {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .cfm-sidebar {
        position: static;
    }
    #cfm-map {
        height: 400px;
    }
    .cfm-list {
        max-height: 400px;
    }
}
