/* ==============================================================================
   КАНАЛ ПАМЯТИ — ИНТЕРАКТИВНЫЙ АТЛАС & КАРТА
   Стили: Dark Constructivism, Fluid Memory, Glassmorphism, Touch-Table Ready
   ============================================================================== */

/* Базовый контейнер Атласа */
.atlas-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - 72px);
  background: #080b10;
  color: #f0f4f8;
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* Верхняя панель управления Атласом */
.atlas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(14, 20, 28, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  z-index: 1000;
  gap: 16px;
  flex-wrap: wrap;
}

.atlas-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.atlas-title {
  font-family: 'Cinzel', 'Oswald', 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.atlas-km-badge {
  font-size: 0.72rem;
  padding: 2px 7px;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: #00f2fe;
  border-radius: 12px;
  font-weight: 600;
}

/* Фильтр слоев (Pills) */
.atlas-layers-bar {
  display: flex;
  gap: 6px;
  background: rgba(10, 14, 20, 0.7);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.atlas-layer-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.atlas-layer-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}

.atlas-layer-btn.active {
  background: rgba(0, 242, 254, 0.18);
  color: #00f2fe;
  border: 1px solid rgba(0, 242, 254, 0.35);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

/* Ползунок «Осушение канала / Уровень воды» */
.atlas-water-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #94a3b8;
  background: rgba(10, 14, 20, 0.6);
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.atlas-water-slider {
  width: 90px;
  accent-color: #00f2fe;
  cursor: pointer;
}

.atlas-sound-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.atlas-sound-btn.active {
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

/* ==============================================================================
   ВИДЖЕТ «ВОДЯНАЯ ЛЕСТНИЦА» (Инженерный высотный срез)
   ============================================================================== */
.atlas-staircase-panel {
  width: 100%;
  height: 160px;
  min-height: 160px;
  background: #0a0d14;
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.staircase-header {
  position: absolute;
  top: 8px;
  left: 20px;
  font-size: 0.7rem;
  color: #64748b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 5;
  display: flex;
  gap: 16px;
}

.staircase-canvas-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}

.staircase-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Канвас частиц памяти */
.atlas-particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ==============================================================================
   ГЕОГРАФИЧЕСКИЙ РАЗДЕЛ (Leaflet Map)
   ============================================================================== */
.atlas-main-content {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.atlas-map-view {
  flex: 1;
  height: 100%;
  background: #080b10;
  position: relative;
}

/* Leaflet Dark Theme Overrides */
.leaflet-container {
  background: #080b10 !important;
  font-family: 'Inter', sans-serif !important;
}

.leaflet-bar a {
  background-color: rgba(15, 23, 42, 0.9) !important;
  color: #f1f5f9 !important;
  border-color: rgba(56, 189, 248, 0.2) !important;
}

.leaflet-bar a:hover {
  background-color: rgba(30, 41, 59, 0.95) !important;
  color: #00f2fe !important;
}

/* Кастомные маркеры на карте */
.canal-marker-node {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.canal-marker-node:hover {
  transform: scale(1.25);
  z-index: 1000 !important;
}

.canal-marker-inner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
  border: 2px solid #fff;
  transition: all 0.2s;
}

/* Цвета категорий маркеров */
.marker-type-lock .canal-marker-inner {
  background: #0284c7;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.marker-type-cutting .canal-marker-inner {
  background: #e11d48;
  border-color: #fda4af;
  box-shadow: 0 0 14px rgba(225, 29, 72, 0.7);
}

.marker-type-memorial .canal-marker-inner {
  background: #d97706;
  border-color: #fde68a;
  box-shadow: 0 0 14px rgba(217, 119, 6, 0.8);
}

.marker-type-camp .canal-marker-inner {
  background: #475569;
  border-color: #94a3b8;
}

.marker-type-port .canal-marker-inner {
  background: #0d9488;
  border-color: #5eead4;
}

/* ==============================================================================
   ИНСПЕКТОР УЗЛА (Боковая панель деталей Drawer)
   ============================================================================== */
.atlas-inspector-drawer {
  width: 440px;
  max-width: 90vw;
  height: 100%;
  background: rgba(11, 15, 22, 0.94);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  right: -460px;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1200;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.atlas-inspector-drawer.open {
  right: 0;
}

.inspector-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.inspector-title-wrap h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
}

.inspector-subtitle {
  font-size: 0.78rem;
  color: #38bdf8;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.inspector-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.inspector-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Вкладки инспектора */
.inspector-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 11, 16, 0.5);
}

.inspector-tab-btn {
  flex: 1;
  padding: 10px 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.inspector-tab-btn.active {
  color: #00f2fe;
  border-bottom-color: #00f2fe;
  background: rgba(0, 242, 254, 0.04);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}

.inspector-quote-box {
  background: rgba(255, 179, 0, 0.08);
  border-left: 3px solid #ffb300;
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 16px;
  font-family: 'Merriweather', serif;
  font-size: 0.82rem;
  font-style: italic;
  color: #fef08a;
  line-height: 1.5;
}

.inspector-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.inspector-metric-card {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-label {
  font-size: 0.68rem;
  color: #64748b;
  display: block;
}

.metric-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: #38bdf8;
}

.inspector-desc-text {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 20px;
}

/* Список документов */
.inspector-doc-item {
  display: block;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 8px;
  text-decoration: none;
  color: #f1f5f9;
  transition: all 0.2s;
}

.inspector-doc-item:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.25);
  transform: translateX(4px);
}

.doc-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e8f0;
}

.doc-item-meta {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 2px;
}

/* Миниатюры фото */
.inspector-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.inspector-photo-thumb {
  aspect-ratio: 4/3;
  border-radius: 6px;
  overflow: hidden;
  background: #1e293b;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.2s;
}

.inspector-photo-thumb:hover {
  transform: scale(1.05);
}

.inspector-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==============================================================================
   АДАПТИВНОСТЬ ДЛЯ ИНТЕРАКТИВНОГО СТОЛА И МОБИЛЬНЫХ
   ============================================================================== */
@media (max-width: 768px) {
  .atlas-toolbar {
    padding: 8px 12px;
  }
  .atlas-staircase-panel {
    height: 110px;
    min-height: 110px;
  }
  .atlas-inspector-drawer {
    width: 100%;
    max-width: 100%;
    top: auto;
    bottom: -100%;
    right: 0;
    height: 70vh;
    border-left: none;
    border-top: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 16px 16px 0 0;
    transition: bottom 0.35s ease;
  }
  .atlas-inspector-drawer.open {
    bottom: 0;
    right: 0;
  }
}
