/* ============================================================
   GALLERY SECTION — Unique Styles (prefix: .gallery-section)
   ============================================================ */

/* ---------- Root Variables ---------- */
.gallery-section {
  --g-primary:    #3f3a44;
  --g-primary-dk: #1d4ed8;
  --g-accent:     #0ea5e9;
  --g-gold:       #f59e0b;
  --g-bg:         #f8fafc;
  --g-white:      #ffffff;
  --g-text:       #1e293b;
  --g-text-muted: #64748b;
  --g-border:     #e2e8f0;
  --g-radius:     16px;
  --g-radius-sm:  10px;
  --g-shadow:     0 4px 24px rgba(0,0,0,.08);
  --g-shadow-lg:  0 12px 48px rgba(0,0,0,.14);
  --g-trans:      all .3s cubic-bezier(.4,0,.2,1);
  direction: rtl;
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  background: var(--g-bg);
  padding: 80px 0 100px;
  overflow: hidden;
  position: relative;
}

/* Decorative background blobs */
.gallery-section::before,
.gallery-section::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .06;
  pointer-events: none;
  z-index: 0;
}
.gallery-section::before {
  width: 600px; height: 600px;
  background: var(--g-primary);
  top: -200px; right: -200px;
}
.gallery-section::after {
  width: 500px; height: 500px;
  background: var(--g-accent);
  bottom: -150px; left: -150px;
}

/* ---------- Container ---------- */
.gallery-section .gallery-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ---------- Header ---------- */
.gallery-section .gallery-header {
  text-align: center;
  margin-bottom: 52px;
}

.gallery-section .gallery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--g-primary);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 100px;
  border: 1px solid #bfdbfe;
  margin-bottom: 16px;
  letter-spacing: .02em;
  font-family: iransans-light;
}

.gallery-section .gallery-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 900;
  color: var(--g-text);
  margin: 0 0 14px;
  line-height: 1.3;
  font-family: iransans-light;
}

.gallery-section .gallery-subtitle {
  font-size: 16px;
  color: var(--g-text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.8;
  font-family: iransans-light;
}

/* ---------- Tabs Wrapper ---------- */
.gallery-section .gallery-tabs-wrapper {
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
}

.gallery-section .gallery-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--g-white);
  border: 1px solid var(--g-border);
  border-radius: 100px;
  padding: 6px;
  position: relative;
  box-shadow: var(--g-shadow);
}

/* Sliding indicator behind active tab */
.gallery-section .gallery-tab-indicator {
  position: absolute;
  height: calc(100% - 12px);
  border-radius: 100px;
  background: #3f3a44;
  transition: var(--g-trans);
  z-index: 0;
}


.gallery-section .gallery-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border: none;
  background: transparent;
  color: var(--g-text-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 100px;
  cursor: pointer;
  transition: var(--g-trans);
  white-space: nowrap;
  font-family: iransans-light;
}

.gallery-section .gallery-tab:hover:not(.active) {
  color: var(--g-primary);
}

.gallery-section .gallery-tab.active {
  color: var(--g-white);
}

.gallery-section .gallery-tab svg {
  flex-shrink: 0;
  transition: var(--g-trans);
}

/* ---------- Tab Panes ---------- */
.gallery-section .gallery-pane {
  display: none;
  animation: galleryFadeIn .4s ease forwards;
}

.gallery-section .gallery-pane.active {
  display: block;
}

@keyframes galleryFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Banners ---------- */
.gallery-section .gallery-banner {
  border-radius: var(--g-radius);
  padding: 36px 40px;
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.gallery-section .gallery-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Banner: Before/After */
.gallery-section .banner-before-after {
  background: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 60%, #06b6d4 100%);
}

/* Banner: Congress */
.gallery-section .banner-congress {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 60%, #ec4899 100%);
}

/* Banner: Surgery */
.gallery-section .banner-surgery {
  background: linear-gradient(135deg, #059669 0%, #10b981 60%, #34d399 100%);
}

.gallery-section .gallery-banner-content h3 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 8px;
}

.gallery-section .gallery-banner-content p {
  font-size: 14px;
  opacity: .85;
  margin: 0;
  line-height: 1.7;
}

.gallery-section .gallery-banner-stats {
  display: flex;
  gap: 32px;
  flex-shrink: 0;
}

.gallery-section .stat-item {
  text-align: center;
}

.gallery-section .stat-num {
  display: block;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.gallery-section .stat-label {
  display: block;
  font-size: 12px;
  opacity: .75;
  font-weight: 500;
}

/* ---------- Grid Layouts ---------- */
.gallery-section .gallery-grid {
  display: grid;
  gap: 24px;
}

.gallery-section .grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.gallery-section .grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ---------- Cards ---------- */
.gallery-section .gallery-card {
  background: var(--g-white);
  border-radius: var(--g-radius);
  overflow: hidden;
  box-shadow: var(--g-shadow);
  transition: var(--g-trans);
  cursor: pointer;
}

.gallery-section .gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--g-shadow-lg);
}

/* Image Wrap */
.gallery-section .gallery-card-img-wrap {
  position: relative;
  overflow: hidden;
  background: #e2e8f0;
  /* Default portrait ratio for before/after */
  padding-top: 125%;
}

.gallery-section .gallery-card-img-wrap.ratio-landscape {
  /* Landscape ratio for congress/surgery */
  padding-top: 65%;
}

.gallery-section .gallery-card-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
  display: block;
}

.gallery-section .gallery-card:hover .gallery-card-img-wrap img {
  transform: scale(1.07);
}

/* Overlay on hover */
.gallery-section .gallery-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,23,42,.55) 0%, transparent 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--g-trans);
}

.gallery-section .gallery-card:hover .gallery-card-overlay {
  opacity: 1;
}

/* Zoom button */
.gallery-section .gallery-zoom-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--g-primary);
  transform: scale(.7);
  transition: var(--g-trans);
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}

.gallery-section .gallery-card:hover .gallery-zoom-btn {
  transform: scale(1);
}

.gallery-section .gallery-zoom-btn:hover {
  background: var(--g-primary);
  color: #fff;
  transform: scale(1.1) !important;
}

/* Card Body */
.gallery-section .gallery-card-body {
  padding: 16px 18px 18px;
  text-align: right;
}

.gallery-section .gallery-card-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #50bcbe;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 8px;
  letter-spacing: .02em;
  font-family: iransans-light;
}

.gallery-section .gallery-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--g-text);
  margin: 0 0 6px;
  line-height: 1.4;
  font-family: iransans-light;
}

.gallery-section .gallery-card-meta {
  font-size: 12px;
  color: var(--g-text-muted);
  margin: 0;
  font-family: iransans-light;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}

.gallery-lightbox.open {
  opacity: 1;
  visibility: visible;
}

/* Backdrop */
.gallery-lightbox .lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 20, .93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Inner */
.gallery-lightbox .lightbox-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  height: 100%;
  padding: 60px 24px 80px;
}

/* Image Wrap */
.gallery-lightbox .lightbox-img-wrap {
  position: relative;
  max-width: min(90vw, 960px);
  max-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--g-radius);
  overflow: hidden;
  background: #111827;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

.gallery-lightbox .lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity .35s ease;
  border-radius: var(--g-radius);
}

.gallery-lightbox .lightbox-img.loaded {
  opacity: 1;
}

/* Loader */
.gallery-lightbox .lightbox-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  transition: opacity .3s ease;
}

.gallery-lightbox .lightbox-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.gallery-lightbox .loader-ring {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--g-accent);
  border-radius: 50%;
  animation: galleryLoaderSpin .8s linear infinite;
}

@keyframes galleryLoaderSpin {
  to { transform: rotate(360deg); }
}

/* Close Button */
.gallery-lightbox .lightbox-close {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.gallery-lightbox .lightbox-close:hover {
  background: rgba(239,68,68,.8);
  border-color: transparent;
  transform: rotate(90deg);
}

/* Nav Buttons */
.gallery-lightbox .lightbox-nav {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.gallery-lightbox .lightbox-nav:hover {
  background: var(--g-primary);
  border-color: transparent;
  transform: scale(1.1);
}

.gallery-lightbox .lightbox-nav:disabled {
  opacity: .25;
  cursor: default;
  transform: none;
}

/* Caption Bar */
.gallery-lightbox .lightbox-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
  color: #fff;
}

.gallery-lightbox .lightbox-caption-title {
  font-size: 15px;
  font-weight: 600;
}

.gallery-lightbox .lightbox-counter {
  font-size: 13px;
  opacity: .65;
  background: rgba(255,255,255,.1);
  padding: 4px 12px;
  border-radius: 100px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .gallery-section .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .gallery-section .grid-3,
  .gallery-section .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-section .gallery-tabs {
    border-radius: var(--g-radius);
    flex-wrap: wrap;
    padding: 8px;
  }

  .gallery-section .gallery-tab {
    border-radius: var(--g-radius-sm);
    flex: 1;
    justify-content: center;
    font-size: 13px;
    padding: 10px 16px;
  }

  .gallery-section .gallery-tab-indicator {
    border-radius: var(--g-radius-sm);
  }

  .gallery-section .gallery-banner {
    flex-direction: column;
    text-align: center;
    padding: 28px 24px;
  }

  .gallery-section .gallery-banner-stats {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .gallery-section {
    padding: 50px 0 70px;
  }

  .gallery-section .grid-3,
  .gallery-section .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .gallery-section .gallery-tab span:not(.gallery-tab-indicator) {
    display: none;
  }

  .gallery-section .gallery-tab svg {
    margin: 0;
  }

  .gallery-lightbox .lightbox-nav {
    width: 40px;
    height: 40px;
  }

  .gallery-lightbox .lightbox-inner {
    gap: 8px;
    padding: 50px 10px 70px;
  }
}

@media (max-width: 400px) {
  .gallery-section .grid-3,
  .gallery-section .grid-4 {
    grid-template-columns: 1fr;
  }
}