/* =========================
   Core Styles
========================= */
.mgwpp-gallery-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* =========================
   Layout Controls
========================= */
.mgwpp-layout-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.mgwpp-layout-btn {
  padding: 0.6rem 1.8rem;
  border: none;
  border-radius: 999px;
  background: #1f1f1f; /* dark background for white icons */
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease-in-out;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mgwpp-layout-btn:hover {
  background: #333;
  transform: translateY(-1px);
}

.mgwpp-layout-btn.active {
  background: #0073aa;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

/* If you're rendering icons with <img>, size them properly */
.mgwpp-layout-btn img {
  width: 20px;
  height: 20px;
  display: block;
}

/* =========================
   Grid Layouts
========================= */
.mgwpp-grid-container {
  display: grid;
  gap: 1.5rem;
  transition: all 0.3s ease;
}

.mgwpp-grid-container[data-layout="minimal"] {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.mgwpp-grid-container[data-layout="grid"] {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.mgwpp-grid-container[data-layout="masonry"] {
  display: block;
  column-count: 3;
  column-gap: 1.5rem;
}

@media (max-width: 1024px) {
  .mgwpp-grid-container[data-layout="masonry"] {
    column-count: 2;
  }
}
@media (max-width: 768px) {
  .mgwpp-grid-container[data-layout="masonry"] {
    column-count: 1;
  }
}

.mgwpp-grid-item {
  break-inside: avoid;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

.mgwpp-grid-item:hover {
  transform: translateY(-5px);
}

.mgwpp-grid-image {
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* Fixed height for grid + minimal layout */
.mgwpp-grid-container[data-layout="grid"] .mgwpp-grid-image,
.mgwpp-grid-container[data-layout="minimal"] .mgwpp-grid-image {
  height: 250px;
}

/* Let masonry be natural height */
.mgwpp-grid-container[data-layout="masonry"] .mgwpp-grid-image {
  height: auto;
}

/* Responsive height adjustment */
@media (max-width: 768px) {
  .mgwpp-grid-container[data-layout="grid"] .mgwpp-grid-image,
  .mgwpp-grid-container[data-layout="minimal"] .mgwpp-grid-image {
    height: 180px;
  }
}

/* =========================
   Lightbox
========================= */
.mgwpp-lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.mgwpp-lightbox-image {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

.mgwpp-grid-gallery-lightbox-caption {
  color: white;
  font-size: 1.1rem;
  margin-top: 1rem;
}

/* =========================
   Lightbox Controls
========================= */
.mgwpp-grid-gallery-prev,
.mgwpp-grid-gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  padding: 1rem;
  font-size: 2rem;
  cursor: pointer;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.mgwpp-grid-gallery-prev:hover,
.mgwpp-grid-gallery-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.mgwpp-grid-gallery-prev {
  left: 2rem;
}

.mgwpp-grid-gallery-next {
  right: 2rem;
}

.mgwpp-grid-gallery-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.5rem;
}
