/* =========================================
   معرض الصور والفيديوهات - تصميم احترافي 3x3
========================================= */
.gallery-section {
  padding: 60px 20px 40px 20px;
  background: #f8f9fa;
  min-height: 100vh;
  font-family: "Cairo", "Tajawal", "Almarai", sans-serif;
}

.gallery-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 30px;
  color: #0d6efd;
  letter-spacing: 1px;
}

.gallery-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.tab-btn {
  background: #fff;
  border: 2px solid #0d6efd;
  color: #0d6efd;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 10px 30px;
  margin: 0 10px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active,
.tab-btn:hover {
  background: #0d6efd;
  color: #fff;
}

.gallery-content {
  min-height: 400px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ======= شبكة الصور 3 أعمدة ثابتة ======= */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 أعمدة ثابتة */
  gap: 24px;
  align-items: stretch;
  justify-items: stretch;
}

.gallery-item {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.gallery-item:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 6px 32px rgba(13, 110, 253, 0.13);
}

/* ======= عرض الصور والفيديوهات بالكامل ======= */
.gallery-item img,
.gallery-item video {
  width: 100%;        /* عرض كامل للكارت */
  height: auto;       /* ارتفاع طبيعي */
  max-height: 500px;  /* الحد الأقصى للارتفاع */
  object-fit: contain; /* يظهر كامل الصورة بدون قص */
  display: block;
}

.gallery-caption {
  padding: 12px 16px 10px 16px;
  font-size: 1.05rem;
  color: #333;
  text-align: center;
  background: #f1f3f6;
}


#langToggle{
        
          padding: 0.5rem 1.2rem;
          border-radius: 8px;
          font-weight: bold;
          background: #0074d9;
          color: #fff;
          border: none;
          box-shadow: 0 2px 8px #0002;
          cursor: pointer;
}



/* ======= Responsive ======= */
@media (max-width: 992px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr); /* عمودين للشاشات المتوسطة */
  }
}

@media (max-width: 600px) {
  .gallery-title {
    font-size: 1.5rem;
  }
  .gallery-section {
    padding: 30px 10px 20px 10px;
  }
  .gallery-grid {
    grid-template-columns: 1fr; /* عمود واحد للشاشات الصغيرة */
    gap: 12px;
  }
  .gallery-item img,
  .gallery-item video {
    max-height: 300px; /* ارتفاع أصغر للشاشات الصغيرة */
  }
}
@media (max-width: 600px) {

  /* فك قيود الكونتينر */
  .gallery-section .container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
  }

  /* عمود واحد */
  .gallery-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  /* إلغاء أي قيود عرض محتملة */
  .gallery-item {
    width: 100% !important;
  }

}
/* ============================
   GALLERY PHOTO MODAL
============================ */
.gmodal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(5, 15, 30, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: gmodalFadeIn 0.25s ease;
}
.gmodal-overlay.open {
  display: flex;
}
@keyframes gmodalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gmodal-card {
  position: relative;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.45), 0 0 0 1.5px rgba(13,110,253,0.15);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gmodalPop 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes gmodalPop {
  from { opacity: 0; transform: scale(0.93) translateY(36px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* CLOSE */
.gmodal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.18);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  line-height: 1;
}
.gmodal-close:hover {
  background: #e63946;
  transform: rotate(90deg) scale(1.1);
}

/* IMAGE WRAP */
.gmodal-img-wrap {
  position: relative;
  width: 100%;
  background: #0d1117;
  flex: 1;
  min-height: 260px;
  max-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gmodal-img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
  transition: opacity 0.22s ease;
  padding: 8px;
}
.gmodal-img.switching {
  opacity: 0;
}

/* ARROWS */
.gmodal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.18);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.18s;
  backdrop-filter: blur(4px);
}
.gmodal-arrow:hover {
  background: rgba(13,110,253,0.75);
  transform: translateY(-50%) scale(1.12);
}
.gmodal-prev { left: 10px; }
.gmodal-next { right: 10px; }
.gmodal-arrow.hidden { display: none; }

/* FOOTER */
.gmodal-footer {
  padding: 14px 20px 16px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid #f0f0f0;
  direction: rtl;
}
html[lang="en"] .gmodal-footer { direction: ltr; }

.gmodal-caption {
  font-size: 15px;
  color: #334;
  margin: 0;
  font-family: 'Cairo', 'Tajawal', sans-serif;
  flex: 1;
  line-height: 1.6;
}
.gmodal-counter {
  font-size: 13px;
  color: #0d6efd;
  font-weight: 700;
  white-space: nowrap;
  background: #eef3ff;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Hover zoom hint on photo items */
.gallery-item-clickable::after {
  content: "🔍";
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  filter: drop-shadow(0 1px 4px #0005);
}
.gallery-item-clickable:hover::after {
  opacity: 1;
}

/* ============================
   GALLERY MODAL – TABLET
============================ */
@media (max-width: 768px) {
  .gmodal-card {
    max-width: 96vw;
    border-radius: 18px;
  }
  .gmodal-img-wrap {
    max-height: 65vh;
  }
}

/* ============================
   GALLERY MODAL – MOBILE FULLSCREEN
============================ */
@media (max-width: 600px) {
  .gmodal-overlay {
    padding: 0;
    align-items: flex-start;
  }
  .gmodal-card {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    border-radius: 0;
    animation: gmodalPopFull 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .gmodal-img-wrap {
    flex: 1;
    min-height: 0;
    max-height: none;
  }
  .gmodal-img {
    max-height: 100%;
  }
  .gmodal-close {
    top: 12px;
    left: 12px;
    width: 42px;
    height: 42px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.48);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  }
  .gmodal-footer {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
  }
  .gmodal-arrow {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

@keyframes gmodalPopFull {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}