/* Стили просмотрщика планов этажей (indoor.js). Не зависит от style.css. */

body.indoor-open {
  overflow: hidden;
}

/* ---------- Боковая панель просмотра корпуса ---------- */

:root {
  --indoor-top-offset: var(--app-bar-height, 85px);
}

#indoor {
  position: fixed;
  top: var(--indoor-top-offset);
  left: 0;
  right: auto;
  width: 50vw;
  height: calc(100vh - var(--indoor-top-offset));
  height: calc(100dvh - var(--indoor-top-offset));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 5; /* ниже верхней панели (z-index: 10), выше карты (z-index: 1) */

  display: flex;
  flex-direction: column;

  background: #e5e7eb;
  color: #111827;
  font-family: inherit;

  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
}

#indoor[hidden] {
  display: none;
}

.indoor-close {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.indoor-close:hover {
  background: #f3f4f6;
}

/* Шапка с названием корпуса */

.indoor-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid #d1d5db;
  flex-shrink: 0;
}

.indoor-title {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
}

/* Информация о корпусе */

.indoor-building-info {
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #d1d5db;
  flex-shrink: 0;
}

.indoor-building-info p {
  margin: 4px 0;
  line-height: 1.4;
}

.indoor-room-search {
  flex-shrink: 0;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid #d1d5db;
}

.indoor-room-search-controls {
  display: flex;
  gap: 8px;
}

.indoor-room-search input,
.indoor-room-search button {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.indoor-room-search input {
  flex: 1;
  min-width: 0;
}

.indoor-room-search button {
  cursor: pointer;
}

.indoor-room-search button[type="submit"] {
  background: #247035;
  border-color: #247035;
  color: #fff;
}

.indoor-room-search-message {
  margin: 0;
  font-size: 14px;
}

.indoor-room-search-message:not(:empty) {
  margin-top: 6px;
}

/* Область с планом этажа */

.indoor-body {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Переключатель этажей */
.indoor-floors {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-right: 1px solid #d1d5db;
  overflow-y: auto;
}

.indoor-floor-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.indoor-floor-btn:hover {
  background: #f3f4f6;
}

.indoor-floor-btn[aria-pressed="true"] {
  background: #1f9d3a;
  border-color: #1f9d3a;
  color: #fff;
}

.indoor-floor-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.indoor-floor-cap {
  margin-top: 2px;
  font-size: 10px;
  opacity: 0.8;
}

/* Сцена с планом */
.indoor-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.indoor-stage.is-dragging {
  cursor: grabbing;
}

.indoor-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.indoor-svg {
  display: block;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}

.indoor-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  pointer-events: none;
}

.indoor-status[hidden] {
  display: none;
}

/* Кнопки масштаба */
.indoor-zoom {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: default;
}

.indoor-zoom button {
  width: 40px;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.indoor-zoom button:hover {
  background: #f3f4f6;
}

/* ---------- Помещения на плане ---------- */

.indoor-svg .room {
  cursor: pointer;
  outline: none;
}

.indoor-svg .room:hover > .room-shape {
  fill: #dcfce7;
}

.indoor-svg .room:focus-visible > .room-shape {
  stroke: #1f9d3a;
  stroke-width: 4;
}

.indoor-svg .room.is-selected > .room-shape {
  fill: #86efac;
  stroke: #15803d;
  stroke-width: 5;
}

/* ---------- Карточка помещения ---------- */

.indoor-room {
  position: relative;
  width: 260px;
  min-width: 220px;
  max-height: 100%;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 12px 14px;
  background: #f9fafb;
  border-left: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0;
}

.indoor-room-title {
  margin: 0 0 8px;
  font-size: 20px;
}

.indoor-room-sub {
  margin: 0 0 4px;
  color: #4b5563;
}

.indoor-room-hint {
  color: #6b7280;
  margin: 12px 0 0;
}

.indoor-room-fields {
  margin: 14px 0 0;
}

.indoor-room-fields dt {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.indoor-room-fields dd {
  margin: 2px 0 0;
}

/* ---------- Кнопка в панели корпуса на карте ---------- */

.indoor-open-btn {
  margin-top: 12px;
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  background: #1f9d3a;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.indoor-open-btn:hover {
  background: #178a31;
}

@media (max-width: 700px) {
  #indoor {
    width: 100%;
    left: 0;
    right: auto;
    padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  }

  .indoor-room-search input {
    font-size: 16px;
  }

  .indoor-header,
  .indoor-building-info,
  .indoor-room-search {
    padding: 8px 14px;
  }

  .indoor-title {
    font-size: 18px;
  }

  .indoor-close,
  .indoor-room-search-controls > * {
    min-height: 44px;
  }

  .indoor-zoom button {
    width: 44px;
    height: 44px;
  }

  .indoor-floors {
    padding: 8px;
  }

  .indoor-floor-btn {
    width: 46px;
    height: 46px;
  }

  .indoor-room {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 45%;
    border-left: 0;
    border-top: 1px solid #d1d5db;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(105%);
    transition: transform 0.2s ease;
  }

  .indoor-room.has-selection {
    transform: none;
  }
}
