/* ─── Advanced Gallery Plugin – Frontend Styles ─────────────────────────── */

:root {
  --agp-primary:   #3b82f6;
  --agp-gutter:    10px;
  --agp-columns:   3;
  --agp-radius:    6px;
  --agp-overlay:   rgba(0,0,0,0.55);
  --agp-trans:     0.3s ease;
  --agp-font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.agp-gallery-wrap {
  font-family: var(--agp-font);
  width: 100%;
  box-sizing: border-box;
}
.agp-gallery-wrap *,
.agp-gallery-wrap *::before,
.agp-gallery-wrap *::after { box-sizing: border-box; }

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.agp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.agp-filter-btn {
  padding: 6px 16px;
  border: 2px solid var(--agp-primary);
  background: transparent;
  color: var(--agp-primary);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--agp-trans);
}
.agp-filter-btn:hover,
.agp-filter-btn.active {
  background: var(--agp-primary);
  color: #fff;
}

/* ── Grid Layout ─────────────────────────────────────────────────────────── */
.agp-grid {
  display: grid;
  gap: var(--agp-gutter);
}
.agp-grid--grid {
  grid-template-columns: repeat(var(--agp-columns), 1fr);
}

/* ── Masonry Layout ──────────────────────────────────────────────────────── */
.agp-grid--masonry {
  display: block;
  columns: var(--agp-columns);
  column-gap: var(--agp-gutter);
}
.agp-grid--masonry .agp-item {
  break-inside: avoid;
  margin-bottom: var(--agp-gutter);
}

/* ── Justified Layout (equal-height rows) ────────────────────────────────── */
.agp-grid--justified {
  display: flex;
  flex-wrap: wrap;
  gap: var(--agp-gutter);
}
.agp-grid--justified .agp-item {
  flex: 1 1 200px;
}
.agp-grid--justified .agp-item__img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

/* ── Slider Layout ───────────────────────────────────────────────────────── */
.agp-grid--slider {
  display: flex;
  overflow-x: auto;
  gap: var(--agp-gutter);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--agp-primary) #eee;
  padding-bottom: 8px;
}
.agp-grid--slider .agp-item {
  flex: 0 0 calc((100% - var(--agp-gutter) * (var(--agp-columns) - 1)) / var(--agp-columns));
  scroll-snap-align: start;
}

/* ── Item ────────────────────────────────────────────────────────────────── */
.agp-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}
.agp-item__link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.agp-item__img-wrap {
  position: relative;
  overflow: hidden;
  background: #eee;
}
.agp-item__img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform var(--agp-trans);
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.agp-item__overlay {
  position: absolute;
  inset: 0;
  background: var(--agp-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--agp-trans);
}
.agp-item__icon {
  color: #fff;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.8);
  transition: transform var(--agp-trans);
}
.agp-item__icon svg { width: 32px; height: 32px; }

/* ── Hover Effects ───────────────────────────────────────────────────────── */
.agp-hover-zoom .agp-item__img-wrap:hover .agp-item__overlay { opacity: 1; }
.agp-hover-zoom .agp-item__img-wrap:hover .agp-item__img { transform: scale(1.08); }
.agp-hover-zoom .agp-item__img-wrap:hover .agp-item__icon { transform: scale(1); }

.agp-hover-slide .agp-item__overlay { transform: translateY(100%); opacity: 1; }
.agp-hover-slide .agp-item__img-wrap:hover .agp-item__overlay { transform: translateY(0); }

.agp-hover-fade .agp-item__img-wrap:hover .agp-item__overlay { opacity: 1; }

/* ── Caption ─────────────────────────────────────────────────────────────── */
.agp-item__caption {
  padding: 8px 10px;
  font-size: 13px;
  color: #555;
  background: #f8f8f8;
  border-top: 1px solid #eee;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes agp-fadeIn       { from { opacity:0 }              to { opacity:1 } }
@keyframes agp-fadeInUp     { from { opacity:0; transform:translateY(24px) } to { opacity:1; transform:none } }
@keyframes agp-zoomIn       { from { opacity:0; transform:scale(.85) }       to { opacity:1; transform:none } }
@keyframes agp-slideInLeft  { from { opacity:0; transform:translateX(-30px) } to { opacity:1; transform:none } }

.agp-item.agp-animate-fadeIn      { animation: agp-fadeIn      0.45s ease forwards; }
.agp-item.agp-animate-fadeInUp    { animation: agp-fadeInUp    0.45s ease forwards; }
.agp-item.agp-animate-zoomIn      { animation: agp-zoomIn      0.45s ease forwards; }
.agp-item.agp-animate-slideInLeft { animation: agp-slideInLeft 0.45s ease forwards; }
.agp-item { opacity: 0; }
.agp-item.agp-visible { opacity: 1; }

/* ── Load More ───────────────────────────────────────────────────────────── */
.agp-load-more-wrap {
  text-align: center;
  margin-top: 28px;
}
.agp-load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--agp-primary);
  color: #fff;
  border: 2px solid var(--agp-primary);
  border-radius: var(--agp-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--agp-trans);
  letter-spacing: 0.5px;
}
.agp-load-more-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--agp-primary);
}
.agp-load-more-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.agp-image-counter {
  margin-top: 10px;
  font-size: 13px;
  color: #888;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.agp-spinner {
  width: 20px; height: 20px;
  animation: agp-spin 0.8s linear infinite;
}
.agp-spinner circle {
  stroke: currentColor;
  stroke-linecap: round;
  stroke-dasharray: 80, 200;
  stroke-dashoffset: 0;
}
@keyframes agp-spin { to { transform: rotate(360deg); } }

/* ── No images ───────────────────────────────────────────────────────────── */
.agp-no-images {
  padding: 40px;
  text-align: center;
  color: #999;
  font-size: 15px;
  border: 2px dashed #ddd;
  border-radius: 8px;
}

/* ── Built-in Lightbox ───────────────────────────────────────────────────── */
.agp-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.agp-lightbox.is-open { display: flex; }
.agp-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  cursor: pointer;
}
.agp-lightbox__inner {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.agp-lightbox__img { max-width: 90vw; max-height: 80vh; border-radius: 4px; }
.agp-lightbox__caption {
  position: absolute;
  bottom: -32px;
  left: 0; right: 0;
  text-align: center;
  color: #ddd;
  font-size: 14px;
}
.agp-lightbox__close,
.agp-lightbox__prev,
.agp-lightbox__next {
  position: absolute;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--agp-trans);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.agp-lightbox__close:hover,
.agp-lightbox__prev:hover,
.agp-lightbox__next:hover { background: rgba(255,255,255,0.35); }
.agp-lightbox__close { top: -50px; right: 0; }
.agp-lightbox__prev  { left: -60px; }
.agp-lightbox__next  { right: -60px; }
.agp-lightbox__counter {
  position: absolute;
  top: -40px; left: 0;
  color: #aaa; font-size: 13px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .agp-grid--grid { grid-template-columns: repeat(min(var(--agp-columns), 2), 1fr); }
  .agp-grid--masonry { columns: 2; }
}
@media (max-width: 560px) {
  .agp-grid--grid { grid-template-columns: 1fr 1fr; }
  .agp-grid--masonry { columns: 2; }
  .agp-grid--slider .agp-item { flex: 0 0 80%; }
  .agp-lightbox__prev { left: -44px; }
  .agp-lightbox__next { right: -44px; }
}
