/* ═══════════════════════════════════════════════════
   photos.css — Photo gallery, thumbnails, lightbox, likes
   ═══════════════════════════════════════════════════ */

/* ── Photo gallery grid ── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

/* ── Photo thumbnail ── */
.photo-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  background: var(--surface2);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.photo-thumb:hover img {
  transform: scale(1.05);
}

.photo-thumb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-thumb:hover .photo-thumb-overlay {
  opacity: 1;
}

.photo-thumb-author {
  font-size: 10px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Photo gallery modal ── */
.photo-gallery-box {
  max-width: 600px;
  width: 95vw;
}

.photo-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  gap: 8px;
}

.photo-gallery-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: var(--font-lg);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-gallery-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 16px;
  gap: 8px;
}

.photo-page-btn {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.15s;
}

.photo-page-btn:hover:not(:disabled) {
  background: var(--glass-hover);
}

.photo-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Upload button ── */
.photo-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.photo-upload-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.photo-upload-btn:active {
  transform: translateY(0);
}

/* ── Lightbox overlay ── */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox, 1001);
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: photoFadeIn 0.2s ease;
}

@keyframes photoFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

.photo-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}

.photo-lightbox-close:hover {
  background: var(--red);
  color: #fff;
}

.photo-lightbox-delete {
  position: absolute;
  top: -12px;
  right: 32px;
  width: 36px;
  height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}

.photo-lightbox-delete:hover {
  background: var(--red);
  color: #fff;
}

.photo-lightbox-info {
  margin-top: 12px;
  text-align: center;
  max-width: 400px;
}

.photo-lightbox-author {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.photo-lightbox-caption {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
}

.photo-lightbox-like {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

/* ── Like button ── */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.like-btn:hover {
  background: var(--glass-hover);
  border-color: var(--red);
  color: var(--red);
}

.like-btn.liked {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  color: var(--red);
}

.like-btn.liked .icon {
  fill: var(--red);
}

.like-btn.like-loading {
  opacity: 0.6;
  pointer-events: none;
}

.like-count {
  font-size: 12px;
  font-weight: 600;
  min-width: 10px;
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .photo-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
  }

  .photo-gallery-box {
    width: 100vw;
    max-width: 100vw;
    border-radius: 12px 12px 0 0;
  }

  .photo-lightbox {
    padding: 8px;
  }

  .photo-lightbox-img {
    max-width: 100vw;
    max-height: 70vh;
  }

  .photo-lightbox-close,
  .photo-lightbox-delete {
    top: 4px;
  }

  .photo-lightbox-close {
    right: 4px;
  }

  .photo-lightbox-delete {
    right: 48px;
  }
}
