/* --- Каталог: Сетка и Фильтры --- */

/* Сетка списка квартир */
.flat-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 30px;
}

/* --- Быстрые фильтры --- */
.catalog-quick-filters {
  margin-bottom: 20px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  padding: 20px;
}

.quick-filters-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-end;
}

/* --- Тулбар --- */
.catalog-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.filter-toggle-btn {
  background-color: #92afc4;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.filter-toggle-btn:hover {
  background-color: #c02020;
}

/* --- Сайдбар --- */
.filter-sidebar {
  position: fixed;
  top: 0;
  right: -400px; /* Скрыт за экраном */
  width: 360px;
  height: 100vh;
  background: #fff;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.filter-sidebar.active {
  right: 0;
}

.filter-sidebar__header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-sidebar__header h2 {
  margin: 0;
  font-size: 20px;
}

.filter-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #888;
}

.filter-sidebar__content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* --- Стили внутри сайдбара --- */
.filters-vertical {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* --- Двойной слайдер (Range Slider) --- */
.range-control {
  position: relative;
}

.range-slider {
  position: relative;
  height: 2px;
  margin-top: 15px;
  margin-bottom: 10px;
}

.range-track {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #e0e0e0;
  border-radius: 2px;
}

.range-fill {
  position: absolute;
  height: 100%;
  background: #333;
  border-radius: 2px;
}

.range-input {
  position: absolute;
  width: 100%;
  height: 2px;
  background: none;
  pointer-events: none; /* Чтобы клики проходили сквозь полоску */
  -webkit-appearance: none;
  top: 0;
  margin: 0;
}

/* Стилизация ползунка (Thumb) */
.range-input::-webkit-slider-thumb {
  pointer-events: auto; /* Включаем клики для кругляшка */
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #333;
  /*border: 2px solid #fff;*/
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  /*margin-top: -1.px;*/ /* Центрируем относительно трека */
}

.range-input::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  background: #333;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translateY(-7px);
}

/* --- Остальные стили фильтров --- */
.filter-item label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.filter-select,
.range-inputs input {
  width: 100%;
  font-size: 14px;
}

.range-inputs {
  display: flex;
  gap: 10px;
}

.doubled-inputs {
  width: 220px;
}

.doubled-inputs, .filter-select {
  border: solid 1px #ddd;
  border-radius: 8px;
  padding: 10px;
}

.doubled-inputs input {
  border: none;
}

.doubled-inputs > input:nth-child(1) {
  border-right: solid 1px #ddd;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.checkbox-filters-vertical {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cb-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cb-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.cb-group label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Кнопки фильтра комнат (вместо радио) */
.rooms-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.room-btn {
  cursor: pointer;
  margin: 0;
}

.room-btn input {
  display: none;
}

.room-btn span {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
  color: #333;
  transition: all 0.2s;
  background: #fff;
}

.room-btn input:checked + span {
  background: #333;
  color: #fff;
  border-color: #333;
}

.room-btn span:hover {
  border-color: #999;
}

/* --- Карточка квартиры (в списке) --- */
.flat-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  overflow: hidden;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}

.flat-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  border-color: transparent;
}

.flat-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
}

.flat-meta {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
}

.flat-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.flat-price-box {
  margin-bottom: 16px;
}

.flat-old-price {
  text-decoration: line-through;
  color: #aaa;
  font-size: 14px;
  margin-bottom: 2px;
}

.flat-price {
  font-size: 22px;
  font-weight: 700;
  color: #92afc4; /* Акцентный красный */
}

.flat-price-note {
  font-size: 12px;
  color: #92afc4;
  opacity: 0.8;
}

.flat-image {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 20px;
}

.flat-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.flat-info {
  margin-top: 30px;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.flat-project {
  font-weight: 500;
  color: #333;
}

.flat-tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flat-tag {
  background: #f5f5f5;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: #555;
}

/* --- Страница квартиры (Детальная) --- */
.flat {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 60px;
  margin-top: 40px;
  align-items: start;
}

@media (max-width: 900px) {
  .flat {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

/* Левая колонка: Медиа и Солнышко */
.flat-media {
  background: #fff;
  border-radius: 24px;
  padding: 40px;
  position: relative;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0f0f0;
}

.flat-plan-wrapper {
  /* aspect-ratio: 2.13; */
  display: block;
  margin-top: 80px;
  max-width: 700px; /* Ограничиваем максимальную ширину плана */
  position: relative;
  width: 100%;
}

.flat-plan-img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Компас --- */
.flat-compass {
  position: absolute;
  top: 30px;
  right: 30px;
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 50%;
  border: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

/* --- Виджет траектории солнца (на плане) --- */
.sun-label {
  /* opacity: 0.3; */
  position: absolute;
  top: 30%;
  font-size: 0.7rem;
  padding: 1px 12px;
  background-color: #fff;
  border: solid 1px orange;
  border-radius: 10px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.label-sunset,
.label-sunrise {
  left: 0;
  top: 0;
}

.sun-path-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Чтобы клики проходили сквозь слой */
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-curve {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #fbc02d; /* Желтый цвет дуги */
  stroke-width: 2px;
  stroke-dasharray: 6 4; /* Пунктир */
  opacity: 0.6;
}

/* Маркер солнца внутри SVG */
.sun-icon-marker {
  font-size: 24px;
  /* Убираем абсолютное позиционирование, так как теперь это SVG text */
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  cursor: default;
}

.sun-marker-group {
  transition: offset-distance 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  offset-path: path("M 40,70 A 120,120 0 1,0 270,75");
  offset-rotate: 0deg; /* Солнце всегда вертикально, не вращается по касательной */
}

.state-morning .sun-marker-group {
  offset-distance: 90%; /* Утро: справа, ближе к восходу */
}
.state-day .sun-marker-group {
  offset-distance: 50%; /* День: зенит */
}
.state-evening .sun-marker-group {
  offset-distance: 10%; /* Вечер: слева, ближе к закату */
}

/* Виджет Солнышко */
.flat-sun-widget {
  position: absolute;
  top: 30px;
  left: 30px;
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 10;
}

.sun-controls {
  display: flex;
  background: #f2f2f2;
  border-radius: 20px;
  padding: 4px;
}

.sun-btn {
  border: none;
  background: none;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  transition: all 0.2s;
}

.sun-btn.active {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: #000;
  font-weight: 500;
}

.sun-visual {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background-color 0.3s ease;
}

/* Состояния солнышка */
.sun-morning {
  background-color: #fff9c4;
  color: #fbc02d;
} /* Светло-желтый */
.sun-day {
  background-color: #e1f5fe;
  color: #0288d1;
} /* Светло-голубой */
.sun-evening {
  background-color: #f3e5f5;
  color: #8e24aa;
} /* Светло-фиолетовый */

/* Правая колонка: Инфо */
.flat-header h1 {
  font-size: 28px;
  margin: 0 0 10px 0;
  line-height: 1.2;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: #888;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.back-link:hover {
  color: #333;
}

.flat-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 30px 0;
  background: #f9f9f9;
  padding: 24px;
  border-radius: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-item .label {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.detail-item .value {
  font-size: 15px;
  font-weight: 500;
  color: #222;
}

.flat-main-price {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid #eee;
}

.flat-main-price .old-price {
  text-decoration: line-through;
  color: #aaa;
  font-size: 18px;
  margin-bottom: 4px;
}

.flat-main-price .current-price {
  font-size: 36px;
  font-weight: 700;
  color: #92afc4;
}

.flat-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.flat-tags-list .flat-tag {
  font-size: 13px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #e0e0e0;
}

/* --- Утилиты (Layout) --- */
.footer-nav a {
  display: inline-block;
  padding: 20px 0;
}

.flex {
  display: flex;
}

.flex.justify-between {
  justify-content: space-between;
}

.flex.items-center {
  align-items: center;
}

.site-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

/* switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 999px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4caf50;
}

input:checked + .slider::before {
  transform: translateX(22px);
}

/* */
.w-full {
  width: 100%;
}
/* --- Flat gallery --- */
.flat-gallery { width: 100%; }
.flat-gallery-main {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #f6f5f4;
}
.flat-gallery-main img {
    width: 100%;
    display: block;
    transition: opacity 0.3s ease;
}
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(255,255,255,0.85);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.gallery-arrow:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.gallery-arrow--prev { left: 10px; }
.gallery-arrow--next { right: 10px; }

.flat-gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.gallery-thumb {
    width: 72px;
    height: 54px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s;
    flex-shrink: 0;
}
.gallery-thumb.active,
.gallery-thumb:hover {
    border-color: var(--color-accent);
    opacity: 1;
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
