/* LG Gallery - Frontend стилове */

/* Базов контейнер */
.lg-gallery {
  margin: 20px 0;
}

/* ========================
   MASONRY LAYOUT (JustifiedGallery)
   Запазва оригиналните пропорции в редове
======================== */
.lg-layout-masonry {
  /* JustifiedGallery ще добави своите стилове */
}

.lg-layout-masonry .lg-item {
  cursor: zoom-in;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lg-layout-masonry .lg-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

/* ========================
   GRID LAYOUT 
   Прави снимките квадратни
======================== */
.lg-layout-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.lg-layout-grid[data-columns="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.lg-layout-grid[data-columns="3"] {
  grid-template-columns: repeat(3, 1fr);
}

.lg-layout-grid[data-columns="4"] {
  grid-template-columns: repeat(4, 1fr);
}

.lg-layout-grid[data-columns="5"] {
  grid-template-columns: repeat(5, 1fr);
}

.lg-layout-grid[data-columns="6"] {
  grid-template-columns: repeat(6, 1fr);
}

.lg-layout-grid[data-gap="0"] {
  gap: 0;
}

.lg-layout-grid[data-gap="5"] {
  gap: 5px;
}

.lg-layout-grid[data-gap="10"] {
  gap: 10px;
}

.lg-layout-grid[data-gap="20"] {
  gap: 20px;
}

/* GRID - Прави снимките квадратни */
.lg-layout-grid .lg-item {
  aspect-ratio: 1/1;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
  border-radius: 4px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lg-layout-grid .lg-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* ========================
   ОБЩИ СТИЛОВЕ
======================== */

/* Hover ефекти за всички layout-и */
.lg-gallery .lg-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  z-index: 1;
}

.lg-gallery .lg-item:hover img {
  transform: scale(1.05);
}

/* Overlay при hover */
.lg-gallery .lg-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.lg-gallery .lg-item:hover::before {
  background: rgba(0, 0, 0, 0.2);
}

/* Икона за увеличаване */
.lg-gallery .lg-item::after {
  content: '🔍';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 32px;
  color: white;
  z-index: 2;
  transition: transform 0.3s ease;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lg-gallery .lg-item:hover::after {
  transform: translate(-50%, -50%) scale(1);
}

/* ========================
   RESPONSIVE
======================== */
@media (max-width: 1024px) {
  .lg-layout-grid[data-columns="6"],
  .lg-layout-grid[data-columns="5"] {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .lg-layout-grid[data-columns="6"],
  .lg-layout-grid[data-columns="5"],
  .lg-layout-grid[data-columns="4"] {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .lg-layout-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 5px !important;
  }
}

/* ========================
   АНИМАЦИЯ ПРИ ЗАРЕЖДАНЕ
======================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lg-gallery .lg-item {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
}

.lg-gallery .lg-item:nth-child(1) { animation-delay: 0.05s; }
.lg-gallery .lg-item:nth-child(2) { animation-delay: 0.1s; }
.lg-gallery .lg-item:nth-child(3) { animation-delay: 0.15s; }
.lg-gallery .lg-item:nth-child(4) { animation-delay: 0.2s; }
.lg-gallery .lg-item:nth-child(5) { animation-delay: 0.25s; }
.lg-gallery .lg-item:nth-child(6) { animation-delay: 0.3s; }
.lg-gallery .lg-item:nth-child(7) { animation-delay: 0.35s; }
.lg-gallery .lg-item:nth-child(8) { animation-delay: 0.4s; }
.lg-gallery .lg-item:nth-child(9) { animation-delay: 0.45s; }
.lg-gallery .lg-item:nth-child(10) { animation-delay: 0.5s; }

/* ========================
   LIGHTGALLERY CUSTOMIZATIONS
======================== */
.lg-backdrop {
  background-color: rgba(0, 0, 0, 0.9) !important;
}

/* Подобрени стилове за субтитрите */
.lg-sub-html {
  padding: 20px 40px !important;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent) !important;
}

.lg-sub-html h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-weight: 600 !important;
  margin-bottom: 8px !important;
  font-size: 18px !important;
  color: white !important;
}

.lg-sub-html p {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  line-height: 1.4 !important;
  font-size: 14px !important;
  color: rgba(255,255,255,0.9) !important;
  margin: 0 !important;
}