/* PhotoLab – site styles */

/* ── Page / category headings ────────────────────────────────────────── */

.photolab-page-heading {
  margin-bottom: 18px;
}

.photolab-category-heading {
  margin: 0 0 6px 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.photolab-category-description {
  margin: 0 0 16px 0;
  font-size: 1rem;
  opacity: 0.75;
  line-height: 1.5;
}

/* ── Gallery toolbar ─────────────────────────────────────────────────── */

.photolab-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px 0;
  flex-wrap: wrap;
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
}

/* Ensure toolbar buttons have comfortable padding and correct text colour */
.photolab-toolbar .btn {
  padding: 8px 18px;
  color: #fff;
}

.photolab-toolbar .btn-secondary {
  color: #333;
}

.photolab-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.photolab-selected {
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
}

/* ── Image grid ──────────────────────────────────────────────────────── */

.photolab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* Stagger fade-up on load */
@keyframes photolabFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.photolab-card {
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  animation: photolabFadeUp 0.45s ease both;
  animation-delay: calc(var(--card-i, 0) * 45ms);
}

.photolab-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.07);
  transform: translateY(-3px);
}

/* ── Card media area (image + overlay controls) ──────────────────────── */

.photolab-card-media {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 */
  overflow: hidden;
  background: #e8e8e8;
}

.photolab-thumbBtn {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.photolab-card .photolab-thumbBtn img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.photolab-card:hover .photolab-thumbBtn img {
  transform: scale(1.06);
}

/* Gradient + controls overlay */
.photolab-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.38) 0%, transparent 50%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 10px 0;
  pointer-events: none; /* let clicks through to thumbBtn by default */
}

/* Custom circular checkbox */
.photolab-check {
  pointer-events: all;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.photolab-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.25);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
  margin: 0;
}

.photolab-check input[type="checkbox"]::after {
  content: '';
  display: block;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8l3.5 3.5L13 5'/%3E%3C/svg%3E") center / 14px no-repeat;
  opacity: 0;
  transition: opacity 0.15s;
}

.photolab-check input[type="checkbox"]:checked {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.3);
}

.photolab-check input[type="checkbox"]:checked::after {
  opacity: 1;
}

/* Download icon button overlay */
.photolab-card-dl-btn {
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.25);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s;
}

.photolab-card:hover .photolab-card-dl-btn {
  opacity: 1;
  transform: translateY(0);
}

.photolab-card-dl-btn:hover {
  background: rgba(0,0,0,0.55);
  color: #fff;
  text-decoration: none;
}

/* ── Card footer ─────────────────────────────────────────────────────── */

.photolab-filename {
  padding: 8px 12px 10px;
  font-size: 0.8rem;
  color: #666;
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Lightbox ────────────────────────────────────────────────────────── */

.photolab-lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.photolab-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.photolab-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.photolab-lightbox-dialog {
  position: relative;
  width: fit-content;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  background: #111;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  transform: scale(0.93) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.34,1.4,0.64,1);
}

.photolab-lightbox.is-open .photolab-lightbox-dialog {
  transform: scale(1) translateY(0);
}

.photolab-lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  backdrop-filter: blur(6px);
}

.photolab-lightbox-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  opacity: 0.9;
}

.photolab-lightbox-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.photolab-lightbox-download {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 5px 11px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s;
}

.photolab-lightbox-download:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
  text-decoration: none;
}

.photolab-lightbox-close {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 3px 8px;
  transition: background 0.15s, opacity 0.15s;
}

.photolab-lightbox-close:hover {
  opacity: 1;
  background: rgba(255,255,255,0.16);
}

.photolab-lightbox-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: #111;
  flex: 1;
  min-height: 0;
}

.photolab-lightbox-body img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: calc(100vh - 24px - 48px); /* 48px ≈ header height */
  border-radius: 6px;
  object-fit: contain;
  transition: opacity 0.18s ease;
}

.photolab-lightbox-body img.is-loading {
  opacity: 0;
}

.photolab-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: background 0.15s, transform 0.15s;
  transform-origin: center;
}

.photolab-lightbox-nav:hover {
  background: rgba(0,0,0,0.65);
}

.photolab-lightbox-nav.prev { left: 10px; }
.photolab-lightbox-nav.next { right: 10px; }
.photolab-lightbox-nav.prev:hover { transform: translateY(-50%) translateX(-2px); }
.photolab-lightbox-nav.next:hover { transform: translateY(-50%) translateX(2px); }

/* ── Pagination ──────────────────────────────────────────────────────── */

.photolab-pagination {
  margin-top: 24px;
}

.photolab-pagination ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.photolab-pagination li {
  margin: 0 !important;
  padding: 0 !important;
}

.photolab-pagination a,
.photolab-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  text-decoration: none;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.photolab-pagination a:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border-color: rgba(0,0,0,0.22);
}

.photolab-pagination .active span,
.photolab-pagination span[aria-current="page"] {
  font-weight: 700;
  border-color: #2563eb;
  color: #2563eb;
}

.photolab-pagination .disabled span,
.photolab-pagination span[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Category grid ───────────────────────────────────────────────────── */

.photolab-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.photolab-category-card {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  animation: photolabFadeUp 0.45s ease both;
  animation-delay: calc(var(--card-i, 0) * 60ms);
}

.photolab-category-card:hover {
  box-shadow: 0 10px 32px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.07);
  transform: translateY(-3px);
  text-decoration: none;
  color: inherit;
}

.photolab-category-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e8e8e8;
}

.photolab-category-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.photolab-category-card:hover .photolab-category-thumb img {
  transform: scale(1.05);
}

.photolab-category-nothumb {
  color: #999;
  font-size: 0.9rem;
}

.photolab-category-info {
  padding: 14px;
}

.photolab-category-title {
  margin: 0 0 4px 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.photolab-category-count {
  font-size: 0.82rem;
  color: #888;
}

.photolab-category-desc {
  margin: 8px 0 0 0;
  font-size: 0.875rem;
  color: #666;
  line-height: 1.45;
}
