/**
 * Универсальные стили для переключателя городов
 * Работает на всех страницах сайта
 */

/* Контейнер переключателя городов */
.city-switcher {
  position: relative;
  display: inline-block;
  z-index: 1000;
}

/* Кнопка выбора города */
#city-switcher-label {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 8px;
  color: #dc2626;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

#city-switcher-label:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#city-switcher-label:active {
  transform: translateY(0);
}

/* Выпадающее меню */
#city-switcher-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  max-width: 300px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1001;
  margin-top: 4px;
}

/* Элемент города в меню */
.city-switcher-item {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: #111827;
  font-size: 14px;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f3f4f6;
}

.city-switcher-item:last-child {
  border-bottom: none;
}

.city-switcher-item:hover {
  background-color: #f9fafb;
  color: #dc2626;
}

.city-switcher-item.active {
  background-color: #fef2f2;
  color: #dc2626;
  font-weight: 600;
}

.city-switcher-item.active:hover {
  background-color: #fee2e2;
}

/* Скроллбар для меню */
#city-switcher-menu::-webkit-scrollbar {
  width: 6px;
}

#city-switcher-menu::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#city-switcher-menu::-webkit-scrollbar-thumb {
  background: #dc2626;
  border-radius: 10px;
}

#city-switcher-menu::-webkit-scrollbar-thumb:hover {
  background: #b91c1c;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  #city-switcher-label {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  #city-switcher-menu {
    min-width: 200px;
    max-width: 90vw;
    max-height: 300px;
    left: 50%;
    right: auto;
  }
  
  .city-switcher-item {
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* Варианты позиционирования */
.city-switcher.position-top-right {
  position: absolute;
  top: 20px;
  right: 20px;
}

.city-switcher.position-top-left {
  position: absolute;
  top: 20px;
  left: 20px;
}

.city-switcher.position-top-center {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.city-switcher.position-header {
  display: inline-block;
  margin-left: 20px;
  vertical-align: middle;
}

/* Интеграция в header */
header .city-switcher,
.header .city-switcher,
.swgp-header .city-switcher {
  display: inline-block;
  margin: 0 10px;
  vertical-align: middle;
}

/* Интеграция в footer */
footer .city-switcher,
.footer .city-switcher {
  display: inline-block;
  margin: 10px 0;
}
