/* ═══════════════════════════════════════════════════════════════
   City Selector & Delivery Components — MC Виан B2B Portal
   ═══════════════════════════════════════════════════════════════ */

/* ── City Selector in Header ──────────────────────────────────── */
.city-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}
.city-selector:hover {
  color: var(--color-primary);
}
.city-selector__icon {
  font-size: 1rem;
  color: var(--color-primary);
}
.city-selector__text {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.city-selector__arrow {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ── City Modal ───────────────────────────────────────────────── */
.city-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.city-modal.is-active {
  display: flex;
}

/* Mandatory overlay — блокирует платформу */
.city-modal.is-mandatory .city-modal__overlay {
  cursor: default;
  pointer-events: auto;
}

/* Красивый градиентный фон-затемнение — покрывает весь экран */
.city-modal__overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(0, 126, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(0, 98, 204, 0.12) 0%, transparent 50%),
    linear-gradient(135deg, rgba(11, 18, 32, 0.70) 0%, rgba(15, 25, 50, 0.78) 50%, rgba(11, 18, 32, 0.70) 100%);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  animation: cityOverlayIn 0.4s ease;
}
@keyframes cityOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Контейнер с градиентной обводкой — всегда по центру */
.city-modal__container-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 620px;
  padding: 2.5px;
  border-radius: 20px;
  background: linear-gradient(135deg, #007EFF 0%, #60b0ff 25%, #007EFF 50%, #0062CC 75%, #60b0ff 100%);
  background-size: 300% 300%;
  animation: cityBorderGlow 0.5s ease forwards, cityBorderShimmer 6s ease infinite 0.5s;
  box-shadow:
    0 0 40px rgba(0, 126, 255, 0.18),
    0 24px 80px rgba(11, 18, 32, 0.30),
    0 8px 30px rgba(0, 126, 255, 0.10);
}
@keyframes cityBorderGlow {
  from { opacity: 0; transform: translateY(-30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cityBorderShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.city-modal__container {
  position: relative;
  background: var(--color-surface);
  border-radius: 18px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
}
.city-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 32px 20px;
  border-bottom: 1px solid var(--color-border-light);
  background: linear-gradient(180deg, rgba(0, 126, 255, 0.04) 0%, transparent 100%);
}
.city-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  margin: 0;
}
.city-modal__title i {
  color: var(--color-primary);
  font-size: 1.5rem;
}
.city-modal__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  transition: var(--transition);
}
.city-modal__close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
/* Скрываем крестик, если модалка обязательная */
.city-modal.is-mandatory .city-modal__close {
  display: none;
}
.city-modal__body {
  padding: 24px 32px 32px;
  overflow-y: auto;
  max-height: calc(85vh - 80px);
}

/* Подсказка «выберите город чтобы продолжить» */
.city-modal__hint {
  display: none;
  text-align: center;
  padding: 0 0 16px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.city-modal.is-mandatory .city-modal__hint {
  display: block;
}

/* ── City Search ──────────────────────────────────────────────── */
.city-search {
  position: relative;
}
.city-search__input-wrap {
  position: relative;
  margin-bottom: 0;
}
.city-search__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 1.125rem;
  transition: color 0.2s ease;
  z-index: 1;
}
.city-search__input-wrap:focus-within .city-search__icon {
  color: var(--color-primary);
}
.city-search__input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  border: 2px solid var(--color-border);
  border-radius: 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  transition: all 0.2s ease;
  outline: none;
}
.city-search__input:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 4px rgba(0, 126, 255, 0.10);
}
.city-search__input::placeholder {
  color: var(--color-text-muted);
}

/* Выпадающий список результатов */
.city-search__results {
  list-style: none;
  padding: 6px;
  margin: 8px 0 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  box-shadow:
    0 8px 32px rgba(11, 18, 32, 0.10),
    0 2px 8px rgba(0, 126, 255, 0.06);
  animation: cityDropdownIn 0.2s ease;
}
.city-search__results:empty {
  display: none;
}
@keyframes cityDropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.city-search__results::-webkit-scrollbar {
  width: 6px;
}
.city-search__results::-webkit-scrollbar-track {
  background: transparent;
}
.city-search__results::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
.city-search__results::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}
.city-search__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.15s ease;
  color: var(--color-text);
}
.city-search__item:hover {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, rgba(0, 126, 255, 0.06) 100%);
  color: var(--color-primary-dark);
}
.city-search__item + .city-search__item {
  border-top: 1px solid var(--color-border-light);
}
.city-search__item:hover + .city-search__item,
.city-search__item:hover {
  border-top-color: transparent;
}
.city-search__item i {
  color: var(--color-primary);
  font-size: 1.125rem;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  border-radius: 8px;
}
.city-search__item:hover i {
  background: rgba(0, 126, 255, 0.15);
}
.city-search__name {
  font-weight: 600;
  font-size: 0.9375rem;
}
.city-search__region {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-left: auto;
  white-space: nowrap;
}
.city-search__loading,
.city-search__empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}
.city-search__loading i {
  margin-right: 8px;
  color: var(--color-primary);
}

/* Скрываем популярные города когда есть результаты поиска */
.city-search--has-results ~ .city-popular {
  display: none;
}

/* ── Popular Cities ───────────────────────────────────────────── */
.city-popular {
  margin-top: 20px;
}
.city-popular__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}
.city-popular__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.city-popular__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-text);
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.city-popular__btn:hover {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, var(--color-primary-light) 0%, rgba(0, 126, 255, 0.06) 100%);
  color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 126, 255, 0.12);
}
.city-popular__btn:active {
  transform: translateY(0);
}
.city-popular__btn i {
  color: var(--color-primary);
  font-size: 0.875rem;
  flex-shrink: 0;
  opacity: 0.6;
}
.city-popular__btn:hover i {
  opacity: 1;
}

/* ── Delivery Info Block (Product Detail & Cart) ──────────────── */
.delivery-info {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.product-delivery-block {
  margin-top: 16px;
}
.product-delivery-block .delivery-info {
  margin-top: 0;
}
/* Внутри cart-summary — без двойного бордера/фона */
.cart-summary__panel .delivery-info {
  background: transparent;
  border: none;
  border-top: 1px solid var(--color-border-light);
  border-radius: 0;
  padding: 16px 0 0;
}
.cart-summary__panel .delivery-option {
  background: var(--color-bg);
}
.delivery-info__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.delivery-info__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.delivery-info__title i {
  color: var(--color-primary);
}
.delivery-info__city-link {
  font-size: 0.8125rem;
  color: var(--color-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  font-family: inherit;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
}
.delivery-info__city-link:hover {
  color: var(--color-primary-dark);
}
.delivery-info__loading {
  text-align: center;
  padding: 16px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ── Skeleton loading placeholder ─────────────────────────────── */
@keyframes delivery-skeleton-pulse {
  0%, 100% { opacity: .18; }
  50%      { opacity: .35; }
}
.delivery-skeleton__city {
  display: inline-block;
  width: 80px;
  height: 14px;
  border-radius: 4px;
  background: var(--color-text-muted);
  animation: delivery-skeleton-pulse 1.2s ease-in-out infinite;
}
.delivery-skeleton__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.delivery-skeleton__bar {
  height: 14px;
  border-radius: 4px;
  background: var(--color-text-muted);
  animation: delivery-skeleton-pulse 1.2s ease-in-out infinite;
}
.delivery-skeleton__bar--sm {
  width: 50px;
}

.delivery-info__error {
  text-align: center;
  padding: 12px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ── Delivery Options List ────────────────────────────────────── */
.delivery-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.delivery-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: var(--transition);
}
.delivery-option:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-xs);
}
.delivery-option__left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.delivery-option__logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.delivery-option__logo--cdek {
  background: #00b33c;
  color: #fff;
}
.delivery-option__logo--dl {
  background: #e2001a;
  color: #fff;
}
.delivery-option__logo--pickup {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.delivery-option__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}
.delivery-option__days {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.delivery-option__right {
  text-align: right;
  flex-shrink: 0;
}
.delivery-option__price {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-primary);
}
.delivery-option__price--free {
  color: var(--color-success);
}
.delivery-option__pickup-info {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .city-modal__container {
    max-width: 100%;
    margin: 0 12px;
    border-radius: var(--radius-lg);
  }
  .city-popular__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .delivery-option {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .delivery-option__right {
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
