/**
 * Pan UI — блоки по макету Figma (Pan_draft)
 * Верхний центр: 3 раскрывающихся блока (11-200, 11-283, 11-455)
 * Правый верхний угол: меню (11-15, 12-264)
 * Низ по центру: кнопка «Назад» (11-160)
 */

/* ----- Верхний центр: 3 блока с раскрытием (Figma 11-467 свернуто, 11-397 развернуто) ----- */
.ui_top_blocks {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ui_top_blocks__inner {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 10px 20px;
  height0: 70px;
  min-width: 128px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ui_top_blocks__item {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  /*padding: 6px 0;*/
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text, #000);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.21;
  transition: color 0.2s;
}


.ui_top_blocks__item::after {
  display:none;
  content: '';
  width: 2px;
  height: 30px;
  border-right: 1.5px solid #B4B4B4;
  box-shadow: 1.5px 0px #fff;
  margin-left: 15px;
}
.ui_top_blocks__item:first-child::after {
  display: block;
}

/* Скрыть разделитель справа от «Татарская 35», если справа нет видимых блоков */
.ui_top_blocks__inner.ui_top_blocks__inner--first-only .ui_top_blocks__item:first-child::after {
  display: none;
}

.ui_top_blocks__label{
  border: none;
  background: none;
  color: var(--text, #000);
  cursor: pointer;
  white-space: nowrap;
}

.ui_top_blocks__chevron {
  display: inline-block;
  width: 13px;
  height: 7px;
  background: url("../images/icons/icon_arrow.svg") no-repeat center;
  background-size: 10px;
  transform: rotate(90deg);
  flex-shrink: 0;
  opacity: 0.8;
}

.ui_top_blocks__chevron_up {
  transform: rotate(90deg);
}

/* Выпадающее меню под пунктом. Размытие вынесено в ::before — так backdrop-filter стабильно работает. */
.ui_top_blocks__panel {
  position: absolute;
  left: -20px;
  top: 43px;
  background: transparent;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 11;
  isolation: isolate;
}

.ui_top_blocks__panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.device-mobile.orientation-portrait .ui_top_blocks__panel.ui_top_blocks__panel_yard {
  left: -188px;
}

.ui_top_blocks__panel[hidden] {
  display: none !important;
}

.ui_top_blocks__panel-list {
  position: relative;
  z-index: 1;
  padding: 8px 0;
  border-radius: 10px;
  overflow: hidden;
}

/* Список дворов — в 3 колонки, если пунктов больше 8 */
.ui_top_blocks__panel_yard .ui_top_blocks__panel-list:has(.ui_top_blocks__panel-option:nth-child(9)) {
  column-count: 3;
  column-gap: 8px;
  padding: 8px 12px;
}

.ui_top_blocks__panel_yard .ui_top_blocks__panel-list:has(.ui_top_blocks__panel-option:nth-child(9)) .ui_top_blocks__panel-option {
  break-inside: avoid;
  margin-left: 0;
  margin-right: 0;
  width: 100%;
}

.ui_top_blocks__panel_yard .ui_top_blocks__panel-list:has(.ui_top_blocks__panel-option:nth-child(9)) .ui_top_blocks__panel-option.active {
  width: 100%;
}

.ui_top_blocks__panel-option {
  display: block;
  width: 100%;
  margin: 0px 8px;
  padding: 12px 20px;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.21;
  color: var(--text, #000);
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

/*.ui_top_blocks__panel-option:hover {
  background: rgba(0, 0, 0, 0.05);
}*/

.ui_top_blocks__panel-option.active {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  margin: 0px 8px;
  width: calc(100% - 16px);
  box-sizing: border-box;
}

/* ----- Правый верхний угол: меню — свернуто 50×50 (Figma 131-1952), развернуто боковая панель (Figma 2001-2142) ----- */
.ui_top_menu {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 500;
}

/* Свернутое состояние: кнопка 50×50, glass */
.ui_top_menu__toggle {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
}

.ui_top_menu__toggle:hover {
  background: rgba(255, 255, 255, 0.95);
}

.ui_top_menu__icon {
  width: 17px;
  height: 14px;
  background: url("/assets/images/icons/menu-toggle.svg") no-repeat center;
  background-size: contain;
}

/* Боковая панель: на всю высоту, выезжает справа. Внешний вид задаётся только классом _open. */
.ui_top_menu__sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 290px;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  z-index: 501;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
  overflow: hidden;
}

/* Атрибут hidden не меняет отображение — только класс _open. Так при открытии вид всегда как в дизайне. */
.ui_top_menu__sidebar[hidden] {
  display: flex !important;
}

/* Открытое состояние: по клику добавляется класс — панель выезжает, вид как в дизайне */
.ui_top_menu__sidebar.ui_top_menu__sidebar_open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.3s ease, visibility 0s 0s;
}

.ui_top_menu__sidebar-header {
  flex-shrink: 0;
  height: 70px;
  min-height: 70px;
  background: #8B3B28;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 24px;
  box-sizing: border-box;
}

.ui_top_menu__sidebar-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1em;
  color: #ffffff;
}

.ui_top_menu__sidebar-close {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: opacity 0.2s;
}

.ui_top_menu__sidebar-close:hover {
  opacity: 0.85;
}

.ui_top_menu__sidebar-close-icon {
  width: 10px;
  height: 10px;
  background: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l8 8M9 1L1 9' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

.ui_top_menu__sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ui_top_menu__item {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 46px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
  color: #231F20;
  cursor: pointer;
  transition: background 0.2s;
  box-sizing: border-box;
}

.ui_top_menu__item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.ui_top_menu__item.is-active {
  background: rgba(246, 246, 246, 0.8);
  backdrop-filter: blur(10px);
  color: #8B3B28;
}

.ui_top_menu__divider {
  border: none;
  height: 1.5px;
  background: #B4B4B4;
  margin: 12px 0;
  flex-shrink: 0;
  box-shadow: 0px 1px #fff;
}

.ui_top_menu__divider.ui_top_menu__divider__sub {
    margin: 12px 0 12px 26px;
  }

.ui_top_menu__group {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  position: relative;
  background: none;
}

/* Вертикальная полоса слева от списка (Корпуса / Дворы), по макету x: 27.5 */
.ui_top_menu__group::before {
  content: '';
  position: absolute;
  left: 27.5px;
  top: 40px;
  bottom: 20px;
  width: 1px;
  background: #979797;
  
}

.ui_top_menu__group-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
  color: #979797;
  padding: 10px 20px;
  min-height: 46px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.ui_top_menu__group .ui_top_menu__item_sub {
  font-weight: 500;
  padding-left: 20px;
  margin-left: 45px;
  width: auto;
}

/* Иконки слева от пунктов меню */
.ui_top_menu__item-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.ui_top_menu__item-icon_genplan {
  background-image: url("/assets/images/icons_V2/genplan_icon.svg");
}

.ui_top_menu__item-icon_room {
  background-image: url("/assets/images/icons_V2/room_icon.svg");
}

.ui_top_menu__item-icon_help {
  background-image: url("/assets/images/icons_V2/help_icon.svg");
}

/* ----- Кнопка «Назад» внизу по центру (11-160) ----- */
.ui_btn_back {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  height: 50px;
  min-width: 128px;
  border: none;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: var(--text, #000);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.21;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: background 0.2s, color 0.2s;
}

.ui_btn_back:hover {
  background: rgba(255, 255, 255);
}

.ui_btn_back__arrow {
  width: 18px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg width='18' height='14' viewBox='0 0 18 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17 7H1M1 7l6-6M1 7l6 6' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  flex-shrink: 0;
}


.ui_btn_back__text {
  white-space: nowrap;
}

/* ----- Иконка фильтра в правом нижнем углу (Figma 11-75) ----- */
.ui_filter_btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

.ui_filter_btn:hover {
  background: #f5f5f5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.ui_filter_btn__icon {
  width: 20px;
  height: 20px;
  background: url("../images/icons/icon_filter_dark.svg") no-repeat center;
  background-size: contain;
}

/* ----- Оверлей фильтра (полный экран, крестик в правом верхнем углу) ----- */
.ui_filter_overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.ui_filter_overlay__close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 1001;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  font-size: 28px;
  line-height: 1;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.ui_filter_overlay__close:hover {
  background: #e0e0e0;
}

.ui_filter_overlay__content {
  flex: 1;
  padding: 80px 24px 24px;
  min-height: 100%;
  box-sizing: border-box;
}

.ui_filter_overlay__placeholder {
  font-size: 18px;
  color: #999;
  text-align: center;
  padding: 40px 20px;
}
