/**
 * @file
 * Main Gallery - Fantastic Full-Screen Swiper Styles
 */

/* Prevent horizontal scroll on page */
body:has(.main-gallery-wrapper) {
  overflow-x: hidden;
}

/* Gallery Wrapper - Full Width with fixed height to prevent layout shift */
.main-gallery-wrapper {
  width: 100%;
  max-width: 100%;
  position: relative;
  overflow: hidden;
  background: transparent;
  /* Fixed height matching image height - prevents layout shift */
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
}

.main-gallery-wrapper * {
  max-width: 100%;
}

/* Edit Button - Appears on Hover, Vertically Centered */
.main-gallery-edit-btn {
  position: absolute;
  top: 50%;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(102,126,234,0.95), rgba(118,75,162,0.95));
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 8px 24px rgba(102,126,234,0.4);
  opacity: 0;
  transform: translateY(-50%) translateX(10px);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
  pointer-events: none;
}

.main-gallery-wrapper:hover .main-gallery-edit-btn {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}

.main-gallery-edit-btn:hover {
  background: linear-gradient(135deg, rgba(90,103,216,1), rgba(85,60,154,1));
  transform: translateY(-50%) translateX(-2px);
  box-shadow: 0 12px 30px rgba(102,126,234,0.6);
  border-color: rgba(255,255,255,0.4);
}

.main-gallery-edit-btn svg {
  width: 18px;
  height: 18px;
}

.main-gallery-edit-btn span {
  letter-spacing: 0.5px;
}

.main-gallery-container {
  width: 100%;
  position: relative;
  background: transparent;
}

/* Swiper Container */
.main-gallery-swiper {
  width: 100%;
  border-radius: 0 !important;
}

.main-gallery-swiper .swiper-wrapper {
  border-radius: 0 !important;
}

/* Swiper Slides */
.main-gallery-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 0 !important;
}

/* Slide Content */
.gallery-slide-content {
  width: 100%;
  border-radius: 0 !important;
}

.gallery-slide-content img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0 !important;
}

/* Slide Content */
.gallery-slide-content {
  width: 100%;
  border-radius: 0 !important;
}

.gallery-slide-content img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0 !important;
}

/* Simple slide appearance */
.main-gallery-swiper .swiper-slide .gallery-slide-content img {
  opacity: 1;
  width: 100%;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px); /* Dynamic viewport for mobile */
  object-fit: cover;
}

/* Image caption - Hidden */
.gallery-slide-caption {
  display: none !important;
}

/* Navigation Buttons - HIDDEN */
.main-gallery-wrapper .swiper-button-prev.main-gallery-nav,
.main-gallery-wrapper .swiper-button-next.main-gallery-nav,
.main-gallery-container .swiper-button-prev.main-gallery-nav,
.main-gallery-container .swiper-button-next.main-gallery-nav,
.main-gallery-nav.swiper-button-prev,
.main-gallery-nav.swiper-button-next,
.main-gallery-swiper .swiper-button-prev,
.main-gallery-swiper .swiper-button-next {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Ensure swiper wrapper doesn't block pagination */
.main-gallery-swiper .swiper-wrapper {
  z-index: 1 !important;
}

/* Pagination - Always visible, centered in middle */
.main-gallery-pagination {
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  left: 20px !important;
  right: auto !important;
  width: auto !important;
  flex-direction: column !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 100 !important;
  display: flex !important;
  justify-content: center !important;
  gap: 8px !important;
}

/* Large pagination bullets - circles */
/* Using very specific selectors to override theme CSS */
.main-gallery-wrapper .main-gallery-pagination .swiper-pagination-bullet,
.main-gallery-swiper .main-gallery-pagination .swiper-pagination-bullet,
.main-gallery-pagination.swiper-pagination-bullets .swiper-pagination-bullet {
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,0.6) !important;
  opacity: 1 !important;
  display: inline-block !important;
  margin: 0 8px !important;
  border: 2px solid rgba(255,255,255,0.8) !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
  cursor: pointer !important;
}

.main-gallery-wrapper .main-gallery-pagination .swiper-pagination-bullet:hover,
.main-gallery-pagination.swiper-pagination-bullets .swiper-pagination-bullet:hover {
  background: rgba(255,255,255,0.9) !important;
  transform: scale(1.1) !important;
}

/* Active bullet - purple fill */
.main-gallery-wrapper .main-gallery-pagination .swiper-pagination-bullet-active,
.main-gallery-swiper .main-gallery-pagination .swiper-pagination-bullet-active,
.main-gallery-pagination.swiper-pagination-bullets .swiper-pagination-bullet-active {
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  border: 2px solid rgba(255,255,255,0.9) !important;
  box-shadow: 0 4px 12px rgba(102,126,234,0.5) !important;
}

/* Scrollbar - Hidden */
.main-gallery-scrollbar {
  display: none !important;
}

/* Hide pagination when only one slide */
.main-gallery-swiper.single-slide .main-gallery-pagination {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes slideDownFade {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Simple slide transition */
.main-gallery-swiper .swiper-slide {
  transition: none;
}

/* Loading state */
.main-gallery-wrapper.loading {
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-gallery-wrapper.loading:before {
  content: '';
  width: 60px;
  height: 60px;
  border: 5px solid rgba(102,126,234,0.3);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Empty state */
.main-gallery-empty {
  padding: 60px 20px;
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 20px;
  font-weight: 500;
  background: linear-gradient(135deg, #0f0c29, #302b63);
  border-radius: 20px;
  margin: 40px auto;
  max-width: 600px;
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
  
  /* Gallery wrapper - full width on mobile, fixed height */
  .main-gallery-wrapper {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    margin-top: 0 !important;
    position: relative !important;
    /* Fixed height for mobile - matches image height */
    height: 25vh !important;
    height: 25dvh !important;
  }
  
  /* Gallery block - no extra margin, body padding handles the header offset */
  .block-main-gallery {
    margin-top: 0 !important;
    padding-top: 0 !important;
    position: relative !important;
  }
  

  /* Remove body padding gap for gallery on mobile - gallery starts right after header */
  body:has(.main-gallery-wrapper) .region-highlighted:empty,
  body:has(.main-gallery-wrapper) .region-highlighted:not(:has(*)) {
    display: none !important;
  }
  
  /* Gallery image - 25% of screen height on mobile */
  .main-gallery-swiper .swiper-slide .gallery-slide-content img {
    width: 100vw !important;
    height: 25vh !important;
    height: 25dvh !important;
    object-fit: cover !important;
  }
  
  /* Navigation hidden on mobile too */
  .main-gallery-wrapper .swiper-button-prev.main-gallery-nav,
  .main-gallery-wrapper .swiper-button-next.main-gallery-nav,
  .main-gallery-swiper .swiper-button-prev,
  .main-gallery-swiper .swiper-button-next {
    display: none !important;
  }
  
  .gallery-slide-caption {
    font-size: 12px;
    padding: 8px 15px;
    bottom: 10px;
    max-width: 90%;
  }
  
  .main-gallery-scrollbar {
    left: 20px !important;
    right: 20px !important;
    width: calc(100% - 40px) !important;
  }
  
  /* Hide edit button on mobile */
  .main-gallery-edit-btn {
    display: none !important;
  }
  
  /* Smaller pagination on mobile - circles, vertically centered */
  .main-gallery-wrapper .main-gallery-pagination,
  .main-gallery-pagination.swiper-pagination-bullets {
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    left: 10px !important;
    right: auto !important;
    flex-direction: column !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    gap: 6px !important;
  }
  
  .main-gallery-wrapper .main-gallery-pagination .swiper-pagination-bullet,
  .main-gallery-pagination.swiper-pagination-bullets .swiper-pagination-bullet {
    width: 16px !important;
    height: 16px !important;
    margin: 0 2px !important;
    border-radius: 50% !important;
  }
  
  .main-gallery-wrapper .main-gallery-pagination .swiper-pagination-bullet-active,
  .main-gallery-pagination.swiper-pagination-bullets .swiper-pagination-bullet-active {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
  }
}

/* Modal Dialog Styles */
.ui-dialog.main-gallery-edit-dialog {
  border-radius: 20px !important;
  box-shadow: 0 25px 70px rgba(0,0,0,0.3) !important;
  border: none !important;
  overflow: hidden !important;
  max-height: 90vh !important;
  z-index: 10002 !important;
}

/* Ensure overlay is above gallery swiper */
.ui-widget-overlay {
  z-index: 10001 !important;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-titlebar {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  color: white !important;
  border: none !important;
  padding: 20px 30px !important;
  border-radius: 20px 20px 0 0 !important;
  font-size: 24px !important;
  font-weight: 700 !important;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-titlebar-close {
  background: rgba(255,255,255,0.2) !important;
  border: 2px solid rgba(255,255,255,0.3) !important;
  border-radius: 50% !important;
  width: 36px !important;
  height: 36px !important;
  right: 15px !important;
  top: 15px !important;
  transition: all 0.3s ease !important;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-titlebar-close:hover {
  background: rgba(255,255,255,0.3) !important;
  border-color: rgba(255,255,255,0.5) !important;
  transform: rotate(90deg) !important;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-titlebar-close .ui-icon {
  background: none !important;
  text-indent: 0 !important;
  color: white !important;
  font-size: 20px !important;
  line-height: 32px !important;
  font-weight: bold !important;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-titlebar-close .ui-icon:before {
  content: '×' !important;
  display: block !important;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-content {
  padding: 30px !important;
  overflow-y: auto !important;
  max-height: calc(90vh - 100px) !important;
  background: linear-gradient(to bottom, #ffffff, #f8f9ff) !important;
}

/* Custom scrollbar for modal */
.ui-dialog.main-gallery-edit-dialog .ui-dialog-content::-webkit-scrollbar {
  width: 10px;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-content::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 10px;
  border: 2px solid #f1f1f1;
}

.ui-dialog.main-gallery-edit-dialog .ui-dialog-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5568d3, #6a3f91);
}

/* Empty State Styling */
.main-gallery-empty-state {
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  border: 2px dashed rgba(102, 126, 234, 0.3);
  border-radius: 16px;
  padding: 60px 40px;
  margin: 20px 0;
  position: relative;
}


.main-gallery-empty-state .empty-state-content {
  text-align: center;
  max-width: 500px;
}

.main-gallery-empty-state svg {
  color: #667eea;
  opacity: 0.6;
  margin-bottom: 24px;
}

.main-gallery-empty-state h3 {
  font-size: 24px;
  font-weight: 700;
  color: #667eea;
  margin: 0 0 12px 0;
}

.main-gallery-empty-state p {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
  line-height: 1.6;
}

/* RTL adjustments for empty state */
[dir="rtl"] .main-gallery-empty-state .empty-state-content {
  direction: rtl;
}

/* ============================================
   VIDEO SLIDE STYLES
   ============================================ */

/* Video slide container */
.swiper-slide-video {
  position: relative;
}

/* Video element */
.gallery-video {
  width: 100%;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  object-fit: cover;
  display: block;
  background: #000;
}

/* Video controls overlay */
.video-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

/* Sound/Mute button - positioned at bottom right */
.video-sound-btn {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  backdrop-filter: blur(8px);
  z-index: 20;
}

.video-sound-btn:hover {
  transform: scale(1.1);
  background: rgba(102, 126, 234, 0.8);
  border-color: rgba(255, 255, 255, 0.6);
}

.video-sound-btn:active {
  transform: scale(0.95);
}

.video-sound-btn svg {
  width: 24px;
  height: 24px;
}

/* Video progress bar */
.video-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
  pointer-events: auto;
  z-index: 15;
}

.video-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transition: width 0.1s linear;
}

/* Video controls container - repositioned */
.video-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  pointer-events: none;
}

/* Video thumbnail in admin */
.gallery-video-thumbnail {
  width: 150px;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #e0e7ff;
  background: #000;
}

.video-badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  position: absolute;
  bottom: 8px;
  left: 8px;
}

/* Mobile video adjustments */
@media (max-width: 768px) {
  .gallery-video {
    width: 100vw !important;
    height: 25vh !important;
    height: 25dvh !important;
  }
  
  .video-sound-btn {
    width: 40px;
    height: 40px;
    bottom: 15px;
    right: 15px;
  }
  
  .video-sound-btn svg {
    width: 20px;
    height: 20px;
  }
  
  .video-progress {
    height: 3px;
  }
  
  .video-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
}


