/* Селектор городов в шапке. Стиль повторяет .modal темы stone:
   белый блок с border-radius, круглая оранжевая кнопка-крестик сверху,
   оранжевый акцент на текущем элементе. Брейкпойнт 1300px = тема. */

.city-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  font: 14px/1.3 'Roboto', Arial, sans-serif;
}

.header__menu-mobile .city-switcher {
  display: none;
}

@media (max-width: 1300px) {

  .header-wrap>.city-switcher,
  .header__contacts-row>.city-switcher {
    display: none;
  }

  .header__menu-mobile .city-switcher {
    display: inline-flex;
    margin-bottom: 16px;
    justify-content: center;
    width: 100%;
  }
}

/* Триггер */
.city-switcher__toggle {
  background: none;
  border: none;
  color: inherit;
  padding: 6px 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  font: inherit;
  transition: opacity .15s ease;
}

.city-switcher__toggle:hover {
  opacity: .7;
}

.city-switcher__toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.city-switcher__pin {
  flex-shrink: 0;
  color: var(--other-gray);
}

.city-switcher__current {
  font-weight: 500;
  border-bottom: 1px dashed currentColor;
}

.city-switcher__caret {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  display: inline-block;
  background: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' stroke='currentColor' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: .6;
  transition: transform .2s ease;
}

.city-switcher__toggle[aria-expanded="true"] .city-switcher__caret {
  transform: rotate(180deg);
}

/* Оверлей — копия .modal */
.city-switcher__popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.city-switcher__popup[hidden] {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Внутренняя плашка — белый блок со скруглением border-30 как у .modal__content */
.city-switcher__popup-inner {
  background: #fff;
  color: var(--dark, #222);
  border-radius: 30px;
  max-width: 720px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.city-switcher__popup:not([hidden]) .city-switcher__popup-inner {
  transform: translateY(0);
}

/* Круглая оранжевая кнопка закрытия — копия .modal__close */
.city-switcher__close {
  position: absolute;
  right: 0;
  left: 0;
  top: -40px;
  margin: auto;
  width: 30px;
  height: 30px;
  background-color: var(--orange, #FF482F);
  border: 2px solid var(--border-orange, rgba(249, 48, 33, 0.35));
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.26634 9.66732L0.333008 8.73398L4.06634 5.00065L0.333008 1.26732L1.26634 0.333984L4.99967 4.06732L8.73301 0.333984L9.66634 1.26732L5.93301 5.00065L9.66634 8.73398L8.73301 9.66732L4.99967 5.93398L1.26634 9.66732Z' fill='white' /%3E%3C/svg%3E");
  background-size: 10px;
  background-position: center;
  background-repeat: no-repeat;
  font-size: 0;
  color: transparent;
  cursor: pointer;
  box-shadow: 0 11px 30px 0 rgba(249, 48, 33, 0.35);
  padding: 0;
  line-height: 1;
}

.city-switcher__close:hover {
  background-color: var(--orange, #FF482F);
  filter: brightness(1.05);
}

.city-switcher__title {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  line-height: 120%;
}

/* Поиск — стиль .form__input темы */
.city-switcher__search {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-gray, #E5E5E5);
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
  background: #fff;
  font-family: inherit;
  transition: border-color .15s ease;
}

.city-switcher__search:focus {
  outline: none;
  border-color: var(--orange, #FF482F);
}

.city-switcher__search::placeholder {
  color: #999;
}

/* Список городов */
.city-switcher__list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  max-height: 50vh;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
}

.city-switcher__item a {
  display: block;
  padding: 10px 12px;
  color: var(--dark, #222);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color .15s ease, color .15s ease;
}

.city-switcher__item a:hover {
  background: rgba(255, 72, 47, 0.08);
  color: var(--orange, #FF482F);
}

.city-switcher__item.is-current span {
  display: block;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--orange, #FF482F);
  cursor: default;
  background: rgba(255, 72, 47, 0.08);
  border-radius: 8px;
}

.city-switcher__item[hidden] {
  display: none;
}

.city-switcher__empty {
  color: #888;
  font-size: 14px;
  margin: 16px 0 0;
  text-align: center;
}

@media (max-width: 600px) {
  .city-switcher__popup-inner {
    padding: 24px 16px;
    border-radius: 20px;
  }

  .city-switcher__title {
    font-size: 20px;
  }

  .city-switcher__list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* Компенсация скроллбара — добавляется JS-классом, чтобы при открытии
   попапа страница не дёргалась влево из-за исчезновения скроллбара. */
html.city-switcher-lock {
  overflow: hidden;
}