:root {
  --primary-color: #007AFF;
  --primary-hover: #0056b3;
  --danger-color: #FF3B30;
  --danger-hover: #d32f2f;
  --text-color: #1C1C1E;
  --text-secondary: #8E8E93;
  --bg-color: #F2F2F7;
  --card-bg: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  overflow: hidden;
  background-color: var(--bg-color);
  -webkit-tap-highlight-color: transparent;
}

/* Промо-баннер */
.promo-banner {
  position: fixed;
  bottom: 120px;
  left: 90px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 70%;
  text-align: left;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.promo-banner:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  background: white;
}

.promo-banner:active {
  transform: scale(0.98);
}

/* Панель фильтров внизу - полная ширина */
.bottom-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 12px 16px 16px 16px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.panel-btn.filters-btn {
  width: 100%;
  padding: 16px 28px;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--text-color);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.panel-btn.filters-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: #333;
}

.panel-btn.filters-btn:active {
  transform: scale(0.96);
}

.panel-btn.filters-btn img {
  filter: brightness(0) invert(1);
}

/* Кнопки в правом нижнем углу (над фильтром) */
.corner-buttons {
  position: fixed;
  bottom: 90px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1001;
}

.corner-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.corner-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.corner-btn:active {
  transform: scale(0.95);
}

.corner-btn.urgent {
  background: var(--danger-color);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
}

.corner-btn.urgent:hover {
  background: var(--danger-hover);
}

.corner-btn.urgent img {
  filter: brightness(0) invert(1);
}

/* Контейнер для кнопки + подписи */
.button-with-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  position: relative;
}

/* Подпись слева от кнопки - всегда видна на мобильных */
.label-bg {
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(8px);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

/* На десктопе показываем при наведении */
@media (min-width: 769px) {
  .label-bg {
    opacity: 0;
    transform: translateX(10px);
  }

  .button-with-label:hover .label-bg {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Модальное окно (Фильтры) */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: var(--card-bg);
  margin: 10% auto;
  padding: 24px;
  width: 90%;
  max-width: 360px;
  border-radius: 24px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  padding: 8px;
}

.close:hover {
  color: var(--text-color);
}

.modal-content h3 {
  margin: 0 0 20px 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-color);
}

.filters-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: #F9F9F9;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.filter-item:active {
  background: #E5E5EA;
}

.filter-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  accent-color: var(--primary-color);
}

.filter-label {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  padding: 14px;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.full-width {
  width: 100%;
}

/* Карточка туалета (Модалка) */
.modal-toilet {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  background: var(--card-bg);
  padding: 0;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  width: 360px;
  max-width: 90%;
  font-family: var(--font-family);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-toilet-header {
  padding: 20px;
  border-bottom: 1px solid #F0F0F0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: white;
}

.modal-toilet-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
  padding-right: 20px;
}

.modal-toilet-close {
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-toilet-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
  -webkit-overflow-scrolling: touch;
}

.modal-toilet-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 500;
}

.modal-toilet-tags {
  display: flex;
  margin-bottom: 24px;
}

.modal-toilet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.btn-action {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-action:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: #F2F2F7;
  color: var(--text-color);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid #FF3B30;
  color: #FF3B30;
}

.reviews-section {
  border-top: 1px solid #F0F0F0;
  padding-top: 16px;
}

.review-item {
  background: #F9F9F9;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 8px;
}

/* Всплывающее окно с информацией о маршруте */
.route-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--card-bg);
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 2500;
  min-width: 280px;
  max-width: 90%;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.route-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.route-popup-icon {
  width: 56px;
  height: 56px;
  background: var(--gradient, linear-gradient(135deg, var(--primary-color) 0%, #00C6FF 100%));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(0, 122, 255, 0);
  }
}

.route-popup-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color);
  text-align: center;
  margin-bottom: 8px;
}

.route-popup-time {
  font-size: 32px;
  font-weight: 800;
  background: var(--gradient, linear-gradient(135deg, var(--primary-color) 0%, #00C6FF 100%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 12px;
}

.route-popup-distance {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
}

.route-popup-close {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.route-popup-close:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.route-popup-close:active {
  transform: scale(0.98);
}

.route-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2499;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.route-popup-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* === MOBILE MEDIA QUERIES === */
@media (max-width: 768px) {
  .promo-banner {
    bottom: 870px;
    width: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
  }

  .tag {
    background: #F2F2F7;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-color);
    font-weight: 500;
  }

  .modal-toilet-info {
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 24px;
  }

  .modal-toilet-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
  }

  .btn-action {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .btn-action:active {
    transform: scale(0.98);
  }

  .btn-secondary {
    background: #F2F2F7;
    color: var(--text-color);
  }

  .btn-danger-outline {
    background: transparent;
    border: 1px solid #FF3B30;
    color: #FF3B30;
  }

  .reviews-section {
    border-top: 1px solid #F0F0F0;
    padding-top: 16px;
  }

  .review-item {
    background: #F9F9F9;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 8px;
  }

  /* Всплывающее окно с информацией о маршруте */
  .route-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--card-bg);
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2500;
    min-width: 280px;
    max-width: 90%;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .route-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
  }

  .route-popup-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient, linear-gradient(135deg, var(--primary-color) 0%, #00C6FF 100%));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
    animation: pulse 2s ease-in-out infinite;
  }

  @keyframes pulse {

    0%,
    100% {
      transform: scale(1);
      box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
    }

    50% {
      transform: scale(1.05);
      box-shadow: 0 0 0 10px rgba(0, 122, 255, 0);
    }
  }

  .route-popup-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 8px;
  }

  .route-popup-time {
    font-size: 32px;
    font-weight: 800;
    background: var(--gradient, linear-gradient(135deg, var(--primary-color) 0%, #00C6FF 100%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 12px;
  }

  .route-popup-distance {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
  }

  .route-popup-close {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .route-popup-close:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }

  .route-popup-close:active {
    transform: scale(0.98);
  }

  .route-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2499;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .route-popup-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* --- Detailed Review Ratings --- */
  .star-rating-small {
    font-size: 20px;
    color: #ddd;
    cursor: pointer;
    display: inline-block;
    transition: color 0.2s;
  }

  .star-rating-small:hover {
    color: #FFE066;
  }

  .review-tag {
    background: #F2F2F7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
}

/* ============================================
   СТИЛИ ДЛЯ СИСТЕМЫ АВТОРИЗАЦИИ
   Добавить этот код в конец файла map/style.css
   ============================================ */

/* Секция авторизации пользователя */
.user-auth-section {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.user-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 16px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-info span {
    font-weight: 600;
    color: #333;
}

.logout-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #ff3838;
    transform: scale(1.05);
}

/* Поля ввода */
.input-field {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
}

/* Кнопки */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #f8f9ff;
}

/* Popup профиля пользователя */
.user-profile-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.3s ease;
}

.profile-content {
    padding: 30px;
    position: relative;
}

.profile-content h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
}

.profile-content p {
    margin: 12px 0;
    color: #666;
    font-size: 14px;
}

.profile-content strong {
    color: #333;
}

.close-popup {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.close-popup:hover {
    color: #333;
}

/* Popup лидерборда */
.leaderboard-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.leaderboard-content {
    padding: 30px;
    position: relative;
}

.leaderboard-content h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
    text-align: center;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.leaderboard-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.leaderboard-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.leaderboard-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.leaderboard-table tr:hover {
    background: #f8f9ff;
}

.leaderboard-table tr:first-child td {
    font-weight: 700;
    color: #FFD700;
}

.leaderboard-table tr:nth-child(2) td {
    font-weight: 600;
    color: #C0C0C0;
}

.leaderboard-table tr:nth-child(3) td {
    font-weight: 600;
    color: #CD7F32;
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .user-auth-section {
        top: 60px;
        right: 10px;
    }

    .user-login-btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    .profile-content,
    .leaderboard-content {
        padding: 20px;
    }
}