/**
 * Sierra at Tahoe - Newsletter Form Modal Styles
 * Custom styling for multi-page newsletter forms with modal overlay on page 2
 * Applies to all Gravity Forms multi-page forms
 * Styled to match the snow reporter modal pattern
 */

/* =============================================================================
   Page 2 Modal Overlay Styles
   ============================================================================= */

/* Modal overlay - ONLY applies when .gform-modal-active class is added by JavaScript */
/* Matches snow-reporter-modal-overlay styling */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.7) !important;
  z-index: 999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 1 !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: auto !important;
  overflow: hidden !important; /* Prevent scroll on overlay */
  overscroll-behavior: contain !important; /* Prevent scroll chaining */
  touch-action: none !important; /* Prevent touch scrolling on overlay */
}

/* Modal content container - matches snow-reporter-modal-content.expanded */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] > .gform_page_fields:first-child {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) scale(1.02) !important;
  width: min(900px, 90vw) !important;
  max-width: 900px !important;
  max-height: 80vh !important;
  height: 80vh !important; /* Set explicit height for flex children to work */
  overflow: hidden !important; /* Changed from visible to hidden to contain scroll */
  background: rgba(20, 44, 45, 0.95) !important;
  border-radius: 24px !important;
  padding: 0 !important; /* Remove padding to allow sticky header */
  padding-bottom: 0 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  transform-origin: center center !important;
  will-change: transform !important;
  color: var(--wp--preset--color--snowcap-sage) !important;
  display: flex !important;
  flex-direction: column !important;
  touch-action: pan-y !important; /* Allow vertical touch scrolling on modal */
  pointer-events: auto !important; /* Ensure content is interactive */
}

/* Modal inner scrollable container - matches snow-reporter-modal-inner */
/* Increased specificity to override Gravity Forms theme reset */
.gform_wrapper.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] > .gform_page_fields:first-child > .gform_fields {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 0 !important; /* Important for flex scrolling */
  padding: 24px 32px 100px 32px !important; /* All padding consolidated since .gform_fields is now the scrollable container */
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  font-size: 18px !important;
  line-height: 1.8 !important;
  color: var(--wp--preset--color--snowcap-sage) !important;
  word-wrap: break-word !important;

  /* Smooth scrolling */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 255, 240, 0.3) transparent;
  touch-action: pan-y !important; /* Allow vertical touch scrolling */
  overscroll-behavior: contain !important; /* Prevent scroll from bubbling to body */
}

/* Custom scrollbar styling */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields > .gform_fields::-webkit-scrollbar {
  width: 8px;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields > .gform_fields::-webkit-scrollbar-track {
  background: transparent;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields > .gform_fields::-webkit-scrollbar-thumb {
  background-color: rgba(245, 255, 240, 0.3);
  border-radius: 4px;
}

/* Modal header - sticky header that stays at top while content scrolls */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields::before {
  content: "Complete Your Profile";
  display: block;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  background: rgba(20, 44, 45, 0.98) !important;
  font-family: var(--wp--preset--font-family--mont) !important;
  font-size: 28px !important;
  font-weight: 800 !important;
  line-height: 1.14 !important;
  font-style: normal !important;
  color: var(--wp--preset--color--snowcap-sage) !important;
  padding: 32px 32px 24px 32px !important;
  padding-right: 80px !important; /* Space for close button */
  margin-bottom: 0 !important;
  text-align: left !important;
  border-radius: 24px 24px 0 0 !important;
  flex-shrink: 0 !important;
  /* Add subtle shadow when scrolling */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Close button - X icon added via CSS pseudo-element to avoid Gravity Forms theme conflicts */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] > .gform_page_fields:first-child .gform-modal-close-btn {
  position: absolute !important;
  top: 28px !important;
  right: 28px !important;
  background: rgba(245, 255, 240, 0.1) !important;
  border: 2px solid rgba(245, 255, 240, 0.3) !important;
  border-radius: 50% !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background 0.2s ease, transform 0.2s ease !important;
  z-index: 10 !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
  box-shadow: none !important;
  text-indent: 0 !important;
  line-height: 1 !important;
}

/* X icon using CSS pseudo-element with inline SVG */
.gform_wrapper.gform-modal-active .gform-modal-close-btn::before {
  content: '' !important;
  display: block !important;
  width: 24px !important;
  height: 24px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23F5FFF0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6L6 18M6 6L18 18'/%3E%3C/svg%3E") !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  transition: transform 0.2s ease !important;
  flex-shrink: 0 !important;
}

.gform_wrapper.gform-modal-active .gform-modal-close-btn:hover {
  background: rgba(245, 255, 240, 0.2) !important;
}

.gform_wrapper.gform-modal-active .gform-modal-close-btn:hover::before {
  transform: rotate(90deg) !important;
}

.gform_wrapper.gform-modal-active .gform-modal-close-btn:focus {
  outline: 2px solid var(--wp--preset--color--sierra-gold) !important;
  outline-offset: 2px !important;
}

/* =============================================================================
   Form Field Styling for Page 2
   ============================================================================= */

/* Input fields - clean and subtle */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="text"],
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="email"] {
  border: 1px solid rgba(245, 255, 240, 0.25) !important;
  border-radius: 6px !important;
  padding: 10px 14px !important;
  font-size: 16px !important;
  font-family: var(--wp--preset--font-family--gt-standard) !important;
  font-weight: 400 !important;
  font-style: normal !important;
  background-color: rgba(245, 255, 240, 0.08) !important;
  color: var(--wp--preset--color--snowcap-sage) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
  outline: none !important;
}

/* Select fields - no top/bottom padding to prevent label cutoff */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] select {
  border: 1px solid rgba(245, 255, 240, 0.25) !important;
  border-radius: 6px !important;
  padding: 0 14px !important;
  font-size: 16px !important;
  font-family: var(--wp--preset--font-family--gt-standard) !important;
  font-weight: 400 !important;
  font-style: normal !important;
  background-color: rgba(245, 255, 240, 0.08) !important;
  color: var(--wp--preset--color--snowcap-sage) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
  outline: none !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input::placeholder,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] select::placeholder {
  color: rgba(245, 255, 240, 0.4) !important;
  font-style: normal !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="text"]:focus,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="email"]:focus,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] select:focus {
  border-color: rgba(245, 255, 240, 0.5) !important;
  background-color: rgba(245, 255, 240, 0.12) !important;
  box-shadow: 0 0 0 3px rgba(245, 255, 240, 0.08) !important;
}

/* Field labels - subtle and clean */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gfield_label,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] legend {
  font-family: var(--wp--preset--font-family--gt-standard) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  font-style: normal !important;
  color: rgba(245, 255, 240, 0.8) !important;
  margin-bottom: 8px !important;
  display: block !important;
}

/* Sub-labels for name, address fields */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-field-label--type-sub {
  font-size: 12px !important;
  font-weight: 400 !important;
  font-style: normal !important;
  color: rgba(245, 255, 240, 0.5) !important;
  margin-top: 4px !important;
}

/* Links - match snow reporter sierra gold styling */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] a {
  color: var(--wp--preset--color--sierra-gold) !important;
  text-decoration: underline !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] a:hover {
  opacity: 0.8 !important;
}

/* Remove excessive row gap from Gravity Forms theme */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_fields {
  grid-row-gap: 16px !important;
  row-gap: 16px !important;
  margin-bottom: 0 !important;
  /* Padding is set on the parent selector (scrollable container) - line 65 */
}

/* Footer positioned inside gform_fields - only justify-content and margin-top */
.gform_wrapper.gform-modal-active .gform_fields .gform_page_footer {
  justify-content: flex-end !important;
  margin-top: 0 !important;
  margin-bottom: 32px !important;
}

/* Field spacing - tighter for cleaner look */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gfield {
  margin-bottom: 20px !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gfield:last-of-type {
  margin-bottom: 0 !important;
}

/* Grid layouts for name and address */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-grid-row {
  display: grid;
  gap: var(--wp--preset--spacing--small);
  grid-template-columns: 1fr 1fr;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .ginput_full {
  grid-column: 1 / -1;
}

/* Radio and checkbox styling */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gchoice {
  margin-bottom: 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="radio"],
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="radio"] {
  border-radius: 50% !important;
  appearance: auto !important;
  -webkit-appearance: radio !important;
  -moz-appearance: radio !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="checkbox"] {
  border-radius: 3px !important;
  appearance: auto !important;
  -webkit-appearance: checkbox !important;
  -moz-appearance: checkbox !important;
}

/* Override Gravity Forms CSS variables for radio/checkbox colors */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] {
  --gf-ctrl-choice-check-color: var(--wp--preset--color--snowcap-sage) !important;
}

/* Override Gravity Forms theme framework radio button checked state */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-theme--framework input[type="radio"]::before,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-theme--framework input[type="radio"]:where(:not(.gform-theme__disable):not(.gform-theme__disable *):not(.gform-theme__disable-framework):not(.gform-theme__disable-framework *))::before {
  background-color: var(--wp--preset--color--snowcap-sage) !important;
}

/* Override Gravity Forms theme framework checkbox checked state */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-theme--framework input[type="checkbox"]::before,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-theme--framework input[type="checkbox"]:where(:not(.gform-theme__disable):not(.gform-theme__disable *):not(.gform-theme__disable-framework):not(.gform-theme__disable-framework *))::before {
  background-color: var(--wp--preset--color--snowcap-sage) !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-field-label--type-inline {
  font-family: var(--wp--preset--font-family--gt-standard) !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  font-style: normal !important;
  color: var(--wp--preset--color--snowcap-sage) !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  cursor: pointer !important;
}

/* Field descriptions */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gfield_description {
  font-size: 14px !important;
  font-weight: 400 !important;
  color: rgba(245, 255, 240, 0.7) !important;
  margin-bottom: 12px !important;
  margin-top: 4px !important;
  font-style: italic !important;
  line-height: 1.5 !important;
}

/* =============================================================================
   Button Styling
   ============================================================================= */

/* Footer button container - positioned at bottom-right of modal content */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] > .gform_page_footer:first-of-type {
  position: absolute !important;
  bottom: 32px !important;
  right: 32px !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  gap: 12px !important;
  align-items: center !important;
  justify-content: flex-end !important;
  z-index: 1000001 !important;
  pointer-events: none !important;
  background: transparent !important;
  border: none !important;
  transform: none !important;
}

/* Primary submit button - sierra gold like links */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="submit"] {
  position: relative !important;
  background-color: var(--wp--preset--color--sierra-gold) !important;
  color: var(--wp--preset--color--deep-alpine) !important;
  border: 2px solid var(--wp--preset--color--sierra-gold) !important;
  border-radius: 8px !important;
  padding: 14px 32px !important;
  font-family: var(--wp--preset--font-family--mont) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-style: normal !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  z-index: 11 !important;
  pointer-events: auto !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="submit"]:hover {
  opacity: 0.9 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="submit"]:active {
  transform: translateY(0) !important;
}

/* Secondary previous button - more visible */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="button"] {
  position: relative !important;
  background-color: rgba(245, 255, 240, 0.08) !important;
  color: var(--wp--preset--color--snowcap-sage) !important;
  border: 2px solid rgba(245, 255, 240, 0.4) !important;
  border-radius: 8px !important;
  padding: 14px 32px !important;
  font-family: var(--wp--preset--font-family--mont) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-style: normal !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  z-index: 11 !important;
  pointer-events: auto !important;
}

.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="button"]:hover {
  background-color: rgba(245, 255, 240, 0.15) !important;
  border-color: rgba(245, 255, 240, 0.6) !important;
  transform: translateY(-1px) !important;
}

/* =============================================================================
   Animations
   ============================================================================= */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

/* Tablet */
@media (max-width: 768px) {
  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields {
    width: 95vw !important;
    max-height: 85vh !important;
  }

  .gform_wrapper.gform-modal-active .gform-modal-close-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    top: 16px !important;
    right: 16px !important;
  }

  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform-grid-row {
    grid-template-columns: 1fr;
  }

  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_footer {
    flex-direction: column-reverse;
  }

  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="submit"],
  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="button"] {
    width: 100%;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields {
    padding: var(--wp--preset--spacing--medium);
  }

  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields::before {
    font-size: var(--wp--preset--font-size--h4);
  }
}

/* =============================================================================
   Accessibility
   ============================================================================= */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"],
  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields,
  .gform_wrapper.gform-modal-active .gform-modal-close-btn {
    transition-duration: 0.01ms !important;
  }

  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] .gform_page_fields {
    transform: translate(-50%, -50%) scale(1) !important;
  }

  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="submit"]:hover,
  .gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="button"]:hover {
    transform: none !important;
  }

  .gform_wrapper.gform-modal-active .gform-modal-close-btn:hover svg {
    transform: none !important;
  }
}

/* Focus visible */
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input:focus-visible,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] select:focus-visible,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="submit"]:focus-visible,
.gform_wrapper.gform-modal-active [id*="gform_page_"][id$="_2"] input[type="button"]:focus-visible {
  outline: 2px solid var(--wp--preset--color--sugar-pine-green);
  outline-offset: 2px;
}
