/* Системы доступа: тёмный план этажа и точки поверх него */

#system-access-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: none;
  background: #000;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#system-access-wrapper.is-visible {
  display: block;
}

body.show-system-access #panorama,
body.show-system-access #house-viewer-wrapper,
body.show-system-access #house-cut-wrapper,
body.show-system-access #floor-cut-wrapper {
  display: none !important;
}

body.show-system-access .ui {
  display: block !important;
  z-index: 100;
  pointer-events: auto;
}

#system-access-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  background: #000;
}

#system-access-viewport.is-dragging {
  cursor: grabbing;
}

#system-access-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

#system-access-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

#system-access-pins {
  --sa-zoom: 1.875;
  --sa-icon: calc(15px * var(--sa-zoom));
  --sa-pad: calc(1px * var(--sa-zoom));
  --sa-stem-w: calc(1px * var(--sa-zoom));
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: visible;
  pointer-events: none;
}

.sa-svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.sa-pin {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: max-content;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  transform: none;
  cursor: pointer;
  pointer-events: auto;
}

.sa-pin[hidden] {
  display: none !important;
}

.sa-pin__card {
  display: flex;
  align-items: center;
  gap: calc(3px * var(--sa-zoom));
  max-width: 100%;
  padding: var(--sa-pad) calc(4px * var(--sa-zoom)) var(--sa-pad) var(--sa-pad);
  background: rgba(6, 10, 16, 0.92);
  box-shadow: 0 calc(1px * var(--sa-zoom)) calc(4px * var(--sa-zoom)) rgba(0, 0, 0, 0.45);
}

.sa-pin__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--sa-icon);
  height: var(--sa-icon);
  border: max(1px, calc(0.75px * var(--sa-zoom))) solid var(--sa-pin, #fff);
  color: #fff;
  box-sizing: border-box;
}

.sa-pin__svg {
  display: block;
  width: calc(9px * var(--sa-zoom));
  height: calc(9px * var(--sa-zoom));
}

.sa-pin__label {
  color: #fff;
  font-family: CoFoPeshka, Manrope, sans-serif;
  font-size: calc(7px * var(--sa-zoom));
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

.sa-pin__stem {
  width: var(--sa-stem-w);
  height: calc(20px * var(--sa-zoom));
  margin-left: calc(var(--sa-pad) + var(--sa-icon) / 2 - var(--sa-stem-w) / 2);
  background: var(--sa-pin, #fff);
}

.sa-pin--guests { --sa-pin: #c45cff; }
.sa-pin--residents { --sa-pin: #e4f04a; }
.sa-pin--service { --sa-pin: #3d8cff; }

.sa-pin.is-hover,
.sa-pin.is-selected {
  z-index: 8000 !important;
}

.sa-pin.is-hover .sa-pin__card,
.sa-pin.is-selected .sa-pin__card {
  background: #141a24;
}

#system-access-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-family: CoFoPeshka, Manrope, sans-serif;
  font-size: calc(15px * var(--ui-scale, 0.7));
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

#system-access-loading.is-visible {
  opacity: 1;
  visibility: visible;
}

.sa-drag-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 0.7));
  padding: calc(12px * var(--ui-scale, 0.7)) calc(18px * var(--ui-scale, 0.7));
  border-radius: calc(16px * var(--ui-scale, 0.7));
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--nachalo-line, rgba(255, 255, 255, 0.2));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sa-drag-hint.is-visible {
  opacity: 1;
  visibility: visible;
}

.sa-drag-hint__icon {
  width: calc(56px * var(--ui-scale, 0.7));
  height: calc(56px * var(--ui-scale, 0.7));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none'%3E%3Cpath d='M32 10v8M32 46v8M10 32h8M46 32h8' stroke='%2300ffab' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M32 6l-4 5h8l-4-5zM32 58l-4-5h8l-4 5zM6 32l5-4v8l-5-4zM58 32l-5-4v8l5-4z' fill='%2300ffab'/%3E%3Cpath d='M28.5 34.5V22.2c0-1.3 1-2.2 2.2-2.2s2.2 1 2.2 2.2V34M32.9 25.5V21c0-1.2 1-2.1 2.1-2.1 1.2 0 2.1.9 2.1 2.1v8.2M37.1 27.2v-3.4c0-1.1.9-2 2-2s2 .9 2 2v8.8c0 5.2-3.4 9.4-8.2 10.4-.7.1-1.4.2-2.1.2h-.3c-4.7 0-8.7-3.2-9.8-7.7l-1.9-7.4c-.3-1.2.4-2.4 1.6-2.7 1.1-.3 2.3.4 2.6 1.5l1.1 4.2' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: sa-drag-hint-pulse 1.4s ease-in-out infinite;
}

.sa-drag-hint__text {
  font-family: Manrope, sans-serif;
  font-size: calc(13px * var(--ui-scale, 0.7));
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

@keyframes sa-drag-hint-pulse {
  0%, 100% { transform: scale(1); opacity: 0.75; }
  50% { transform: scale(1.06); opacity: 1; }
}

.sa-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: var(--nachalo-lime, #00ffab);
  border-radius: 50%;
  animation: sa-spin 0.7s linear infinite;
}

@keyframes sa-spin {
  to { transform: rotate(360deg); }
}

.sa-dock {
  position: absolute;
  left: var(--ui-edge, 16px);
  right: auto;
  bottom: var(--ui-edge, 16px);
  z-index: 20;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: calc(12px * var(--ui-scale, 0.7));
  max-width: calc(100% - var(--ui-edge, 16px) * 2);
  pointer-events: auto;
}

.sa-filters {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 2px;
}

.sa-filters__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: max(140px, calc(180px * var(--ui-scale, 0.7)));
  min-height: max(60px, calc(84px * var(--ui-scale, 0.7)));
  margin: 0;
  padding: 8px 18px;
  border: 2px solid #2a2e36;
  background: #05070c;
  color: rgba(255, 255, 255, 0.38);
  font-family: CoFoPeshka, Manrope, sans-serif;
  font-size: max(17px, calc(22px * var(--ui-scale, 0.7)));
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
}

.sa-filters__btn.is-on {
  color: #fff;
  border-color: var(--sa-c, #fff);
}

.sa-filters__btn--residents { --sa-c: #e4f04a; }
.sa-filters__btn--service { --sa-c: #3d7cff; }
.sa-filters__btn--guests { --sa-c: #c45cff; }
.sa-filters__btn--guests.is-on { color: #d07bff; }

.sa-floor {
  position: relative;
  order: -1;
  flex: 0 0 auto;
}

.sa-floor__menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: calc(6px * var(--ui-scale, 0.7));
}

.sa-floor__menu[hidden] {
  display: none !important;
}

.sa-floor__current,
.sa-floor__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: calc(4px * var(--ui-scale, 0.7));
  width: 100%;
  min-width: max(200px, calc(240px * var(--ui-scale, 0.7)));
  min-height: max(60px, calc(84px * var(--ui-scale, 0.7)));
  margin: 0;
  padding: 8px 18px;
  border: 2px solid #1a1e26;
  background: #05070c;
  color: #fff;
  font-family: CoFoPeshka, Manrope, sans-serif;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.sa-floor__item + .sa-floor__item {
  margin-top: calc(-2px * var(--ui-scale, 0.7));
}

.sa-floor__current,
.sa-floor__item.is-current {
  border-color: transparent;
  background: linear-gradient(90deg, #07090e 0%, #07090e 62%, rgba(0, 255, 171, 0.72) 100%);
}

.sa-floor__num {
  color: #fff;
  font-size: max(17px, calc(22px * var(--ui-scale, 0.7)));
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.sa-floor__current .sa-floor__num,
.sa-floor__item.is-current .sa-floor__num {
  color: #7dffe8;
}

.sa-floor__note {
  color: rgba(255, 255, 255, 0.55);
  font-size: max(12px, calc(15px * var(--ui-scale, 0.7)));
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
}

.sa-floor__note[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .sa-dock {
    left: var(--ui-edge, 12px);
    right: auto;
    bottom: var(--ui-edge, 12px);
    max-width: calc(100% - var(--ui-edge, 12px) * 2);
    flex-wrap: nowrap;
  }

  .sa-filters {
    flex: 1 1 auto;
  }

  .sa-filters__btn {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 10px;
    padding-right: 10px;
  }

  .sa-floor {
    flex: 0 0 176px;
  }

  .sa-floor__current,
  .sa-floor__item {
    min-width: 176px;
  }
}
