/* ========== Tabbed Photo Gallery – Frontend Styles ========== */

/* Tab bar */
.tpg-gallery {
  font-family: inherit;
  margin: 0 auto;
  max-width: 100%;
}

.tpg-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 20px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px;
}

.tpg-tab-btn {
  padding: 8px 22px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.4;
}

.tpg-tab-btn:hover {
  border-color: #8B3A3A;
  color: #8B3A3A;
}

.tpg-tab-btn.active {
  background: #8B3A3A;
  border-color: #8B3A3A;
  color: #fff;
  font-weight: 600;
}

/* Panels */
.tpg-panel {
  display: none;
}
.tpg-panel.active {
  display: block;
  animation: tpgFadeIn 0.25s ease;
}

@keyframes tpgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Grid */
.tpg-grid {
  columns: 3;
  column-gap: 12px;
}

@media (max-width: 900px) {
  .tpg-grid { columns: 2; }
}
@media (max-width: 540px) {
  .tpg-grid { columns: 2; }
}

.tpg-grid-item {
  break-inside: avoid;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
}

.tpg-grid-item a {
  display: block;
  position: relative;
  text-decoration: none;
  outline: none;
}

.tpg-grid-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  transition: transform 0.35s ease, filter 0.35s ease;
}

.tpg-grid-item:hover img {
  transform: scale(1.04);
  filter: brightness(0.85);
}

.tpg-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  color: #fff;
  padding: 24px 12px 10px;
  font-size: 13px;
  border-radius: 0 0 6px 6px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.tpg-grid-item:hover .tpg-caption {
  opacity: 1;
}

/* Empty state */
.tpg-empty-panel {
  text-align: center;
  color: #9ca3af;
  padding: 48px 0;
  font-size: 15px;
}

/* ===== Load More ===== */
.tpg-load-more-wrap {
  text-align: center;
  padding: 32px 0 8px;
}

.tpg-load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: #fff;
  border: 2px solid #8B3A3A;
  color: #8B3A3A;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tpg-load-more-btn:hover:not(.tpg-loading) {
  background: #8B3A3A;
  color: #fff;
}

.tpg-load-more-btn.tpg-loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.tpg-lm-count {
  font-weight: 400;
  opacity: 0.75;
  font-size: 13px;
}

.tpg-spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: tpgSpin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes tpgSpin { to { transform: rotate(360deg); } }

/* Fade-in for newly loaded items */
.tpg-fade-in {
  animation: tpgFadeIn 0.3s ease both;
}
.tpg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tpg-lightbox-img-wrap {
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
}

.tpg-lightbox-img-wrap img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

#tpg-lightbox-caption {
  color: #d1d5db;
  font-size: 14px;
  margin-top: 12px;
}

.tpg-lightbox-close,
.tpg-lightbox-prev,
.tpg-lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: background 0.2s;
}

.tpg-lightbox-close:hover,
.tpg-lightbox-prev:hover,
.tpg-lightbox-next:hover {
  background: rgba(255,255,255,0.25);
}

.tpg-lightbox-close { top: 18px; right: 18px; font-size: 26px; }
.tpg-lightbox-prev  { left: 18px; top: 50%; transform: translateY(-50%); }
.tpg-lightbox-next  { right: 18px; top: 50%; transform: translateY(-50%); }
