/* --- Обертка и карта --- */
.map-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.map-inner {
    position: relative;
    width: 100%;
}

.map-bg {
    width: 100%;
    display: block;
    pointer-events: none;
}

/* --- Точки-кластеры --- */
.map-point-wrapper {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    /* Убираем cursor: pointer отсюда, перенесем на саму точку */
}

/* Сама точка (кликабельная область) */
.map-point {
    width: 24px;
    height: 24px;
    background-color: #0d6efd;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.6);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer; /* Курсор-рука только на кружке */
    position: relative;
    z-index: 2; /* Кружок выше подписи */
}

/* Подпись города */
.map-point-label {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    text-shadow: 0 0 2px #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    
    /* Скрываем по умолчанию */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none; /* Подпись не перехватывает клики */
    
    position: absolute;
    top: 100%; /* Позиционируем строго под кружком */
    left: 50%;
    transform: translate(-50%, -5px); /* Центрируем и сдвигаем */
    z-index: 1;
}

/* Класс, который JS будет добавлять при наведении на кружок */
.map-point-wrapper.is-hovered .map-point-label {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0); /* Возвращаем на место */
}

.map-point-wrapper.is-hovered .map-point {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(26, 115, 232, 0.9);
}

/* --- Попап --- */
.map-popup {
    position: absolute;
    display: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    width: 320px;
    z-index: 100;
    padding: 20px;
    border: 1px solid #eee;
    visibility: hidden; 
}

.map-popup.active {
    display: block;
    visibility: visible;
    animation: fadeIn 0.25s ease-out;
}

.popup-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f5f5f5;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    z-index: 2;
}

.popup-close-btn:hover {
    background: #e0e0e0;
}

.popup-header h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-right: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.popup-projects-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.popup-projects-list::-webkit-scrollbar { width: 4px; }
.popup-projects-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.popup-projects-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.popup-projects-list::-webkit-scrollbar-thumb:hover { background: #aaa; }

.project-link-item {
    display: block;
    text-decoration: underline;
    color: #222;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    padding-left: 15px;
    position: relative;
    transition: color 0.2s;
}

.project-link-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 6px;
    height: 6px;
    background-color: #0d6efd;
    border-radius: 50%;
}

.project-link-item:hover {
    color: #0d6efd;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Мобильная адаптация --- */
@media (max-width: 768px) {
    .map-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .map-inner { width: 800px; }
    .map-point-label { font-size: 12px; }
    .map-point { width: 26px; height: 26px; font-size: 13px; }
    .map-popup { width: calc(100vw - 40px); max-width: 320px; padding: 15px; }
    .popup-projects-list { max-height: 200px; }
}
