/* ============================================
   Vodomap — Main CSS
   Tailwind CDN + кастомные переменные
   ============================================ */

:root {
  --color-primary:       #1E2A5E;
  --color-primary-hover: #2B3D7B;
  --color-accent:        #00B4D8;
  --color-bg:            #E8F2F7;
  --color-surface:       #FFFFFF;
  --color-map-bg:        #EDF2F4;
  --color-text:          #1A1A2E;
  --color-muted:         #6B7280;
  --color-border:        #D1DDE6;
  --color-success:       #10B981;
  --color-danger:        #EF4444;
}

/* Base */
html { scroll-behavior: smooth; }

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============ КНОПКИ ============ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background-color: var(--color-primary);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn-primary:hover { background-color: var(--color-primary-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background-color: var(--color-accent);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn-accent:hover { background-color: #0099bb; }
.btn-accent:active { transform: scale(0.98); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background-color: transparent;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: 1.5px solid var(--color-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-outline:hover {
  background-color: var(--color-primary);
  color: white;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background-color: transparent;
  color: var(--color-muted);
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-ghost:hover {
  background-color: var(--color-border);
  color: var(--color-text);
}

/* ============ ХЭДЕР ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  height: 36px;
}

.header-logo svg text { fill: white; }
.header-logo svg path[fill="#1E2A5E"] { fill: white; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-nav .btn-ghost {
  color: rgba(255,255,255,0.8);
}
.header-nav .btn-ghost:hover {
  background-color: rgba(255,255,255,0.1);
  color: white;
}

.header-nav .btn-outline {
  color: white;
  border-color: rgba(255,255,255,0.5);
}
.header-nav .btn-outline:hover {
  background-color: rgba(255,255,255,0.15);
  color: white;
}

/* Hamburger для мобильного */
.header-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.header-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: all 0.3s;
}

@media (max-width: 640px) {
  .header-hamburger { display: flex; }
  .header-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background-color: var(--color-primary);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.5rem;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }
  .header-nav.open { display: flex; }
}

/* User avatar в хэдере */
.header-user {
  position: relative;
}
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}
.header-user-btn:hover { background: rgba(255,255,255,0.1); }
.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
}
.header-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  border: 1px solid var(--color-border);
  min-width: 160px;
  overflow: hidden;
  z-index: 200;
}
.header-user-dropdown.open { display: block; }
.header-user-dropdown a {
  display: block;
  padding: 0.625rem 1rem;
  color: var(--color-text);
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.15s;
}
.header-user-dropdown a:hover { background: var(--color-bg); }
.header-user-dropdown a.danger { color: var(--color-danger); }

/* ============ ФУТЕР ============ */
.footer {
  background-color: var(--color-primary);
  color: rgba(255,255,255,0.7);
  padding: 2rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}
.footer-links a:hover { color: white; }

/* ============ КАРТОЧКИ ============ */
.card {
  background: var(--color-surface);
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ============ BADGE ============ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-accent { background: var(--color-accent); color: white; }
.badge-primary { background: var(--color-primary); color: white; }
.badge-muted { background: var(--color-border); color: var(--color-muted); }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-danger { background: #FEE2E2; color: #991B1B; }

/* ============ ФОРМА ============ */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.375rem;
}
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--color-border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0,180,216,0.15);
}
.form-textarea {
  resize: vertical;
  min-height: 100px;
}
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
}

/* ============ ЗВЁЗДНЫЙ РЕЙТИНГ ============ */
.stars {
  display: inline-flex;
  gap: 2px;
}
.star {
  font-size: 1rem;
  color: #D1D5DB;
  cursor: pointer;
  transition: color 0.15s;
}
.star.filled { color: #FBBF24; }
.star:hover { color: #FBBF24; }

/* ============ COOKIE NOTICE ============ */
.cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--color-primary);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  transform: translateY(100%);
  transition: transform 0.4s ease;
}
.cookie-notice.show { transform: translateY(0); }
.cookie-notice p { font-size: 0.875rem; margin: 0; opacity: 0.9; }
.cookie-notice a { color: var(--color-accent); }

/* ============ SCROLL TO TOP ============ */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.scroll-top-btn:hover { background: var(--color-primary-hover); }

/* ============ АНИМАЦИИ ПОЯВЛЕНИЯ ============ */
.fade-in-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Задержки */
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }

/* ============ КАРТА ============ */
#map {
  width: 100%;
  height: 100%;
  background: var(--color-map-bg);
}

/* MapLibre переопределения */
.maplibregl-popup-content {
  border-radius: 0.75rem;
  padding: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 1px solid var(--color-border);
  overflow: hidden;
  min-width: 220px;
}
.maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-group {
  border-radius: 0.5rem !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* Кластеры */
.cluster-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.2s;
}
.cluster-marker:hover { transform: scale(1.1); }
.cluster-marker.large { width: 50px; height: 50px; font-size: 1rem; }

/* Маркер точки */
.point-marker {
  width: 32px;
  height: 40px;
  cursor: pointer;
  transition: transform 0.2s;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.point-marker:hover { transform: scale(1.15) translateY(-2px); }

/* ============ ПАНЕЛЬ ФИЛЬТРОВ ============ */
.filter-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: white;
  z-index: 10;
  box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.filter-panel.hidden { transform: translateX(-100%); }

.filter-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.filter-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

/* Bottom sheet для мобильного */
@media (max-width: 768px) {
  .filter-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 70vh;
    border-radius: 1rem 1rem 0 0;
    transform: translateY(0);
  }
  .filter-panel.hidden { transform: translateY(100%); }
}

/* ============ КАРТОЧКА ВОДОМАТА ============ */
.point-card-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: white;
  z-index: 10;
  box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s ease;
}
.point-card-panel.hidden { transform: translateX(100%); }

@media (max-width: 768px) {
  .point-card-panel {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: 85vh;
    border-radius: 1rem 1rem 0 0;
    transform: translateY(0);
  }
  .point-card-panel.hidden { transform: translateY(100%); }
}

/* Фото карусель */
.photo-carousel {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: var(--color-map-bg);
  flex-shrink: 0;
}
.photo-carousel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.4);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.photo-carousel-nav:hover { background: rgba(0,0,0,0.6); }
.photo-carousel-nav.prev { left: 0.75rem; }
.photo-carousel-nav.next { right: 0.75rem; }

/* ============ АККОРДЕОН FAQ ============ */
.accordion-item {
  border-bottom: 1px solid var(--color-border);
}
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  gap: 1rem;
}
.accordion-trigger:hover { color: var(--color-primary); }
.accordion-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--color-muted);
  transition: transform 0.3s;
}
.accordion-trigger[aria-expanded="true"] .accordion-icon {
  transform: rotate(180deg);
  color: var(--color-accent);
}
.accordion-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.accordion-content.open {
  max-height: 500px;
  padding-bottom: 1.25rem;
}
.accordion-content p {
  color: var(--color-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ============ СЛАЙДЕР ЦЕНЫ ============ */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--color-accent) 0%, var(--color-accent) var(--value, 50%), var(--color-border) var(--value, 50%), var(--color-border) 100%);
  outline: none;
  cursor: pointer;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}

/* ============ ЗАГРУЗКА ============ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

/* ============ УВЕДОМЛЕНИЕ (TOAST) ============ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 320px;
}
.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-danger); }
.toast-info    { background: var(--color-primary); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ============ УТИЛИТЫ ============ */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.section { padding: 4rem 0; }
.divider { border: none; border-top: 1px solid var(--color-border); margin: 0; }

/* Полноэкранная страница (карта) */
.fullscreen-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
