/* =========================
   14) Gallery Detail (Album)
   Nice design & layout
========================= */

.gallery-detail-page {
  padding: 2.5rem 0 4rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 12%);
  min-height: 60vh;
}

.gallery-detail-container {
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: clamp(20px, 5vw, 48px);
  box-sizing: border-box;
}

/* ----- Breadcrumb ----- */
.gallery-detail-breadcrumb {
  margin-bottom: 1.25rem;
  font-family: "Tajawal", sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.gallery-detail-breadcrumb a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.gallery-detail-breadcrumb a:hover {
  color: var(--accent-orange);
  text-decoration: underline;
}

.breadcrumb-sep {
  margin-inline: 0.35rem;
  opacity: 0.6;
}

.breadcrumb-current {
  color: var(--text-dark);
  font-weight: 600;
}

/* ----- Header ----- */
.gallery-detail-header {
  text-align: center;
  margin-bottom: 2rem;
}

.gallery-detail-title {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.5rem;
  font-family: "Cairo", sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.25;

  /* ✅ CHANGED: title to orange */
  color: var(--accent-orange);
}

.gallery-detail-title-text {
  max-width: 90%;
}

.gallery-detail-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);

  /* ✅ CHANGED: icon to orange + soft orange background */
  color: var(--accent-orange);
  background: rgba(245, 158, 11, 0.14);

  flex-shrink: 0;
}

.gallery-detail-title-icon svg {
  width: 26px;
  height: 26px;
}

.gallery-detail-date {
  margin: 0;
  font-family: "Tajawal", sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ----- Description ----- */
.gallery-detail-desc {
  margin: 0 auto 2rem;
  max-width: 640px;
  text-align: center;
  font-family: "Tajawal", sans-serif;
  font-size: 0.9375rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

/* ----- Grid ----- */
.gallery-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 0;
}

@media (min-width: 900px) {
  .gallery-images-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 1200px) {
  .gallery-images-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }
}

/* ----- Card ----- */
.gallery-image-item {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.2s ease;
}

.gallery-image-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  border-color: rgba(6, 53, 114, 0.12);
}

.gallery-image-link {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  text-decoration: none;
}

.gallery-image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-image-item:hover .gallery-image-link img {
  transform: scale(1.06);
}

.gallery-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(6, 53, 114, 0.75) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-image-item:hover .gallery-image-overlay {
  opacity: 1;
}

.gallery-image-zoom {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.9);
  transition: transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.gallery-image-item:hover .gallery-image-zoom {
  transform: scale(1);
}

.gallery-image-zoom svg {
  width: 26px;
  height: 26px;
}

/* ----- Back / Actions ----- */
.gallery-detail-actions {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
}

.gallery-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: "Tajawal", sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.gallery-detail-back:hover {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
  transform: translateY(-2px);
}

.gallery-detail-back svg {
  width: 20px;
  height: 20px;
  transform: rotate(180deg);
}

/* =========================
   Lightbox
========================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.lightbox-inner {
  position: relative;
  width: 100%;
  max-width: min(98vw, 1600px);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease;
}

.lightbox.is-open .lightbox-inner {
  transform: scale(1);
  opacity: 1;
}

/* "عرض الصورة" label above image */
.lightbox-view-label {
  font-family: "Cairo", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.lightbox-img-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  background: #0a0a0a;
  min-width: 280px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: min(90vh, 1200px);
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
  border-radius: 10px;
}

.lightbox-img.is-error {
  visibility: hidden;
  position: absolute;
  width: 0;
  height: 0;
}

/* Loading */
.lightbox-loading {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #111;
  color: rgba(255, 255, 255, 0.8);
  font-family: "Tajawal", sans-serif;
  font-size: 0.9375rem;
}

.lightbox-img-wrap.is-loading .lightbox-loading {
  display: flex;
}

.lightbox-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: lightbox-spin 0.8s linear infinite;
}

@keyframes lightbox-spin {
  to { transform: rotate(360deg); }
}

/* Fallback */
.lightbox-img-fallback {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: #111;
  color: rgba(255, 255, 255, 0.7);
  font-family: "Tajawal", sans-serif;
  font-size: 0.9375rem;
}

.lightbox-img-wrap.has-fallback .lightbox-img-fallback {
  display: flex;
}

.lightbox-fallback-icon {
  width: 56px;
  height: 56px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.25)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'%3E%3C/circle%3E%3Cpolyline points='21 15 16 10 5 21'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
}

/* Details: counter + caption */
.lightbox-details {
  margin-top: 1rem;
  text-align: center;
  max-width: min(98vw, 800px);
}

.lightbox-counter {
  display: inline-block;
  font-family: "Cairo", sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
  margin-bottom: 0.5rem;
}

.lightbox-caption {
  margin: 0;
  font-family: "Tajawal", sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  padding: 0 0.5rem;
}

/* Buttons */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.06);
}

.lightbox-close:active,
.lightbox-prev:active,
.lightbox-next:active {
  transform: scale(0.96);
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100001;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.lightbox-close:active {
  transform: scale(0.95);
}

.lightbox-close svg {
  width: 22px;
  height: 22px;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev {
  right: 100%;
  margin-right: 1.25rem;
}

.lightbox-next {
  left: 100%;
  margin-left: 1.25rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  transform: translateY(-50%) scale(1.06);
}

.lightbox-prev svg,
.lightbox-next svg {
  width: 28px;
  height: 28px;
}

/* Responsive lightbox */
@media (max-width: 900px) {
  .lightbox-inner {
    max-width: 98vw;
  }

  .lightbox-prev {
    right: 0.75rem;
    margin-right: 0;
  }

  .lightbox-next {
    left: 0.75rem;
    margin-left: 0;
  }

  .lightbox-close {
    top: max(1rem, env(safe-area-inset-top));
    right: max(1rem, env(safe-area-inset-right));
  }
}

@media (max-width: 600px) {
  .gallery-detail-page {
    padding: 1.5rem 0 3rem;
  }

  .gallery-images-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .gallery-image-link {
    aspect-ratio: 1;
  }

  .lightbox-img-wrap {
    min-height: 160px;
  }

  .lightbox-close {
    top: max(0.875rem, env(safe-area-inset-top));
    right: max(0.875rem, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }

  .lightbox-close svg {
    width: 20px;
    height: 20px;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 46px;
    height: 46px;
    top: auto;
    bottom: -3.5rem;
    transform: none;
  }

  .lightbox-prev:hover,
  .lightbox-next:hover {
    transform: scale(1.06);
  }

  .lightbox-prev {
    right: 50%;
    margin-right: 2.5rem;
  }

  .lightbox-next {
    left: 50%;
    margin-left: 2.5rem;
  }

  .lightbox-counter {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    padding: 0.4rem 0.85rem;
  }
}
