/**
 * Illinois Conservatory for the Arts - Impact Popup Styles (Shared)
 * 
 * Shared popup styles for IMPACT MT Banner component
 * Used by:
 * - IMPACT MT Summer page (/impact-mt-summer/)
 * - IMPACT MT Winter page (/impact-mt-winter/)
 * - IMPACT Dance page (/impact-dance/)
 * 
 * Styling for popup modals with Ontraport form integration
 * Works with banner.php data source and impact-popup.js functionality
 */

/* Universal box-sizing to prevent padding overflow issues */
* {
  box-sizing: border-box;
}

@layer base {
  :root {
    --ease: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --impact-z-close: 10;
  }
}

.impact-popup-modal .impact-popup-header {
  padding: 0.1rem 2.0rem 1.5rem 2.0rem;
  text-align: center ;
  border-bottom: 1px solid rgba(249, 246, 244, 0.1) ;
  flex-shrink: 0 ;
}


/* Base content area styles - shared by all content areas */
.impact-popup-content-area {
  flex: 1 ;
  flex-direction: column ;
  min-height: 0 ;
  position: relative ;
  overflow: hidden; /* scroll only inside .impact-popup-script */
  display: flex; /* ensure flex layout by default */
}

/* Modal-specific content area (no scrolling here; only inside script) */
.impact-popup-modal .impact-popup-content-area {
  justify-content: flex-start;
}
/* ========================================
   HERO POPUP MODAL STYLES
   ======================================== */
@layer components {
  .impact-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    display: none ;
    opacity: 0 ;
    visibility: hidden ;
    transition: opacity var(--ease), visibility var(--ease);
    /* Core Web Vitals optimizations */
    will-change: opacity, visibility;
    contain: layout style paint;
    /* Ensure proper centering */
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Prevent flash during page load */
  }


  .impact-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3, 51, 46, 0.8);
    backdrop-filter: blur(4px);
  }

  /* Active state - makes popup visible */
  .impact-popup-modal.active {
    display: flex ;
    opacity: 1 ;
    visibility: visible ;
    z-index: 9999 ;
    pointer-events: auto ;
  }

  .impact-popup-content {
    /* Prevent any positioning shifts */
    position: absolute ;
    top: 50% ;
    left: 50% ;
    transform: translate(-50%, -50%) scale(0.9) ;
    /* Ensure consistent dimensions */
    max-width: 500px;
    height: 100dvh;
    /* Restore styling */
    font-family: var(--font-ui);
    background-color: var(--ica-green-deep);
    border: 1px solid var(--ica-bg);
    border-radius: 26px !important;
    box-shadow: 0 20px 60px rgba(3, 51, 46, 0.3);
    overflow: hidden;
    transition: transform var(--ease);
    animation: impactModalSlideIn 0.3s ease-out;
    /* Ensure consistent centering */
    margin: 0;
    transform-origin: center center;
    /* Ensure proper scrolling */
    display: flex;
    flex-direction: column;
  }



  @keyframes impactModalSlideIn {
    from {
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.9);
    }
    to {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }
  }

  .impact-popup-close {
    position: absolute ;
    top: 1rem ;
    right: 1rem ;
    background: none ;
    border: none ;
    cursor: pointer ;
    padding: 0.75rem ;
    border-radius: 50%;
    transition: all var(--ease) ;
    z-index: var(--impact-z-close) ;
    min-width: 44px ;
    min-height: 44px ;
    display: flex ;
    align-items: center ;
    justify-content: center ;
    color: inherit ;
  }

  .impact-popup-close:hover {
    background-color: transparent;
    color: inherit;
    transform: scale(1.1);
  }

  .impact-close-icon {
    width: 38px;
    height: 38px;
    display: block;
    color: var(--ica-lime);
    flex-shrink: 0;
  }

  .impact-popup-body {
    padding: 0 ;
    color: var(--ica-bg) ;
    height: auto ;
    display: flex ;
    flex-direction: column ;
    overflow: hidden ;
    position: relative ;
    /* Ensure proper flex layout */
    flex: 1;
    min-height: 0;
    /* Enable scrolling for long content */
    max-height: none;
  }

  .impact-popup-image-wrap {
    height: auto;
    overflow: hidden;
    max-height: 35dvh;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  /* Hide empty image and header divs to prevent spacing issues */
  .impact-popup-image-wrap:empty,
  .impact-popup-header:empty {
    display: none ;
  }

  /* Also hide divs that only contain whitespace */
  .impact-popup-image-wrap:not(:has(*)),
  .impact-popup-header:not(:has(*)) {
    min-height: 0 ;
    height: 0 ;
    margin: 0 ;
    padding: 0 ;
  }

  .impact-popup-image {
    margin-top: 20px;
    width: 80%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 30dvh;
    min-height: 150px;
    max-width: 100%;
    /* Ensure responsive behavior */
    aspect-ratio: auto;
  }



  .impact-popup-title {
    font-size: 19px !important;
    text-transform: uppercase ;
    font-weight: 700 ;
    color: var(--ica-lime) !important ;
    margin: 0 0 0.75rem ;
    line-height: 1.3 ;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) ;
  }

  .impact-popup-subtitle {
    font-family: var(--font-body) ;
    text-transform: uppercase ;
    font-size: 16px;
    color: var(--ica-bg) ;
    margin: 0 ;
    line-height: 1.6 ;
    opacity: 0.95 ;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) ;
  }

  .impact-popup-date {
    font-size: 13px;
    text-transform: uppercase ;
    color: var(--ica-bg) !important;
    margin: 0.25rem 0 0.5rem !important;
    line-height: 1.4;
  }

  /* Content area now uses base styles above with scrollable override */
  .impact-popup-content-area {
    justify-content: flex-start ;
    /* Ensure proper scrolling */
    scrollbar-width: thin;
    scrollbar-color: var(--ica-lime) transparent;
  }

  /* Custom scrollbar for webkit browsers */
  .impact-popup-content-area::-webkit-scrollbar {
    width: 6px;
  }

  .impact-popup-content-area::-webkit-scrollbar-track {
    background: transparent;
  }

  .impact-popup-content-area::-webkit-scrollbar-thumb {
    background: var(--ica-lime);
    border-radius: 3px;
  }

  .impact-popup-content-area::-webkit-scrollbar-thumb:hover {
    background: var(--ica-mint);
  }


  /* Top section container */
  .impact-popup-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    flex-shrink: 0;
  border-radius: 20px 20px 0 0;
    overflow: hidden;
  }

  /* Script content container */
  .impact-popup-script {
    width: 100%;
    flex: 1 1 0%;
    padding: 1px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    /* Enable scrolling for form content */
    scrollbar-width: thin;
    overscroll-behavior: contain;
    /* Acts purely as a scroll container; layout handled by parent */
  }

  /* Unified loading dots styling for all containers */
  .impact-form-loading-dots {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--ica-bg);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    opacity: 0.7;
    transition: opacity 0.5s ease;
  }
  
  /* Unified loading text styling */
  .impact-loading-text {
    font-size: 1rem;
    color: var(--ica-bg);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
  }
  
  /* Unified loading dots container styling */
  .impact-loading-dots-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
  }

  /* Hide loading dots when form is loaded */
  .loaded .impact-form-loading-dots {
    display: none;
  }

  /* Fade-out state triggered by JS right before removal */
  .impact-form-loading-dots.is-fading-out {
    opacity: 0;
  }

  /* Error Message Styles */
  .impact-error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--ica-bg);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin: 1rem;
  }

  .impact-error-title {
    font-size: 1.2rem ;
    margin-bottom: 1rem;
    color: var(--ica-lime) ;
  }

  .impact-error-message-text {
    margin-bottom: 1rem;
  }

  .impact-error-button {
    font-size: 1rem ;
    background: var(--ica-lavender);
    color: var(--ica-green-deep,#1E312F) ;
    border: none;
    padding: 0.8rem 2.5rem;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: var(--ease);
  }

  .impact-error-button:hover {
    opacity: 0.8;
  }

  .impact-error-contact {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.8;
    opacity: 0.95;
  }

  .impact-error-contact > div {
    margin-bottom: 0.5rem;
  }

  .impact-error-contact > div:last-child {
    margin-bottom: 0;
  }

  .impact-error-link {
    color: var(--ica-lime) ;
    text-decoration: underline;
    transition: var(--ease);
  }

  .impact-error-link:hover {
    color: var(--ica-lavender) ;
  }

  /* Loading dots now use unified styles above */


  .impact-loading-dot {
    width: 8px;
    height: 8px;
    background-color: var(--ica-lime);
    border-radius: 50%;
    animation: impactLoadingDots 1.4s infinite ease-in-out both;
  }

  .impact-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
  }

  .impact-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
  }

  .impact-loading-dot:nth-child(3) {
    animation-delay: 0s;
  }

  @keyframes impactLoadingDots {
    0%, 80%, 100% {
      transform: scale(0);
      opacity: 0.5;
    }
    40% {
      transform: scale(1);
      opacity: 1;
    }
  }

  /* Hide/fade styles now use unified styles above */

  /* Remove overrides targeting Ontraport-specific selectors */

  /* (removed unused #promo-spot-availability-form styles) */

  /* No styling on Ontraport iframes - let them use their own CSS */
}

/* ========================================
   HERO POPUP RESPONSIVE STYLES
   ======================================== */

/* Desktop (1025px and above) */
@media (min-width: 1025px) {


  .impact-popup-image {
    
    max-height: 120px;
    min-height: 100px;
  }


  .impact-popup-header {
    padding: 2rem 1.5rem 1.5rem;
  }
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
  .impact-popup-content {
    width: 92vw;
    height: 98dvh;
  }

  .impact-popup-image {

    max-height: 120px;
    min-height: 100px;
  }

  .impact-popup-header {
    padding: 1.5rem 1.5rem 1rem;
  }

  .impact-popup-content-area {
    padding: 1rem 1.5rem 1.5rem;
  }
}

/* Mobile Large (481px - 767px) */
@media (max-width: 767px) and (min-width: 481px) {
  .impact-popup-content {
    width: 95vw;
    height: 95dvh;
    border-radius: 8px;
  }

  .impact-popup-image {
    max-height: 120px;
    min-height: 100px;
    margin-top: 20px;
  }

  .impact-popup-title {
    font-size: 18px !important;
    line-height: 1.2;
  }

  .impact-popup-header {
    padding: 1rem 1.2rem 0.75rem;
  }

  .impact-popup-content-area {
    padding: 0;
  }

  .impact-popup-close {
    top: 0.75rem ;
    right: 0.75rem ;
    padding: 0.5rem ;
    min-width: 40px ;
    min-height: 40px ;
  }

  .impact-close-icon {
    width: 35px;
    height: 35px;
  }
}

/* Mobile Small (320px - 480px) */
@media (max-width: 480px) {
  .impact-popup-content {
    max-width: 99vw;
    width: 99vw;
    height: 95dvh;
  }

  .impact-popup-image {
    max-height: 120px;
    min-height: 100px;
    margin-top: 15px;
    margin-bottom: 15px;
  }

  .impact-popup-title {
    font-size: 22px !important;
    line-height: 1.2;
    margin: 0 0 0.5rem;
  }
  .impact-popup-header {
    padding: 0.75rem 1.0rem 0.5rem;
  }

  .impact-popup-content-area {
    padding: 0.5rem 0.75rem 0.75rem;
  }
  /* Ensure iframe content is properly sized */
  /* No styling on Ontraport iframes - let them use their own CSS */
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .impact-popup-content {
    height: 87dvh;
    max-height: 95dvh;
  }

  .impact-popup-image {
    max-height: 120px;
    min-height: 100px;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .impact-popup-header {
    padding: 0.75rem 1.2rem 0.5rem;
  }

  .impact-popup-content-area {
    padding: 0.5rem 1rem 0.75rem;
  }
}
/* Prevent body scroll when hero popup is open */
body.popup-open {
  overflow: hidden ;
  position: fixed ;
  width: 100% ;
  left: 0 ;
}

