/* ГЛОБАЛЬНАЯ НАСТРОЙКА (чтобы padding не ломал ширину) */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Основные блоки */
.map-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Ubuntu', sans-serif;
    padding-bottom: 50px; /* Отступ снизу страницы */
}

/* ПАНЕЛЬ УПРАВЛЕНИЯ */
.map-controls-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    background: #fff; /* Белый фон лучше смотрится на сером */
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.map-select-wrapper {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.nice-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #333; /* Темный фон для селекта как на скрине */
    color: #fff;
    font-weight: 500;
    cursor: pointer;
}

/* ИНСТРУМЕНТЫ */
.tools-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Поиск */
.coord-finder {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.coord-finder input {
    width: 50px;
    padding: 6px 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.coord-finder button {
    background: #00a3f5;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 7px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: .15s;
}
.coord-finder button:hover { background: #008ecc; }

/* Зум */
.zoom-controls { display: flex; gap: 4px; }

.zoom-btn {
    width: 34px; height: 34px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1.2em;
    line-height: 1;
    color: #555;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: .1s;
}
.zoom-btn:hover { background: #f5f5f5; border-color: #bbb; }

/* Кнопка Рулетки */
.ruler-toggle-btn {
    background: #00a3f5; /* Сразу синяя, как на скрине */
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: all .2s;
    box-shadow: 0 2px 5px rgba(0, 163, 245, 0.3);
}
.ruler-toggle-btn:hover { background: #008ecc; }
.ruler-toggle-btn.active {
    background: #006096; /* Темнее при активности */
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

/* ОБЛАСТЬ КАРТЫ */
.map-container {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    /* overflow: auto - позволяет скроллить карту, если она не влезает */
    overflow: auto; 
    /* Добавляем отступы внутри, чтобы тень карты не обрезалась */
    padding: 30px; 
    background: #fff;
    border-radius: 14px;
    min-height: 400px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
}

/* Фрейм карты */
.map-frame {
    position: relative;
    display: inline-block;
    /* Убираем жесткое ограничение высоты, чтобы карта не плющилась */
    /* max-height: 85vh; */
    line-height: 0;
    border-radius: 4px; /* Чуть меньше радиус */
    /* Тень делаем чуть мягче и меньше, чтобы не вылезала */
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); 
    cursor: crosshair;
    user-select: none;
    transition: width 0.3s ease;
    
    /* Чтобы картинка не вылезала за скругления фрейма */
    overflow: hidden; 
}

.map-img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.map-svg-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ТУЛТИП */
.cursor-tooltip {
    position: fixed;
    background: rgba(30, 30, 30, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
    z-index: 9999;
    display: none;
    backdrop-filter: blur(2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transform: translate(15px, 15px);
}
.cursor-tooltip span { color: #00a3f5; font-weight: 700; }

/* ТОЧКИ И МАРКЕРЫ */
.map-point {
    position: absolute;
    width: 14px; height: 14px;
    background: #fff;
    border: 3px solid #00a3f5;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    pointer-events: none;
    display: none;
}
.map-point.end { border-color: #ff4444; }

.map-marker-search {
    position: absolute;
    width: 16px; height: 16px;
    background: #ffcc00;
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    box-shadow: 0 0 0 4px rgba(255, 204, 0, 0.4);
    display: none;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 204, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); }
}

.info-status { margin-top: 10px; text-align: center; color: #888; font-size: 0.85em; }

/* Адаптив */
@media (max-width: 850px) {
    .map-controls-panel { justify-content: center; gap: 10px; }
    .tools-group { flex-wrap: wrap; justify-content: center; width: 100%; }
    .map-select-wrapper { min-width: 100%; }
}