/* ─────────────────────────────────────────
   BLOCK: city-modal
   Модальное окно выбора города.
   Открыт/закрыт через модификатор --open.
───────────────────────────────────────── */

/* Корневой элемент блока — скрыт по умолчанию */
.city-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

/* Модификатор: модальное окно открыто */
.city-modal--open {
  display: block;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__overlay
   Полупрозрачный затемнённый фон
───────────────────────────────────────── */
.city-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__window
   Белое окно поверх оверлея
───────────────────────────────────────── */
.city-modal__window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 750px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: var(--gray-bg);
  padding: 32px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__header
───────────────────────────────────────── */
.city-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.city-modal__hr {
  height: 1px;
  border: none;
  border-top: 1px solid #e7e7e7
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__title
───────────────────────────────────────── */
.city-modal__title {
  font-size: 22px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__close
───────────────────────────────────────── */
.city-modal__close {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__search
───────────────────────────────────────── */
.city-modal__search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__search-icon
───────────────────────────────────────── */
.city-modal__search-icon {
  width: 18px;
  height: auto;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__search-input
───────────────────────────────────────── */
.city-modal__search-input {
  border: none;
  outline: none;
  font-size: 14px;
  width: 100%;
  color: #374151;
  background: transparent;
  font-family: inherit;
}
.city-modal__search-input::placeholder {
  color: #9ca3af;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__city-grid
   4-колоночная сетка городов, скроллится
───────────────────────────────────────── */
.city-modal__city-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px 0;
  overflow-y: auto;
  list-style: none;
  padding-right: 4px;
}

/* Тонкий скроллбар */
.city-modal__city-grid::-webkit-scrollbar {
  width: 4px;
}
.city-modal__city-grid::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 2px;
}
.city-modal__city-grid::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__city-item
───────────────────────────────────────── */
.city-modal__city-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.city-modal__city-item:hover {
  background: #f3f4f6;
}

/* Модификатор: пустая ячейка-заглушка для выравнивания сетки */
.city-modal__city-item--empty {
  cursor: default;
  pointer-events: none;
}
.city-modal__city-item--empty:hover {
  background: none;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__city-icon
───────────────────────────────────────── */
.city-modal__city-icon {
  font-size: 12px;
  color: #9ca3af;
  flex-shrink: 0;
  line-height: 1;
}

/* ─────────────────────────────────────────
   ELEMENT: city-modal__city-name
───────────────────────────────────────── */
.city-modal__city-name {
  font-size: 13px;
  color: #374151;
  line-height: 1.4;
}
.city-modal__city-item:hover .city-modal__city-name {
  color: #6B2FA0;
}
