#map {
    width: 100% !important;
    height: 100% !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
}

#map-wrapper {
    position: relative;
    height: 100vh;
}
.leaflet-right{
    display: none;
}
.leaflet-bottom{
    display: none;
}

.map-type-control {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3000;
    background: white;
    padding: 8px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.sidebar-panel {
    position: absolute;
    left: 20px;
    top: 15vh;
    height: 80%;
    width: 500px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 10px;
    z-index: 1000;
    overflow-y: auto;
    display: none;
    backdrop-filter: blur(5px);
    transition: transform 0.3s ease;
}

.map-container {
    position: relative;
    height: 100vh;
    width: 100%;
}

.map-controls {
    position: absolute;
    top: 15vh;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.map-type-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s;
}

.map-type-btn.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.sidebar-header {
    position: sticky;
    top: 0;
    background: rgb(255 255 255);
    padding: 5px 10px;
    backdrop-filter: blur(5px);
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
    .close-sidebar {
        background: none;
        border: none;
        cursor: pointer;
        color: #666;
        font-size: 2em;
        padding: 0 5px;
    }

    .close-sidebar:hover {
        color: #333;
    }

        .listing-card {
            background: white;
            border-radius: 8px;
            margin-bottom: 15px;
            overflow: hidden;
            transition: transform 0.2s;
            cursor: pointer;
            border: 1px solid #eee;
        }

        .listing-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 3px 10px rgba(0,0,0,0.1);
        }

        .listing-image {
            width: 100%;
            height: 180px;
            object-fit: cover;
            border-bottom: 1px solid #eee;
        }

        .listing-details {
            padding: 15px;
        }

        .listing-title {
            font-size: 1.1em;
            font-weight: 600;
            margin-bottom: 8px;
            color: #333;
        }

        .listing-price {
            color: #007bff;
            font-size: 1.2em;
            font-weight: 700;
            margin-bottom: 5px;
        }

        .listing-info {
            color: #666;
            font-size: 0.9em;
            margin-bottom: 3px;
        }

        .price-per-meter {
            background: #f8f9fa;
            padding: 4px 8px;
            border-radius: 4px;
            display: inline-block;
            font-size: 0.85em;
            color: #28a745;
        }

        .cluster-outer {
            background: #ffcc00;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            aspect-ratio: 1 / 1;
            color: #ffcc00;
            font-size: 30px;
            margin-left: 3vh;
        }
        .price-label {
            position: absolute;
            left: calc(100% + 10px);
            top: 50%;
            color: black;
            transform: translateY(-50%);
            background: white;
            padding: 5px 12px;
            border-radius: 15px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
            font-size: 12px;
            min-width: 100px;
            text-align: center;
            border: 1px solid #eee;
            font-family: Arial, sans-serif;
            font-weight: bold;
            white-space: nowrap;

        }

/* Карусель */
.image-carousel {
    position: relative;
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

.carousel-container {
    position: relative;
    height: 150px;
    overflow: hidden;
}

.carousel-image {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateX(100%);
}

.carousel-image.active {
    opacity: 1;
    transform: translateX(0);
    z-index: 1;
}

.carousel-image.prev {
    transform: translateX(-100%);
    opacity: 0;
}

/* Элементы управления каруселью */
.carousel-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
    z-index: 2;
}
/* Для карусели с 1 изображением скрываем кнопки */
.carousel-controls:has(:only-child) {
    display: none;
}
.carousel-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    transition: all 0.2s ease;
}

.carousel-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

@media (max-width: 1150px) {
    .sidebar-panel {
        width: 50vw;
        left: 5vw;
        top: 10vh;
        height: 80vh;
        padding: 10px 8px;
    }
}

/* Адаптация */
@media (max-width: 480px) {
    .image-carousel {
        width: 100%;
        height: 180px;
    }
    
    .carousel-container {
        height: 180px;
    }
    .carousel-btn {
        width: 24px;
        height: 24px;
        font-size: 20px;
        display: none;
    }

    #map {
    width: 100% !important;
    height: 100% !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1000;
    }
}
.prev-btn {
    left: 5px;
}

.next-btn {
    right: 5px;
}
.leaflet-popup-content-wrapper:hover{
    transform: scale(1.01); /* Увеличение на 5% */
    z-index: 2; /* Поднимаем элемент над остальными */
}

@media (max-width: 600px) {
    .sidebar-panel {
        width: 90vw;
        left: 5vw;
        top: 15vh;
        height: 75vh;
        padding: 0px 8px;
    }

    .map-type-control {
        top: 10px;
        right: 10px;
        flex-direction: row;
        gap: 6px;
    }

    .map-type-btn {
        padding: 6px 10px;
        font-size: 0.9em;
    }

    .listing-image {
        height: 140px;
    }

    .listing-title {
        font-size: 1em;
    }

    .listing-price {
        font-size: 1.1em;
    }

    .sidebar-header {
        padding: 5px 8px;
    }

    .price-label {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (max-width: 1024px) {

    .listing-image {
        height: 160px;
    }

    .map-type-control {
        top: 15px;
        right: 15px;
    }

    .map-type-btn {
        font-size: 1em;
    }

    .carousel-container,
    .image-carousel {
        height: 120px;
    }

    .carousel-btn {
        display: flex;
    }

    .price-label {
        font-size: 12px;
    }
}

@media (min-width: 1440px) {
    .sidebar-panel {
        width: 550px;
    }

    .listing-title {
        font-size: 1.2em;
    }

    .listing-price {
        font-size: 1.3em;
    }

    .price-label {
        font-size: 14px;
    }
}
