/* ============================================================================
   Gallery Page — Reel Deal Construction LLC
   Extends index.css base styles with gallery-specific layout
   ============================================================================ */

/* Gallery page body */
.gallery-page {
  padding-top: 80px;
}

/* ---- Gallery Hero ---- */
.gallery-hero {
  padding: 4rem 0 2rem;
  text-align: center;
}

.gallery-hero p {
  color: var(--color-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0.5rem auto 0;
}

.gallery-controls {
  margin-top: 1.5rem;
}

/* ---- Gallery Grid Section ---- */
.gallery-grid-section {
  padding: 0 0 4rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  justify-content: center;
}

/* ---- Gallery Card ---- */
.gallery-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 4 / 3;
}

.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.gallery-card:hover img {
  transform: scale(1.08);
}

.gallery-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.1) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  transition: background 0.3s ease;
}

.gallery-card:hover .gallery-card-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.25) 60%, rgba(0, 0, 0, 0.1) 100%);
}

.gallery-card-info h3 {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
}

.gallery-card-info .card-meta {
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.gallery-card-info .card-description {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  margin-top: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* View prompt on hover */
.gallery-card-view {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  background: rgba(249, 115, 22, 0.9);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
}

.gallery-card:hover .gallery-card-view {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Manage button on card */
.gallery-manage-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.gallery-card:hover .gallery-manage-btn {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .gallery-manage-btn { opacity: 1; }
}

.gallery-manage-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* Gallery placeholder */
.gallery-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.3);
  font-size: 1rem;
  background: var(--color-surface);
}

.gallery-card-placeholder i {
  font-size: 2.5rem;
}

/* ---- Manage Gallery Modal ---- */
.manage-gallery-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.btn-sm {
  padding: 0.5rem 1rem !important;
  font-size: 0.85rem !important;
}

.btn-danger-sm {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger-sm:hover {
  background: #b91c1c;
}

.manage-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.manage-image-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-dark);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.manage-image-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.manage-image-buttons {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
}

.manage-image-buttons button {
  flex: 1;
  padding: 0.35rem;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
  color: #fff;
}

.manage-image-buttons .btn-cover {
  background: rgba(249, 115, 22, 0.3);
}

.manage-image-buttons .btn-cover:hover,
.manage-image-buttons .btn-cover.active {
  background: var(--color-primary);
}

.manage-image-buttons .btn-img-delete {
  background: rgba(220, 38, 38, 0.3);
}

.manage-image-buttons .btn-img-delete:hover {
  background: #dc2626;
}

/* Gallery Viewer Title */
.gallery-viewer-title {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  font-weight: 500;
  z-index: 2;
  text-align: center;
  pointer-events: none;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-muted);
}

.empty-state p {
  margin-top: 1rem;
  font-size: 1.1rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .gallery-card-info h3 {
    font-size: 1rem;
  }

  .gallery-card-info .card-meta {
    font-size: 0.8rem;
  }

  .gallery-card-overlay {
    padding: 1rem;
  }

  .gallery-card-view {
    display: none;
  }

  .manage-image-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .manage-gallery-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}
