/* --- Глобальные настройки --- */

.laut-iv-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 80px;
  margin-right: 15px;
  flex-shrink: 0;
}

.laut-iv-thumb {
  border: 1px solid #e0e0e0;
  background: #fff;
  padding: 3px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}
.laut-iv-thumb.is-active { border-color: #333; box-shadow: 0 0 0 1px #333; }
.laut-iv-thumb img {
  display: block; width: 100%; height: auto; border-radius: 5px;
}

/* --- МОДАЛЬНОЕ ОКНО --- */
.laut-iv-modal {
  position: fixed; inset: 0;
  z-index: 2147483647; 
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.laut-iv-modal.is-open { display: block; }

.laut-iv-modal__backdrop {
  position: absolute; inset: 0; background: #fff; 
}

.laut-iv-modal__content {
  position: absolute; inset: 0;
  overflow: hidden;
  display: flex; flex-direction: column;
}

.laut-iv-close {
  position: absolute; top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid #eee;
  background: #fff;
  cursor: pointer;
  font-size: 28px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.2s; color: #333;
}
.laut-iv-close:hover { transform: scale(1.1); }

/* --- СЦЕНА (CANVAS) --- */
.laut-iv-stage {
  position: absolute;
  /* Отступы 60px от краев для картинки */
  top: 60px; left: 60px; right: 60px; bottom: 60px;
  /* Фон под картинкой (если пропорции не совпадают, будет виден этот цвет) */
  background: #f8f8f8; 
  z-index: 1;
  border-radius: 8px;
  /* box-shadow removed to look cleaner with 'contain' mode */
}

.laut-iv-canvas {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: 8px;
}

/* --- УПРАВЛЕНИЕ (ПАНЕЛИ) --- */
.laut-iv-left::-webkit-scrollbar, .laut-iv-right::-webkit-scrollbar { display: none; }
.laut-iv-left, .laut-iv-right { -ms-overflow-style: none; scrollbar-width: none; }

/* ЛЕВАЯ ПАНЕЛЬ (Интерьеры) - DESKTOP */
/* Выносим за пределы stage, фиксируем от края экрана */
.laut-iv-left {
  position: absolute;
  top: 50%;
  left: 30px; /* Отступ 30px от края экрана */
  transform: translateY(-50%);
  z-index: 10;
  max-height: 80vh;
  overflow-y: auto;
  padding: 10px;
}

.laut-iv-left .laut-iv-rail {
  display: flex; flex-direction: column; gap: 12px;
}

/* ПРАВАЯ ПАНЕЛЬ (Вариации дверей) - DESKTOP */
/* Выносим за пределы stage, фиксируем от края экрана */
.laut-iv-right {
  position: absolute;
  bottom: 30px; /* Отступ 30px снизу */
  right: 30px;  /* Отступ 30px справа */
  z-index: 10;
  background: #fff;
  padding: 10px 15px;
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.15);
  max-width: 60vw;
  overflow-x: auto;
}

.laut-iv-right .laut-iv-rail {
  display: flex; flex-direction: row; gap: 12px;
}

/* Элементы списков (Desktop по умолчанию) */
.laut-iv-item {
  position: relative;
  width: 60px; height: 90px;
  border: 2px solid transparent;
  border-radius: 4px;
  padding: 0;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.laut-iv-item:hover { transform: translateY(-2px); }
.laut-iv-item.is-active { border-color: #333; }
.laut-iv-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* --- МОБИЛЬНАЯ ВЕРСИЯ (< 768px) --- */
@media (max-width: 768px) {
  
  .laut-iv-modal__content {
    display: flex; flex-direction: column; background: #fff;
  }

  /* Сцена */
  .laut-iv-stage {
    position: relative;
    top: 0; left: 0; right: 0; bottom: 0; 
    width: 100%;
    height: 45vh; /* Высота области просмотра */
    flex-shrink: 0;
    border-radius: 0;
    background: #eee;
  }

  /* Панели */
  .laut-iv-left, .laut-iv-right {
    position: relative;
    top: auto; left: auto; right: auto; bottom: auto;
    transform: none;
    width: 100%;
    max-width: none; max-height: none;
    background: #fff;
    box-shadow: none;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
  }

  .laut-iv-left { order: 2; border-bottom: 1px solid #eee; }
  .laut-iv-right { order: 3; background: #fff; padding-bottom: 20px; }

  .laut-iv-left .laut-iv-rail,
  .laut-iv-right .laut-iv-rail {
    flex-direction: row;
    overflow-x: auto;
    gap: 12px;
  }

  /* --- РАЗМЕРЫ ЭЛЕМЕНТОВ (MOBILE) --- */
  
  /* 1. Интерьеры (Дизайн) - КВАДРАТНЫЕ */
  /* Рассчитываем ширину, чтобы влезало ~3.5 штуки */
  .laut-iv-left .laut-iv-item {
    width: 80px; 
    height: 80px; /* Квадрат */
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
  }

  /* 2. Двери - ВЫСОКИЕ (чтобы влезали полностью) */
  /* Рассчитываем ширину, чтобы влезало ~4.5 штуки */
  .laut-iv-right .laut-iv-item {
    width: 70px;
    height: 140px; /* Увеличили высоту, чтобы дверь не резалась */
    flex-shrink: 0;
    border: 1px solid #eee; /* Легкая рамка для белых дверей */
  }
  
  /* Картинка внутри кнопки двери должна вписываться (contain), 
     чтобы ручки и верх/низ двери были видны */
  .laut-iv-right .laut-iv-item img {
    object-fit: contain; 
    background: #f9f9f9; /* Фон для прозрачных PNG */
  }

  .laut-iv-close {
    top: 10px; right: 10px;
    width: 36px; height: 36px; font-size: 24px;
    background: rgba(255,255,255,0.7);
  }
}