/**
 * СТИЛИ ДЛЯ МОДАЛЬНОГО ОКНА ВЫБОРА ГОРОДА
 */

/* Popup окно в шапке (не блокирующее) */
.city-modal {
  position: fixed;
  top: 78px;
  right: 32px;
  z-index: 12000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s ease;
}

.city-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.city-modal__overlay {
  display: none;
}

.city-modal__content {
  position: relative;
  background: #f7f4ee;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  max-width: 320px;
  width: 320px;
  overflow: hidden;
  backdrop-filter: blur(4px);
}

.city-modal.active .city-modal__content {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.city-modal__header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.city-modal__header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.city-modal__close {
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  padding: 4px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.city-modal__close:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
  background: rgba(33, 150, 243, 0.08);
}

.city-modal__close svg {
  width: 20px;
  height: 20px;
}

/* Body */
.city-modal__body {
  padding: 14px;
  max-height: 380px;
  overflow-y: auto;
}

.city-modal__question {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #1b1e23;
  text-align: center;
}

.city-modal__hint {
  margin: 4px 0 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
}

.city-modal__question strong {
  color: var(--accent-blue);
  font-weight: 700;
}

/* Actions */
.city-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.city-modal__actions .btn {
  padding: 9px 14px;
  font-size: 0.93rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.city-modal__actions .btn-primary {
  background: linear-gradient(135deg, #2f80ed, #56a5f8);
  color: white;
  box-shadow: 0 6px 16px rgba(47, 128, 237, 0.25);
}

.city-modal__actions .btn-primary:hover {
  background: #2b6ad9;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(43, 106, 217, 0.24);
}

.city-modal__actions .btn-secondary {
  background: #f0e8dc;
  color: #1b1e23;
  border-color: rgba(0, 0, 0, 0.06);
}

.city-modal__actions .btn-secondary:hover {
  background: #e7dfd3;
  border-color: rgba(0, 0, 0, 0.12);
  color: #1b1e23;
}

/* Search Block */
.city-modal__search {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.city-modal__search label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1b1e23;
}

.city-modal__search .form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.93rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  transition: all 0.2s ease;
  background: #fff;
  color: #1b1e23;
}

.city-modal__search .form-control:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.12);
}

/* Search Results */
.city-modal__results {
  margin-top: 10px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  background: #fff;
}

.city-modal__results:empty {
  display: none;
}

.city-result__item {
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: #1b1e23;
}

.city-result__item:last-child {
  border-bottom: none;
}

.city-result__item:hover {
  background: #f5f2ec;
  color: #1b1e23;
}

.city-result__item strong {
  display: block !important;
  font-weight: 700;
  color: #1b1e23 !important;
  margin-bottom: 2px;
  font-size: 0.98rem !important;
}

.city-result__region {
  display: block !important;
  font-size: 0.85rem !important;
  color: var(--text-secondary) !important;
}

.city-result__empty {
  padding: 18px;
  text-align: center;
  color: var(--text-secondary, #6b7280);
  font-size: 0.93rem;
}

/* Индикатор города в header */
#cityDisplay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.9rem;
  color: #1f2937 !important;
  background: rgba(249, 250, 251, 0.9);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 16px;
}

#cityDisplay:hover {
  background: #ffffff;
  border-color: #2563eb;
}

#cityDisplay:hover span {
  color: #2563eb !important;
}

#cityDisplay svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: #1f2937 !important;
}

#cityDisplay:hover svg {
  stroke: #2563eb !important;
}

#cityDisplay span {
  font-weight: 500;
  color: #1f2937 !important;
}

/* Адаптивность */
@media (max-width: 768px) {
  .city-modal {
    top: 70px;
    right: 10px;
    left: 10px;
  }
  
  .city-modal__content {
    max-width: 100%;
    width: 100%;
  }
  
  .city-modal__header {
    padding: 14px 16px 10px;
  }
  
  .city-modal__header h3 {
    font-size: 1.1rem;
  }
  
  .city-modal__body {
    padding: 16px;
  }
  
  .city-modal__actions {
    grid-template-columns: 1fr;
  }
  
  .city-modal__question {
    font-size: 1rem;
  }
  
  #cityDisplay {
    font-size: 0.85rem;
    padding: 5px 10px;
    margin-right: 12px;
  }
}

/* Scrollbar для результатов поиска */
.city-modal__results::-webkit-scrollbar {
  width: 8px;
}

.city-modal__results::-webkit-scrollbar-track {
  background: var(--background-secondary, #f9fafb);
  border-radius: 4px;
}

.city-modal__results::-webkit-scrollbar-thumb {
  background: var(--border-color, #e5e7eb);
  border-radius: 4px;
}

.city-modal__results::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary, #6b7280);
}
