/* ===== MODERN MAP STYLES ===== */
#map {
  margin-top: 60px;
  height: calc(100vh - 60px);
  background: var(--gray-100);
}

/* ===== ADD REPORT BUTTON - FIXED POSITION AND STYLE ===== */
#addFishingReportBtn {
  position: absolute;

  z-index: 1000;
  background: var(--ocean-600); /* Blue like other buttons */
  color: var(--white);
  border: 1.5px solid var(--ocean-600);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  font-family: inherit;
}

#addFishingReportBtn:hover {
  background: var(--ocean-700);
  border-color: var(--ocean-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

#addFishingReportBtn.active {
  background: var(--error);
  border-color: var(--error);
}

/* ===== MAP STYLE DROPDOWN - FIXED ===== */

.dropdown-btn:after {
  content: '';
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s ease;
}

.dropdown-btn.open:after {
  transform: rotate(180deg);
}

/* Remove old map style controls */
.map-style-control {
  display: none !important;
}

.control-btn {
  display: none !important;
}

/* ===== СТИЛИ ДЛЯ ПЕРЕКЛЮЧАТЕЛЯ КАРТЫ ===== */

/* Основной контейнер выпадающего списка */
.map-style-dropdown {
  position: relative;
  display: inline-block;
}

/* Кнопка выпадающего списка */
.dropdown-btn {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  justify-content: space-between;
  font-family: inherit;
}

.dropdown-btn:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

/* Стрелочка */
.dropdown-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
  color: #64748b;
}

.dropdown-btn.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* Выпадающее меню */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  min-width: 180px;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Элементы меню */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  color: #475569;
  border-bottom: 1px solid #f1f5f9;
  font-family: inherit;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: #f8fafc;
  color: #1e40af;
}

.dropdown-item.active {
  background: #eff6ff;
  color: #1e40af;
  font-weight: 600;
}

/* Иконки в меню */
.dropdown-item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ===== АДАПТИВНЫЙ ПЕРЕКЛЮЧАТЕЛЬ СТИЛЕЙ КАРТЫ ===== */



/* Мобильная версия переключателя стилей */
@media (max-width: 768px) {
  .dropdown-btn {
    padding: 8px; /* Квадратная кнопка */
    width: 40px;
    height: 40px;
    min-width: auto;
    justify-content: center;
    border-radius: var(--radius-lg);
  }
  
  .dropdown-btn span {
    display: none; /* Скрываем текст */
  }
  
  /* Иконка слоёв вместо текста */
  .dropdown-btn::before {
    content: '🗺️';
    font-size: 18px;
  }
  
  /* Убираем стрелочку на мобильных */
  .dropdown-btn::after {
    display: none;
  }
  
  /* Адаптируем выпадающее меню для мобильных */
  .dropdown-menu {
    right: 0;
    left: auto;
    min-width: 160px;
  }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
  .dropdown-btn {
    width: 36px;
    height: 36px;
    padding: 6px;
  }
  
  .dropdown-btn::before {
    font-size: 16px;
  }
}

/* ===== FISHING REPORT POPUP POSITIONING ===== */
.fishing-report-popup .maplibregl-popup-tip {
    border-top-color: #f8fafc !important;
    border-bottom-color: #f8fafc !important;
}

/* Улучшаем внешний вид стандартного попапа */
.maplibregl-popup-content {
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

/* Анимация появления попапа */
.maplibregl-popup {
    animation: popupAppear 0.3s ease;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== СТИЛИ ДЛЯ ПОПАПОВ ВОДОЕМОВ ===== */

.water-popup .maplibregl-popup-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    border: 1px solid #bae6fd !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.15) !important;
    padding: 15px !important;
    max-width: 280px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.water-popup .maplibregl-popup-content h3 {
    margin: 0 0 10px 0 !important;
    color: #0369a1 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

.water-popup .maplibregl-popup-content p {
    margin: 6px 0 !important;
    color: #475569 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}

.water-popup .maplibregl-popup-content strong {
    color: #0c4a6e !important;
    font-weight: 600 !important;
}

.water-popup .maplibregl-popup-close-button {
    background: rgba(2, 132, 199, 0.8) !important;
    color: white !important;
    width: 22px !important;
    height: 22px !important;
    font-size: 14px !important;
}

.water-popup .maplibregl-popup-close-button:hover {
    background: rgba(2, 132, 199, 1) !important;
}

/* В css/map.css добавьте: */

/* Приоритет слоев */
.maplibregl-map {
    position: relative;
}

/* Маркеры отчетов должны быть поверх всего */
.maplibregl-marker {
    z-index: 1000 !important;
}

/* Водоемы (и тайловые и пользовательские) должны быть под маркерами */
.maplibregl-layer[class*="water"],
.maplibregl-layer[class*="river"] {
    z-index: 1 !important;
}

/* Ховер слои водоемов */
.maplibregl-layer[class*="hover"] {
    z-index: 2 !important;
    pointer-events: none !important;
}

/* ===== ЕДИНЫЕ КНОПКИ УПРАВЛЕНИЯ КАРТОЙ ===== */

.map-management-controls {
    position: absolute;
    top: 70px;
    left: 10px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}

.map-control-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    min-width: 40px;
    height: 40px;
    justify-content: center;
}

.map-control-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.map-control-btn:active {
    transform: translateY(0);
}

.map-control-btn.active {
    background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
    box-shadow: 0 2px 8px rgba(237, 100, 166, 0.4);
}

.map-control-icon {
    font-size: 16px;
    line-height: 1;
}

.map-control-text {
    white-space: nowrap;
    font-size: 13px;
}

/* Переключатель пользовательских водоемов */
.map-control-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    height: 40px;
}

.map-control-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.map-toggle-checkbox {
    display: none;
}

.map-toggle-slider {
    width: 36px;
    height: 20px;
    background: #cbd5e0;
    border-radius: 10px;
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.map-toggle-slider:after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.map-toggle-checkbox:checked + .map-toggle-slider {
    background: #4299e1;
}

.map-toggle-checkbox:checked + .map-toggle-slider:after {
    transform: translateX(16px);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .map-management-controls {
        top: 70px;
        left: 10px;
        padding: 4px;
        gap: 6px;
    }
    
    .map-control-btn {
        padding: 0;
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    
    .map-control-text {
        display: none;
    }
    
    .map-control-toggle .map-control-text {
        display: none;
    }
    
    .map-control-toggle {
        padding: 8px;
        width: 40px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .map-management-controls {
        top: 55px;
        left: 10px;
    }
    
    .map-control-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .map-control-toggle {
        width: 36px;
    }
    
    .map-toggle-slider {
        width: 32px;
        height: 18px;
    }
    
    .map-toggle-slider:after {
        width: 14px;
        height: 14px;
    }
    
    .map-toggle-checkbox:checked + .map-toggle-slider:after {
        transform: translateX(14px);
    }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .map-management-controls {
        top: 60px;
        left: 6px;
        gap: 4px;
    }
    
    .map-control-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .map-control-icon {
        font-size: 14px;
    }
    
    .map-control-toggle {
        width: 32px;
    }
}

/* Плавное появление при загрузке */
@keyframes controlsAppear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.map-management-controls {
    animation: controlsAppear 0.5s ease;
}

/* Адаптивность для правого блока */
@media (max-width: 768px) {
    .map-controls {
        top: 70px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .map-controls {
        top: 55px;
        right: 10px;
    }
}

/* ===== ПРАВЫЙ БЛОК КНОПОК УПРАВЛЕНИЯ ===== */

/* Основной контейнер для кнопок справа */
.map-controls-right {
    position: absolute;
    top: 70px; /* Такая же высота как у левого блока */
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}

/* Кнопка фильтров в стиле левых кнопок */
.map-control-btn-filters {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    min-width: 40px;
    height: 40px;
    justify-content: center;
}

.map-control-btn-filters:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.map-control-btn-filters.active {
    background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
    box-shadow: 0 2px 8px rgba(237, 100, 166, 0.4);
}

/* Стили для выпадающего списка стилей карты (адаптированные) */
.map-style-dropdown-right {
    position: relative;
}

.dropdown-btn-right {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    min-width: 40px;
    height: 40px;
    justify-content: center;
}

.dropdown-btn-right:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.dropdown-btn-right .btn-text {
    font-size: 13px;
    white-space: nowrap;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .map-controls-right {
        top: 70px;
        right: 10px;
        padding: 6px;
        gap: 6px;
    }
    
    .map-control-btn-filters,
    .dropdown-btn-right {
        padding: 0;
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    
    .map-control-btn-filters .map-control-text,
    .dropdown-btn-right .btn-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .map-controls-right {
        top: 55px;
        right: 10px;
    }
    
    .map-control-btn-filters,
    .dropdown-btn-right {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
}

@media (max-width: 360px) {
    .map-controls-right {
        top: 60px;
        right: 6px;
        gap: 4px;
    }
    
    .map-control-btn-filters,
    .dropdown-btn-right {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
}

/* Плавное появление */
.map-controls-right {
    animation: controlsAppear 0.5s ease;
}

/* Стили для самой панели фильтров (должны быть) */
.filters-panel {
    position: absolute;
    top: 150px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1001;
    max-height: 80vh;
    overflow-y: auto;
}

/* Медиа-запросы для панели фильтров */
@media (max-width: 768px) {
    .filters-panel {
        top: 140px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .filters-panel {
        top: 135px;
        max-height: 65vh;
    }
}

@media (max-width: 360px) {
    .filters-panel {
        top: 130px;
        max-height: 60vh;
    }
}