/* Code Protection Styles */
/* Only apply protection in production */
@media (min-width: 1px) {
  /* Text selection enabled for better UX */

  /* Text selection enabled for all elements */

  /* Disable drag and drop */
  * {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
  }

  /* Scrollbars enabled for better UX */

  /* Custom scrollbar-hide class for modals */
  .scrollbar-hide {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox */
  }

  .scrollbar-hide::-webkit-scrollbar {
    display: none;  /* Safari and Chrome */
  }

  /* Modal specific styles for better scrolling */
  .modal-scrollable {
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .modal-scrollable::-webkit-scrollbar {
    display: none;
  }

  /* Force scrolling for modal content */
  .modal-content-scrollable {
    overflow-y: auto !important;
    max-height: 60vh !important;
    min-height: 400px !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .modal-content-scrollable::-webkit-scrollbar {
    display: none !important;
  }

  /* Additional modal scrolling fixes */
  .modal-scroll-fix {
    overflow-y: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .modal-scroll-fix::-webkit-scrollbar {
    display: none !important;
  }

  /* Responsive modal improvements */
  @media (max-width: 640px) {
    .modal-scroll-fix {
      padding-right: 2px !important;
      max-height: calc(90vh - 180px) !important;
      min-height: 200px !important;
    }
  }

  @media (max-width: 768px) {
    .modal-scroll-fix {
      max-height: calc(90vh - 200px) !important;
      min-height: 250px !important;
    }
  }

  /* Ensure modal stays within viewport */
  @media (max-width: 480px) {
    .modal-scroll-fix {
      max-height: calc(90vh - 160px) !important;
      min-height: 150px !important;
    }
  }

  /* Handle zoomed screens */
  @media (max-width: 320px) {
    .modal-scroll-fix {
      max-height: calc(90vh - 140px) !important;
      min-height: 100px !important;
    }
  }

  /* Prevent content overflow on zoom */
  @media (max-width: 480px) {
    .modal-container {
      max-width: 98vw !important;
      margin: 0 1vw !important;
    }
    
    .modal-form-content {
      padding-left: 0.5rem !important;
      padding-right: 0.5rem !important;
    }
  }

  /* Additional zoom protection */
  @media (max-width: 640px) {
    .modal-container {
      max-width: 96vw !important;
      margin: 0 2vw !important;
    }
  }

  /* Force modal to stay within viewport on all devices */
  .modal-container {
    max-width: 95vw !important;
    max-height: 95vh !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  /* Mobile responsive improvements */
  @media (max-width: 767px) {
    .modal-container {
      max-width: 98vw !important;
      max-height: 98vh !important;
      margin: 0 1vw !important;
    }
    
    .modal-form-section {
      overflow-y: auto !important;
      max-height: calc(98vh - 250px) !important;
      height: auto !important;
    }
  }

  /* Small mobile devices */
  @media (max-width: 480px) {
    .modal-container {
      max-width: 99vw !important;
      max-height: 99vh !important;
      margin: 0 0.5vw !important;
    }
    
    .modal-form-section {
      max-height: calc(99vh - 220px) !important;
    }
  }

  /* Large screen optimizations */
  @media (min-width: 1024px) {
    .modal-container {
      max-width: 50% !important;
      margin: 0 auto !important;
    }
    
    .modal-form-content {
      padding-left: 2rem !important;
      padding-right: 2rem !important;
      padding-bottom: 2rem !important;
    }
  }

  /* Extra large screen optimizations */
  @media (min-width: 1280px) {
    .modal-container {
      max-width: 50% !important;
    }
    
    .modal-form-content {
      padding-left: 2.5rem !important;
      padding-right: 2.5rem !important;
      padding-bottom: 2.5rem !important;
    }
  }

  /* Ensure form content is always scrollable */
  .modal-form-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: 100% !important;
  }

  /* Ensure submit button is always visible */
  .form_submit {
    position: relative !important;
    z-index: 20 !important;
    margin-bottom: 1rem !important;
  }

  /* Sticky button container */
  .sticky-bottom {
    position: sticky !important;
    bottom: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    padding: 1rem 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  /* Ensure submit button area is always visible */
  .submit-button-container {
    position: relative !important;
    z-index: 30 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    padding: 1rem 0 !important;
    margin-top: 1rem !important;
  }

  /* New modal structure improvements */
  .modal-header-section {
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  .modal-form-section {
    flex: 1 !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .modal-form-section::-webkit-scrollbar {
    display: none !important;
  }

  /* Responsive scrolling - only on small devices */
  @media (min-width: 768px) {
    .modal-form-section {
      overflow-y: visible !important;
      max-height: none !important;
      height: auto !important;
    }
  }

  @media (max-width: 767px) {
    .modal-form-section {
      overflow-y: auto !important;
      max-height: calc(95vh - 250px) !important;
      height: auto !important;
    }
  }

  /* Ensure modal container adapts to content on larger screens */
  @media (min-width: 768px) {
    .modal-container {
      max-height: none !important;
      height: auto !important;
    }
  }

  /* Modal container responsive height */
  .modal-container {
    max-height: 95vh !important;
  }

  @media (min-width: 768px) {
    .modal-container {
      max-height: none !important;
    }
  }

  .modal-button-section {
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  /* Disable outline for better protection */
  *:focus {
    outline: none !important;
  }

  /* Additional protection for images */
  img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
  }

  /* Allow pointer events for interactive elements */
  button, a, input, textarea, select, [role="button"], [tabindex] {
    pointer-events: auto;
  }

  /* Disable context menu (right-click) */
  * {
    -webkit-touch-callout: none;
  }
}

/* Development mode - disable protection */
@media (max-width: 0px) {
  /* This will never be applied, but provides a way to disable protection */
  * {
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    user-select: auto !important;
  }
}

