/* Modal Container */
#artwork-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  box-sizing: border-box;
}

/* When modal is shown, use flex display */
#artwork-modal.show {
  display: flex !important;
}

/* Prevent body scrolling when modal is open */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Modal Overlay */
#artwork-modal .modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1;
}

/* Modal Content */
#artwork-modal .modal-content {
  background: #fff;
  height: 100vh;
  width: 100%;
  overflow-y: auto;
  position: relative;
  z-index: 2;

}

/* Close Button */
#artwork-modal .modal-close {

  background: #fff;
  border: none;
  cursor: pointer;

}

/* Modal Body */
#artwork-modal .modal-body {
  flex: 1;
  /* min-height: 100vh; */
  /* padding-bottom: 100px; */ /* Space for navigation */
  /* height: 100vh; */
  /* position: relative; */
}

/* Navigation Buttons - Centered and Modern */
#artwork-modal .modal-nav {
  position: absolute;
  left: 50%;
  transform: translate(-50%,-50%);
  z-index: 10;
  width: 100%;
  display: flex;
  justify-content: space-between;
  top: 50%;
  display:none!important;
}

#artwork-modal .modal-nav button {
  background: unset;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 100px;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

#artwork-modal .modal-nav button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

#artwork-modal .modal-nav button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#artwork-modal .modal-nav button:hover::before {
  left: 100%;
}

#artwork-modal .modal-nav button:active {
  transform: translateY(0);
  transition: transform 0.1s;
}

#artwork-modal .modal-nav button:disabled,
#artwork-modal .modal-nav button.disabled {
  background: linear-gradient(135deg, #bbb 0%, #999 100%);
  color: #666;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#artwork-modal .modal-nav button:disabled:hover,
#artwork-modal .modal-nav button.disabled:hover {
  transform: none;
  box-shadow: none;
}

#artwork-modal .modal-nav button:disabled::before,
#artwork-modal .modal-nav button.disabled::before {
  display: none;
}

/* Previous button styling */
#artwork-modal .modal-prev {
  /* background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important; */
}

#artwork-modal .modal-prev:hover {
  box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4) !important;
}

/* Next button styling */
#artwork-modal .modal-next {
}

#artwork-modal .modal-next:hover {
  box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4) !important;
}

/* Loading Bar - Enhanced Progress Bar */
#modal-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 6px;
  background: transparent;
  z-index: 999999;
  display: block;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Progress Bar Fill */
#modal-loading-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, 
    #667eea 0%, 
    #764ba2 25%, 
    #f093fb 50%, 
    #f5576c 75%, 
    #4facfe 100%
  );
  transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 
    0 0 20px rgba(102, 126, 234, 0.6),
    0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Enhanced Loading Bar with Shimmer Effect */
#modal-loading-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.9), 
    transparent
  );
  animation: shimmer 2s infinite;
  z-index: 1;
}

/* Show the progress bar when loading */
#modal-loading-bar.show {
  display: block !important;
  opacity: 1;
  transform: translateY(0);
}

#modal-loading-bar.show::after {
  width: 100%;
  transition: width 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Hide the progress bar */
#modal-loading-bar.hide {
  opacity: 0;
  transform: translateY(-100%);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading Bar Animation */
#modal-loading-bar.loading::after {
  animation: loadingPulse 1.8s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { 
    opacity: 1;
    transform: scaleY(1);
    filter: brightness(1);
  }
  50% { 
    opacity: 0.9;
    transform: scaleY(1.2);
    filter: brightness(1.3);
  }
}

@keyframes shimmer {
  0% {
    left: -100%;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

/* Enhanced Progress Bar Glow Effect */
#modal-loading-bar.show.loading::after {
  box-shadow: 
    0 0 25px rgba(102, 126, 234, 0.8),
    0 0 50px rgba(102, 126, 234, 0.4),
    0 0 75px rgba(102, 126, 234, 0.2),
    0 2px 15px rgba(0, 0, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  #artwork-modal {
    padding: 0px;
  }
  .modal-header-content {
    justify-content: center;
    padding-top: 0;
}
  #artwork-modal .modal-close {
    top: 15px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
  }
  
  #artwork-modal .modal-nav {
    bottom: 20px;
    padding: 12px 20px;
    gap: 15px;
  }
  
  #artwork-modal .modal-nav button {
    padding: 10px 20px;
    min-width: 80px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  #artwork-modal .modal-content {
    padding: 1rem;
  }
  
  #artwork-modal .modal-nav {
    bottom: 15px;
    padding: 10px 15px;
    gap: 10px;
  }
  
  #artwork-modal .modal-nav button {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 70px;
  }

  #artwork-modal .modal-close {
    top: 10px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }
}

/* Animation for modal appearance */
#artwork-modal.show .modal-content {
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Fix for WooCommerce styles in modal */
#artwork-modal .woocommerce-product-gallery {
  margin: 0;
  padding: 0;
}

/* Form overlay compatibility */
.rw-gf-overlay {
  z-index: 99998;
}

.rw-gf-overlay.is-open { 
  opacity: 1; 
  pointer-events: auto; 
}

.rw-gf-modal {
  z-index: 99999;
}

.rw-gf-modal.is-open { 
  opacity: 1; 
  pointer-events: auto; 
  transform: translate(-50%, -50%) scale(1); 
}

body.rw-gf-locked { 
  overflow: hidden; 
}

/* Smooth scrolling for modal body */
#artwork-modal .modal-content {
  scroll-behavior: smooth;
}

/* Better loading state */
#artwork-modal .modal-body.loading {
  position: relative;
  min-height: 300px;
}

#artwork-modal .modal-body.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}