/* Затемненный фон модального окна */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(22, 17, 14, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 40px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  user-select: none;
}

.image-modal.open {
  opacity: 1;
  visibility: visible;
}

/* Название товара сверху */
.modal-header {
  position: absolute;
  top: 22px;
  left: 30px;
  right: 80px;
  pointer-events: none;
  z-index: 100000;
}

.modal-product-title {
	text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Кнопка закрытия (крестик) */
.modal-close {
  position: absolute;
  top: 18px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 32px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100001;
  transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}

/* Стрелки влево / вправо */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  transition: background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(6px);
}

.modal-nav:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: translateY(-50%) scale(1.1);
}

.modal-nav.prev { left: 24px; }
.modal-nav.next { right: 24px; }

/* Область изображения */
.modal-content {
  position: relative;
  max-width: 82vw;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.94);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.image-modal.open .modal-content {
  transform: scale(1);
}

.modal-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.45);
  transition: opacity 0.18s ease;
}

/* Нижняя плашка с точками */
.modal-dots {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 20px;
  z-index: 100000;
}

.modal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.25s ease;
}

.modal-dot.active {
  width: 18px;
  border-radius: 5px;
  background: #ffffff;
}

/* Если у товара всего 1 фото — стрелки и точки прячутся */
.image-modal.single-image .modal-nav,
.image-modal.single-image .modal-dots {
  display: none !important;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .image-modal {
    padding: 60px 12px 30px;
  }

  .modal-product-title {
    font-size: 1.05rem;
  }

  .modal-header {
    top: 16px;
    left: 18px;
    right: 60px;
  }

  .modal-close {
    top: 12px;
    right: 14px;
    width: 36px;
    height: 36px;
    font-size: 26px;
  }

  .modal-nav {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .modal-nav.prev { left: 10px; }
  .modal-nav.next { right: 10px; }

  .modal-content {
    max-width: 95vw;
    max-height: 70vh;
  }

  .modal-content img {
    max-height: 70vh;
    border-radius: 10px;
  }

  .modal-dots {
    bottom: 16px;
  }
}