/* === Всплывающее окно выбора города — GP Cities Selector === */

#cities-popup-overlay {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  overflow: hidden;
  position: fixed;
  background: #0b0b0b;
  opacity: 0.6;
}

#cities-popup-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100001;
  outline: none !important;
  background: #fff;
  border-radius: 8px;
  max-width: 760px;
  max-height: 90vh;
  width: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #DFDFE1 transparent;
}

/* Мобильная адаптация */
@media (max-width: 767px) {
  #cities-popup-content {
    max-width: 90vw;
    width: 90vw;
  }
}

/* === Кнопка закрытия (сохранён класс .mfp-close для совместимости с cities-form.php) === */

#cities-popup-content .mfp-close {
  overflow: visible;
  cursor: pointer;
  background: transparent;
  border: 0;
  -webkit-appearance: none;
  display: block;
  outline: none;
  padding: 0;
  z-index: 1050;
  box-shadow: none;
  touch-action: manipulation;

  width: 44px;
  height: 44px;
  line-height: 44px;
  position: absolute;
  right: 0;
  top: 0;
  text-decoration: none;
  text-align: center;
  opacity: 0.65;
  padding: 0 0 18px 10px;
  color: #333;
  font-style: normal;
  font-size: 28px;
  font-family: Arial, Baskerville, monospace;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

#cities-popup-content .mfp-close:hover,
#cities-popup-content .mfp-close:focus {
  opacity: 1;
}

#cities-popup-content .mfp-close:active {
  top: 1px;
}

/* Мобильный крестик */
@media (max-width: 767px) {
  #cities-popup-content .mfp-close {
    width: 40px;
    height: 40px;
    line-height: 40px;
    padding: 0 0 16px 8px;
    font-size: 24px;
  }
}

/* === Спиннер загрузки (в случае ошибки или задержки) === */

.cities-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #0073e6;
  border-radius: 50%;
  animation: cities-spin 1s linear infinite;
}

@keyframes cities-spin {
  to {
    transform: rotate(360deg);
  }
}

/* === Содержимое попапа === */

.cities-popup {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border-radius: 8px;
}

.cities-header {
  padding: 24px 12px 24px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid #e5e5e5;
}

.cities-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  margin: 0;
  font-weight: normal;
}

.cities-current {
  font-weight: 500;
}

.cities-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
}

.cities-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
}

.cities-item {
  flex: 0 0 calc(33.333% - 6.66px);
}

.cities-link {
  display: block;
  padding: 5px 0;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

.cities-link:hover {
  color: #0073e6;
}

.cities-empty {
  padding: 24px;
  text-align: center;
}

/* === Мобильная версия контента === */

@media (max-width: 767px) {
  .cities-header {
    padding: 16px;
  }

  .cities-scrollable {
    padding: 16px;
  }

  .cities-list {
    flex-direction: column;
    gap: 8px;
  }

  .cities-item {
    flex: 1 0 100%;
  }

  .cities-link {
    white-space: normal;
    text-align: left;
  }
}

/* === Курсор для кнопки выбора региона на странице === */

a.regions__name {
  cursor: pointer;
}