/* ════════════════════════════════════════════════════════════
   Gathering Center Gallery Styles
   معرض صور مراكز التجميع
   ════════════════════════════════════════════════════════════ */

.gathering-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── MAIN GALLERY IMAGE ─────────────────────────────────────── */
.gallery-main {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
  aspect-ratio: 16 / 9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── NAVIGATION BUTTONS ─────────────────────────────────────── */
.gallery-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-main:hover .gallery-nav {
  opacity: 1;
}

.gallery-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #333;
  pointer-events: all;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gallery-btn:active {
  transform: scale(0.95);
}

.gallery-prev {
  margin-right: auto;
}

.gallery-next {
  margin-left: auto;
}

/* ── COUNTER ────────────────────────────────────────────────── */
.gallery-counter {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

/* ── THUMBNAILS ────────────────────────────────────────────── */
.gallery-thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 0;
}

.gallery-thumbnails::-webkit-scrollbar {
  height: 4px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
  background: #e5e5e5;
  border-radius: 2px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
  background: #999;
  border-radius: 2px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.gallery-thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid #ddd;
  flex-shrink: 0;
  transition: all 0.2s ease;
  opacity: 0.7;
}

.gallery-thumbnail:hover {
  opacity: 1;
  border-color: #ccc;
}

.gallery-thumbnail.active {
  border-color: #2d8b40;
  box-shadow: 0 0 0 2px rgba(45, 139, 64, 0.2);
  opacity: 1;
}

.gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── GALLERY INFO ────────────────────────────────────────────── */
.gallery-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
  color: #666;
  font-size: 12px;
}

.gallery-info small {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── EMPTY STATE ────────────────────────────────────────────── */
.gallery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: #f9f9f9;
  border-radius: 8px;
  color: #999;
  text-align: center;
}

.gallery-empty i {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.gallery-empty p {
  font-size: 13px;
  margin: 0;
}

/* ── DARK MODE ──────────────────────────────────────────────── */
body.dark-style .gallery-main {
  background: #222;
}

body.dark-style .gallery-btn {
  background: rgba(30, 30, 30, 0.9);
  color: #f0f0f0;
}

body.dark-style .gallery-btn:hover {
  background: rgba(50, 50, 50, 1);
}

body.dark-style .gallery-counter {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

body.dark-style .gallery-thumbnail {
  border-color: #333;
}

body.dark-style .gallery-thumbnail:hover {
  border-color: #555;
}

body.dark-style .gallery-thumbnail.active {
  border-color: #2d8b40;
  box-shadow: 0 0 0 2px rgba(45, 139, 64, 0.3);
}

body.dark-style .gallery-empty {
  background: #1a1a1a;
  color: #666;
}

body.dark-style .gallery-info {
  color: #aaa;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .gallery-main {
    aspect-ratio: 4 / 3;
  }

  .gallery-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .gallery-thumbnail {
    width: 50px;
    height: 50px;
  }

  .gallery-counter {
    font-size: 11px;
    padding: 4px 10px;
  }
}

@media (max-width: 480px) {
  .gallery-thumbnails {
    max-height: 50px;
  }

  .gallery-thumbnail {
    width: 45px;
    height: 45px;
  }

  .gallery-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

/* ════════════════════════════════════════════════════════════
   Leaflet Popup Custom Styling for Gathering Centers
   ════════════════════════════════════════════════════════════ */
.gathering-center-popup-container .leaflet-popup-content-wrapper {
  border-radius: 16px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #ffffff !important;
  max-width: 580px !important;
}

.gathering-center-popup-container .leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
  width: 550px !important;
}

.gathering-center-popup-container .leaflet-popup-close-button {
  top: 8px !important;
  left: 8px !important;
  right: auto !important;
  z-index: 50 !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(4px) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  padding: 0 !important;
  transition: all 0.2s ease !important;
}

.gathering-center-popup-container .leaflet-popup-close-button:hover {
  background: rgba(239, 68, 68, 0.9) !important;
  color: #ffffff !important;
}

.popup-gallery-nav:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
  transform: translateY(-50%) scale(1.1) !important;
}

@media (max-width: 620px) {
  .gathering-center-popup-container .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 24px) !important;
    min-width: 290px !important;
  }
  .gathering-center-popup-container .leaflet-popup-content {
    width: calc(100vw - 32px) !important;
  }
  .gathering-popup-body {
    flex-direction: column !important;
  }
}
