* {
  box-sizing: border-box;
}

#elementModal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: flex-start;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  overflow-y: auto;
  padding: 40px;
}

/* Контейнер модалки */
#elementModal .em-modal {
  width: 1150px;
  background: #1c2541;
  border: 1px solid #3a506b;
  border-radius: 20px;
  display: grid;
  grid-template-columns: 72% 28%;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0,0,0,0.3);
  position: relative;
}

/* Кнопка закрытия */
#elementModal .em-close-btn {
  position: absolute;
  right: 25px;
  top: 20px;
  font-size: 34px;
  cursor: pointer;
  color: #00eaff;
  transition: 0.2s;
  z-index: 100;
}
#elementModal .em-close-btn:hover {
  transform: rotate(90deg);
  color: #fff;
}

/* Левая панель */
#elementModal .em-left-panel {
  padding: 30px;
  overflow-y: auto;
  max-height: 90vh;
}

/* Правая панель */
#elementModal .em-right-panel {
  background: #1b2a49;
  border-left: 1px solid #3a506b;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Заголовок */
#elementModal .em-modal-header h1 {
  font-size: 40px;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
#elementModal .em-modal-header small {
  font-size: 22px;
  color: #5bc0be;
}

/* Карточки свойств */
#elementModal .em-properties-top {
  margin-top: 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
#elementModal .em-property-card {
  flex: 1;
  min-width: 140px;
  background: #16213e;
  border-radius: 12px;
  padding: 10px;
  text-align: left;
  color: #e0f7ff;
  box-shadow: inset 0 0 8px rgba(0,255,255,0.12);
}

/* Tabs */
#elementModal .em-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 25px;
  border-bottom: 1px solid #3a506b;
}
#elementModal .em-tab {
  padding: 10px 16px;
  cursor: pointer;
  color: #a0bfe0;
}
#elementModal .em-tab:hover { background: #1b2a49; }
#elementModal .em-tab.active {
  color: #00eaff;
  border-bottom: 2px solid #00eaff;
}

/* Tabs content */
#elementModal .em-tab-content {
  display: none;
  margin-top: 20px;
  color: #fff;
}
#elementModal .em-tab-content.active {
  display: block;
  animation: emFade 0.3s ease-in-out;
}
@keyframes emFade {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Таблицы */
#elementModal table {
  width: 100%;
  border-collapse: collapse;
  color: #e8f0ff;
}
#elementModal td {
  padding: 8px 10px;
  border-bottom: 1px solid #3a506b;
}

/* Правая панель заголовок */
#elementModal .em-section-title {
  font-size: 22px;
  color: #00eaff;
  text-align: center;
  margin-bottom: 12px;
}

/* Swiper */
#elementModal .swiper {
  width: 100%;
  height: 280px;
  border-radius: 12px;
  overflow: hidden;
}
#elementModal .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

/* Lightbox */
#elementModal .em-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
}
#elementModal .em-lightbox.active {
  display: flex;
}
#elementModal .em-lightbox img {
  max-width: 80vw;
  max-height: 80vh;
  border-radius: 12px;
}

/* Кастомный скроллбар */
#elementModal .em-left-panel {
  scrollbar-width: thin;
  scrollbar-color: #00eaff #0b1324;
}
#elementModal .em-left-panel::-webkit-scrollbar { width: 8px; }
#elementModal .em-left-panel::-webkit-scrollbar-track { background: #0b1324; border-radius: 4px; }
#elementModal .em-left-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00eaff, #7b2ff7);
  border-radius: 4px;
}
#elementModal .em-left-panel::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #33f3ff, #9b5dff);
}

/* Стрелки и пагинация слайдера */
#elementModal .em-swiper .swiper-button-next,
#elementModal .em-swiper .swiper-button-prev {
  color: #00eaff;
}
#elementModal .em-swiper .swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.4);
  opacity: 1;
}
#elementModal .em-swiper .swiper-pagination-bullet-active {
  background: #00eaff;
}

/* === ✅ Адаптив для мобильных устройств === */
@media (max-width: 900px) {
  #elementModal {
    align-items: center;
    padding: 20px;
  }

  #elementModal .em-modal {
    width: 95%;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow-y: auto;
    max-height: 90vh;
  }

  #elementModal .em-left-panel {
    order: 1; /* Текст сверху */
    padding: 20px;
    max-height: none;
  }

  #elementModal .em-right-panel {
    order: 2; /* Картинки снизу */
    width: 100%;
    border-left: none;
    border-top: 1px solid #3a506b;
    padding: 16px;
    background: #16213e;
  }

  #elementModal .em-modal-header h1 {
    font-size: 28px;
  }

  #elementModal .em-tabs button {
    font-size: 0.9em;
  }

  #elementModal .swiper {
    height: 220px;
  }
}
