/* =========================================
   photo_gallery.css
   Sukiyaki-style gallery (scoped + clean)
   ========================================= */

/* Filters */
.gallery-filters {
  margin: 10px 0 18px;
}

.gallery-filters .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.gallery-filters .filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}

.gallery-filters .filter-spacer {
  visibility: hidden;
  margin: 0;
  height: 20px; /* matches label height */
}

.gallery-filters .filter.actions {
  margin-left: auto;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center; /* aligns Apply with selects */
  min-width: auto;
}

.gallery-filters select,
.gallery-filters .button {
  height: 36px;
  line-height: 36px;
}

.gallery-filters label,
.gallery-filters select,
.gallery-filters .button {
  margin: 0;
}

/* =========================================
   Instagram-style grid
   ========================================= */

.ig-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 860px) {
  .ig-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .ig-grid {
    grid-template-columns: 1fr;
  }
}

/* Tile */
.ig-tile {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Square ratio */
.ig-tile::before {
  content: '';
  display: block;
  padding-top: 100%;
}

.ig-link {
  position: absolute;
  inset: 0;
  display: block;
}

.ig-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Overlay */
.ig-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  pointer-events: none;
}

.ig-tile:hover .ig-overlay {
  opacity: 1;
}

.ig-meta {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.9rem;
  max-width: 75%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ig-chip {
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
}

.ig-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

/* =========================================
   Per-tile admin controls (top-left/top-right)
   ========================================= */

/* Controls bar: top-align items */
.ig-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.ig-controls form {
  pointer-events: auto;
  margin: 0 !important;
  display: flex; /* critical: stops baseline weirdness */
  align-items: flex-start; /* critical */
}

/* Normalize BOTH controls to identical box model */
.ig-adminselect,
.ig-delbtn {
  box-sizing: border-box;
  height: 28px;
  line-height: 28px;
}

/* Keep your select pill look */
.ig-adminselect {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: inline-flex;
  align-items: center;
  padding: 0 28px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  font-size: 0.8rem;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Custom arrow */
.ig-adminform::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
  pointer-events: none;
}

/* Delete button */
.ig-delbtn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.ig-delbtn:hover {
  background: rgba(255, 230, 230, 0.95);
  color: #8a0000;
}

/* =========================================
   Pagination
   ========================================= */

.ig-pager {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.ig-pager a {
  color: #111;
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, 0.14);
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
}

.ig-pager a[aria-current='page'] {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.06);
  font-weight: 800;
}

/* =========================================
   Lightbox
   ========================================= */

.lb {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.86);
  padding: 18px;
  z-index: 5000;
}

.lb.open {
  display: flex;
}

.lb-card {
  width: min(980px, 100%);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  overflow: hidden;
}

.lb-media {
  width: 100%;
  max-height: 78vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-media img,
.lb-media video {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
}

.lb-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  align-items: center;
}

.lb-actions {
  display: flex;
  gap: 8px;
}

.lb-btn {
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  color: #111;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
}

.lb-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ===== FIX: tile controls alignment + arrow only on dropdown ===== */

.ig-controls {
  align-items: flex-start;
}

.ig-controls form {
  display: flex;
  align-items: flex-start;
  margin: 0 !important;
}

/* lock both controls to the same box model */
.ig-adminselect,
.ig-delbtn {
  box-sizing: border-box;
  height: 28px !important;
  line-height: 28px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  font-size: 0.8rem !important;
}

/* IMPORTANT: base.css can bleed styles into buttons */
.ig-delbtn {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(0, 0, 0, 0.18) !important;
  border-radius: 999px !important;
  color: #111 !important;
  letter-spacing: 0 !important; /* cancels base .button uppercase spacing look */
  text-transform: none !important; /* keep "Delete" normal */
  font-weight: 700 !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Arrow: ONLY on the dropdown form */
.ig-adminform {
  position: relative; /* required so arrow anchors to the select */
}

.ig-adminform::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
  pointer-events: none;
}

/* Make sure delete form NEVER shows an arrow */
.ig-delform::after {
  content: none !important;
}
