/* Popup Content Module CSS */

/* Base overlay styles */
.pc-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}

/* Overlay states */
.pc-popup-overlay.pc-opening {
  opacity: 0;
  visibility: visible;
}

.pc-popup-overlay.pc-open {
  opacity: 1;
  visibility: visible;
}

.pc-popup-overlay.pc-closing {
  opacity: 0;
  visibility: visible;
}

/* Popup container */
.pc-popup-container {
  position: relative;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  max-height: 90vh;
  width: 100%;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: scale(1);
  opacity: 1;
}

/* Content wrapper with scrolling */
.pc-content-wrapper {
  max-height: calc(90vh - 40px); /* Account for container padding */
  overflow-y: auto;
  padding: 0;
  box-sizing: border-box;
}

/* Custom scrollbar for webkit browsers */
.pc-content-wrapper::-webkit-scrollbar {
  width: 8px;
}

.pc-content-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.pc-content-wrapper::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.pc-content-wrapper::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Close button */
.pc-close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  border: none;
  background-color: transparent;
  color: #666666;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  font-family: Arial, sans-serif;
}

.pc-close-button:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: #333333;
  transform: scale(1.1);
}

.pc-close-button:focus {
  outline: 2px solid rgba(0, 0, 0, 0.2);
  outline-offset: 2px;
}

.pc-close-button:active {
  transform: scale(0.95);
}

/* Loading state */
.pc-loading {
  text-align: center;
  padding: 40px 20px;
  color: #666666;
  font-size: 16px;
}

/* Popup content elements */
.pc-popup-image {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 0;
  border-radius: 0;
  max-height: 300px;
  object-fit: cover;
}

/* Content area with padding (everything except the image) */
.pc-popup-title,
.pc-popup-content {
  padding-left: 48px;
  padding-right: 48px;
}

.pc-popup-title {
  font-size: 28px;
  font-weight: 600;
  color: #333333;
  line-height: 1.2;
  margin: 20px 0 20px 0;
  padding-top: 0;
  padding-bottom: 0;
}

.pc-popup-content {
  font-size: 16px;
  font-weight: normal;
  color: #333333;
  line-height: 1.6;
  margin: 0;
  padding-top: 0;
  padding-bottom: 30px;
}

/* Content styling for rich text */
.pc-popup-content p {
  margin-bottom: 16px;
}

.pc-popup-content p:last-child {
  margin-bottom: 0;
}

.pc-popup-content h1,
.pc-popup-content h2,
.pc-popup-content h3,
.pc-popup-content h4,
.pc-popup-content h5,
.pc-popup-content h6 {
  margin-top: 24px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.pc-popup-content h1:first-child,
.pc-popup-content h2:first-child,
.pc-popup-content h3:first-child,
.pc-popup-content h4:first-child,
.pc-popup-content h5:first-child,
.pc-popup-content h6:first-child {
  margin-top: 0;
}

.pc-popup-content ul,
.pc-popup-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.pc-popup-content li {
  margin-bottom: 4px;
}

.pc-popup-content blockquote {
  margin: 16px 0;
  padding: 16px 20px;
  border-left: 4px solid #e0e0e0;
  background-color: #f9f9f9;
  font-style: italic;
}

.pc-popup-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.pc-popup-content a {
  color: #0073aa;
  text-decoration: none;
}

.pc-popup-content a:hover {
  text-decoration: underline;
}

/* Animation classes - Fade (default) */
.pc-popup-overlay.pc-opening {
  opacity: 0;
}

.pc-popup-overlay.pc-open {
  opacity: 1;
}

/* Animation classes - Scale */
.pc-popup-overlay.pc-animation-scale.pc-opening .pc-popup-container {
  transform: scale(0.8);
  opacity: 0;
}

.pc-popup-overlay.pc-animation-scale.pc-open .pc-popup-container {
  transform: scale(1);
  opacity: 1;
}

/* Animation classes - Slide Up */
.pc-popup-overlay.pc-animation-slide-up.pc-opening .pc-popup-container {
  transform: translateY(50px);
  opacity: 0;
}

.pc-popup-overlay.pc-animation-slide-up.pc-open .pc-popup-container {
  transform: translateY(0);
  opacity: 1;
}

/* Animation classes - Slide Down */
.pc-popup-overlay.pc-animation-slide-down.pc-opening .pc-popup-container {
  transform: translateY(-50px);
  opacity: 0;
}

.pc-popup-overlay.pc-animation-slide-down.pc-open .pc-popup-container {
  transform: translateY(0);
  opacity: 1;
}

/* Animation classes - Slide Left */
.pc-popup-overlay.pc-animation-slide-left.pc-opening .pc-popup-container {
  transform: translateX(50px);
  opacity: 0;
}

.pc-popup-overlay.pc-animation-slide-left.pc-open .pc-popup-container {
  transform: translateX(0);
  opacity: 1;
}

/* Animation classes - Slide Right */
.pc-popup-overlay.pc-animation-slide-right.pc-opening .pc-popup-container {
  transform: translateX(-50px);
  opacity: 0;
}

.pc-popup-overlay.pc-animation-slide-right.pc-open .pc-popup-container {
  transform: translateX(0);
  opacity: 1;
}

/* Body scroll lock */
body.pc-popup-open {
  overflow: hidden;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .pc-popup-overlay {
    padding: 15px;
  }

  .pc-popup-container {
    max-width: 95vw;
    max-height: 95vh;
  }

  .pc-content-wrapper {
    max-height: calc(95vh - 30px);
  }

  .pc-close-button {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .pc-popup-title,
  .pc-popup-content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .pc-popup-title {
    font-size: 24px;
  }

  .pc-popup-content {
    font-size: 15px;
    padding-bottom: 20px;
  }

  .pc-popup-image {
    max-height: 250px;
  }
}

@media (max-width: 480px) {
  .pc-popup-overlay {
    padding: 10px;
  }

  .pc-popup-title,
  .pc-popup-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .pc-popup-title {
    font-size: 22px;
    margin-bottom: 16px;
  }

  .pc-popup-content {
    font-size: 14px;
    padding-bottom: 16px;
  }

  .pc-popup-image {
    max-height: 200px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .pc-popup-container {
    border: 2px solid #000000;
  }

  .pc-close-button {
    border: 1px solid #000000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .pc-popup-overlay,
  .pc-popup-container,
  .pc-close-button {
    transition: none;
  }

  .pc-popup-overlay.pc-opening .pc-popup-container,
  .pc-popup-overlay.pc-open .pc-popup-container {
    transform: none;
  }
}

/* Focus management for accessibility */
.pc-popup-overlay:focus-within .pc-popup-container {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* Ensure proper stacking for multiple popups */
.pc-popup-overlay[style*="z-index: 10010"] {
  z-index: 10010 !important;
}

.pc-popup-overlay[style*="z-index: 10020"] {
  z-index: 10020 !important;
}

.pc-popup-overlay[style*="z-index: 10030"] {
  z-index: 10030 !important;
}

.pc-popup-overlay[style*="z-index: 10040"] {
  z-index: 10040 !important;
}

.pc-popup-overlay[style*="z-index: 10050"] {
  z-index: 10050 !important;
}

/* Additional defensive CSS to ensure popups appear on top */
.pc-popup-overlay {
  z-index: 10000 !important;
  position: fixed !important;
  isolation: isolate;
}

/* Force stacking context */
.pc-popup-overlay.pc-open {
  z-index: 10000 !important;
}

/* Ensure popup container creates its own stacking context */
.pc-popup-container {
  position: relative !important;
  z-index: 1;
  isolation: isolate;
}

/* Print styles - hide popups when printing */
@media print {
  .pc-popup-overlay {
    display: none !important;
  }
}
