/* =================================================================== */
/* TOMB-GALLERY.CSS - استایل‌های اختصاصی صفحه گالری تصاویر             */
/* =================================================================== */

/* 1. استایل گالری تصاویر */
.gallery-selection {
  display: grid;
  gap: 15px;
  
  /* ستون‌بندی واکنش‌گرا */
  grid-template-columns: repeat(2, 1fr); /* حالت پیش‌فرض برای موبایل */

  /* این دستور کلیدی، ارتفاع تمام آیتم‌های هر ردیف را یکسان می‌کند */
  align-items: stretch;
}

/* برای تبلت */
@media (min-width: 768px) {
  .gallery-selection {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* برای دسکتاپ (با توجه به تصویر شما، ۳ ستون مناسب‌تر است) */
@media (min-width: 992px) {
  .gallery-selection {
    grid-template-columns: repeat(3, 1fr) ;
  }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .grid3-gallery {margin-left: 30px;}
}

@media (max-width :767.98px) {
  .grid3-gallery {
    margin-top: 30px;
  }
}

@media (min-width: 1200px) {
  .grid3-gallery {
    margin-left: 50px;
  }  
}

/* 2. استایل باکس نگهدارنده تصویر */
.photo-selection-wrapper {
    background-color: var(--color-white-warm);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;

    /* این خط به تنهایی ارتفاع را بر اساس عرض مشخص کرده و باعث هم‌اندازه شدن می‌شود */
    aspect-ratio: 16 / 9; 
}

/* 3. استایل خود تصویر */
.photo-selection {
    width: 100%;
    height: 100%;
    /* تصاویر برش نمی‌خورند و کامل نمایش داده می‌شوند */
    object-fit: contain; 
    object-position: center;
    cursor: pointer;
}

/* 4. استایل مودال نمایش تصاویر (Gallery Modal) */
.modal-gallery {
  display: none;
  position: fixed;
  z-index: 1040;
  left: 0;
  top: 125px;
  width: 100%;
  height: calc(100% - 125px);
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: flex-start;
  padding-top: 2rem;
  transition: top 0.3s ease, height 0.3s ease;
}

body.announcement-bar-hidden .modal-gallery {
  top: 85px;
  height: calc(100% - 85px);
}

.modal-content-gallery {
  position: relative;
  width: 80%;
  max-width: 900px;
}

.modal-image-container {
  position: relative;
  height: 60vh;
  min-height: 400px;
  background-color: #111;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.modal-image {
  max-width: 100%;
  max-height: 95%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 5px;
}

.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 16px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  transition: 0.6s ease;
  border:none;
  user-select: none;
  background-color:transparent;
}

.next { right: 10px; }
.prev { left: 10px; }

.prev:hover, .next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.thumbnail-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  background-color: #111;
  border-radius: 5px;
}

.thumbnail {
  width: 100px;
  height: 75px;
  object-fit: cover;
  margin: 0 5px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
  border: 2px solid transparent;
  border-radius: 3px;
}

.thumbnail.active, .thumbnail:hover {
  opacity: 1;
  border-color: #a5a0a0;
}

/* Zoom Feature Styles */
#zoom-toggle-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 1020;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--color-white-aqua);
  font-size: 28px;
  transition: .3s;
}

#zoom-toggle-icon:hover, #zoom-toggle-icon.active {
  color: var(--color-primary-hover);
}

#zoom-lens {
  position: absolute;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 150px;
  height: 150px;
  cursor: crosshair;
  display: none;
  z-index: 1020;
  background-repeat: no-repeat;
  pointer-events: none;
}

#close-gallery-icon {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 1020;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--color-white-aqua);
  font-size: 28px;
  transition: color 0.3s;
}

#close-gallery-icon:hover {
  color: var(--color-primary-hover);
}

/* 4. بازنشانی ارتفاع خودکار برای موبایل */
@media (max-width: 575.98px) {
  body.tomb-personal-page,
  body.tomb-personal-page .page-wrapper,
  body.tomb-personal-page main.flex-grow-1,
  body.tomb-personal-page .container-xxl.h-100 {
    height: auto;
    overflow: visible;
  }
}

/* 5. مودال تمام صفحه برای موبایل و تبلت */
@media (max-width: 991.98px) {
  .modal-gallery {
    top: 0;
    width: 100%;
    height: 100%;
    padding-top: 0;
    background-color: rgba(0, 0, 0, 0.9);
  }
  body.announcement-bar-hidden .modal-gallery {
    top: 0;
    height: 100%;
  }
  .modal-content-gallery {
    width: 100%;
    height: 100%;
    margin-top: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .modal-image-container {
    flex-grow: 1;
    min-height: 0;
    border-radius: 0;
    margin-top: 10px;
  }
  .thumbnail-container {
    flex-basis: 95px;
    flex-shrink: 0;
    background-color: #000;
  }
}