/* ============================================
   ГАЛЕРЕЯ (общие стили для [gallery id="..."] и createGallery())
   ============================================ */

.gallery-container {
  width: 100%;
  overflow: hidden;
  margin-bottom: 10px;
}

.gallery-scrollable-wrapper {
  margin-bottom: 10px;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gallery-slide {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 8px;
  background: #f5f5f5;
}

.gallery-slide img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  border: none;
  border-radius: 0;
}

.gallery-slide:hover img {
  transform: scale(1.05);
}

.gallery-slide-number {
  position: absolute;
  top: 5px;
  left: 5px;
  color: #fff;
  font-size: 14px;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 2;
}

.gallery-no-images {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 30px 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #888;
  margin: 10px 0;
}

.gallery-no-images img {
  width: 80px;
  height: 80px;
  margin-bottom: 10px;
  border: none;
}

/* ============================================
   МОДАЛЬНОЕ ОКНО ГАЛЕРЕИ
   ============================================ */

.gallery-modal {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  margin: 0;
  padding: 0;
}

.gallery-modal.show {
  display: block;
}

.gallery-modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  margin: 0;
}

.gallery-modal-container {
  position: relative;
  width: 70%;
  max-width: 900px;
  min-width: 300px;
  background-color: rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.gallery-modal-header {
  position: absolute;
  top: -15px;
  right: -15px;
  z-index: 10;
  width: auto;
  height: auto;
}

.gallery-modal-close {
  color: #333;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: Arial, sans-serif;
  line-height: 1;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-modal-close:hover {
  background: #fff;
  transform: scale(1.05);
}

.gallery-modal-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  margin: 0;
  padding: 20px;
  flex: 1;
}

.gallery-modal-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-height: 60vh;
  margin: 0;
  padding: 0;
}

.gallery-modal-image {
  max-width: 100%;
  max-height: 55vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background-color: var(--gray);
  color: #333;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  line-height: 44px;
  cursor: pointer;
  user-select: none;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  z-index: 10;
  border: none;
  margin: 0;
  padding: 0;
  backdrop-filter: blur(2px);
}

.gallery-modal-arrow:hover {
  background-color: var(--main-color);
  transform: translateY(-50%) scale(1.1);
  color: #fff;
}

.gallery-modal-arrow-left {
  left: -22px;
  right: auto;
}

.gallery-modal-arrow-right {
  right: -22px;
  left: auto;
}

.gallery-modal-footer {
  text-align: center;
  padding: 12px 20px 20px 20px;
  width: 100%;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.gallery-modal-number {
  display: inline-block;
  color: #555;
  font-size: 13px;
  background-color: rgba(0, 0, 0, 0.05);
  padding: 4px 12px;
  border-radius: 20px;
  font-family: Arial, sans-serif;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 992px) {
  .gallery-modal-container { width: 80%; }
  .gallery-modal-arrow-left { left: -18px; }
  .gallery-modal-arrow-right { right: -18px; }
  .gallery-modal-arrow { width: 40px; height: 40px; font-size: 22px; line-height: 40px; }
}

@media (max-width: 768px) {
  .gallery-modal-container { width: 90%; }
  .gallery-modal-arrow-left { left: -15px; }
  .gallery-modal-arrow-right { right: -15px; }
  .gallery-modal-arrow { width: 36px; height: 36px; font-size: 20px; line-height: 36px; }
  .gallery-modal-header { top: -12px; right: -12px; }
  .gallery-modal-close { width: 30px; height: 30px; font-size: 20px; }
  .gallery-modal-image { max-height: 50vh; }
  .gallery-modal-body { padding: 15px; }
  .gallery-modal-footer { padding: 10px 15px 15px 15px; }
}

@media (max-width: 480px) {
  .gallery-modal-container { width: 95%; }
  .gallery-modal-arrow-left { left: -10px; }
  .gallery-modal-arrow-right { right: -10px; }
  .gallery-modal-arrow { width: 32px; height: 32px; font-size: 18px; line-height: 32px; }
  .gallery-modal-header { top: -10px; right: -10px; }
  .gallery-modal-close { width: 28px; height: 28px; font-size: 18px; }
  .gallery-modal-image { max-height: 45vh; }
  .gallery-modal-body { padding: 12px; }
}
