/* ═══════════════════════════════════════════════════
   gallery-widget.css — Reusable media gallery component
   Uses CSS vars from base.css (works dark + light mode)
   ═══════════════════════════════════════════════════ */

/* ── Grid ── */
.gw-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
}
.gw-grid.gw-reorderable .gw-item { cursor: grab; }
.gw-grid.gw-reorderable .gw-item:active { cursor: grabbing; }

/* ── Thumbnail item ── */
.gw-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, #222840);
  background: var(--surface2, #171c27);
  transition: border-color .15s, opacity .2s, transform .15s;
  flex-shrink: 0;
}
.gw-item:hover { border-color: var(--accent, #e50914); }
.gw-item.is-cover { border: 2px solid #f59e0b; }
.gw-item.dragging { opacity: 0.35; transform: scale(.95); }
.gw-item.drag-over { border-color: var(--accent, #e50914); border-style: dashed; }

.gw-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* ── Video play overlay ── */
.gw-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.3);
  pointer-events: none;
  color: #fff;
}

/* ── Audio placeholder ── */
.gw-audio-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2, #171c27);
  color: var(--muted, #9ca3af);
  cursor: pointer;
}

/* ── Pinned badge ── */
.gw-badge-pin {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  pointer-events: none;
  z-index: 2;
}

/* ── Action buttons overlay ── */
.gw-actions {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  z-index: 3;
}
.gw-item:hover .gw-actions { opacity: 1; pointer-events: auto; }

.gw-actions-top,
.gw-actions-bottom {
  display: flex;
  justify-content: space-between;
  gap: 2px;
}

.gw-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.65);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  padding: 0;
  flex-shrink: 0;
}
.gw-btn:hover { background: rgba(0,0,0,.85); transform: scale(1.1); }
.gw-btn.active-cover { background: #f59e0b; }
.gw-btn.active-cover:hover { background: #d97706; }
.gw-btn.active-pin { background: #3b82f6; }
.gw-btn.active-pin:hover { background: #2563eb; }
.gw-btn.gw-btn-delete:hover { background: var(--red, #ef4444); }

/* ── Upload zone ── */
.gw-upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border, #222840);
  border-radius: 8px;
  color: var(--muted, #9ca3af);
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
}
.gw-upload-zone:hover {
  border-color: var(--accent, #e50914);
  color: var(--accent, #e50914);
  background: rgba(var(--accent-rgb, 229,9,20), .06);
}
.gw-upload-zone.dragover {
  border-color: var(--accent, #e50914);
  background: rgba(var(--accent-rgb, 229,9,20), .1);
  color: var(--accent, #e50914);
}

/* ── Upload progress ── */
.gw-progress-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0,0,0,.3);
  z-index: 5;
}
.gw-progress-bar {
  height: 100%;
  background: var(--accent, #e50914);
  transition: width .2s;
  border-radius: 0 0 8px 8px;
}

/* ── Empty state ── */
.gw-empty {
  width: 100%;
  text-align: center;
  padding: 16px;
  color: var(--muted, #9ca3af);
  font-size: 12px;
}

/* ── Counter (more items) ── */
.gw-more {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border, #222840);
  border-radius: 8px;
  color: var(--muted, #9ca3af);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ═════════════════════════════════════════════════
   LIGHTBOX
   ═════════════════════════════════════════════════ */
.gw-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gwFadeIn .2s;
}
@keyframes gwFadeIn { from { opacity: 0; } to { opacity: 1; } }

.gw-lb-content {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gw-lb-media img {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 8px;
  object-fit: contain;
}
.gw-lb-media video {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 8px;
  background: #000;
}
.gw-lb-media .gw-lb-audio-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--muted, #9ca3af);
}
.gw-lb-audio-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--surface2, #171c27);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #e50914);
}

/* ── Nav arrows ── */
.gw-lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  z-index: 2201;
}
.gw-lb-nav:hover { background: rgba(0,0,0,.85); }
.gw-lb-nav.prev { left: 16px; }
.gw-lb-nav.next { right: 16px; }

/* ── Close button ── */
.gw-lb-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  z-index: 2201;
}
.gw-lb-close:hover { background: rgba(0,0,0,.85); }

/* ── Info bar ── */
.gw-lb-info {
  margin-top: 12px;
  text-align: center;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

/* ── Counter ── */
.gw-lb-counter {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.5);
  font-size: 13px;
  z-index: 2201;
}

/* ═════════════════════════════════════════════════
   RESPONSIVE
   ═════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .gw-lb-nav { width: 36px; height: 36px; }
  .gw-lb-nav.prev { left: 8px; }
  .gw-lb-nav.next { right: 8px; }
  .gw-lb-close { top: 8px; right: 8px; }
  .gw-lb-media img,
  .gw-lb-media video { max-width: 100vw; border-radius: 0; }
  .gw-actions { opacity: 1; pointer-events: auto; }
}
