/* JotForm Modal Styles */

/* Modal Container */
.jotform-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.jotform-modal.active {
    display: block;
    opacity: 1;
}

/* Overlay */
.jotform-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

/* Modal Container */
.jotform-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: visible;
    transition: transform 0.3s ease-in-out;
}

.jotform-modal.active .jotform-modal-container {
    transform: translate(-50%, -50%) scale(1);
}

/* Close Button - Overlay Style */
.jotform-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.jotform-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    transform: scale(1.1);
}

.jotform-modal-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Modal Content */
.jotform-modal-content {
    position: relative;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Iframe */
#jotform-iframe {
    width: 100%;
    min-height: 100%;
    border: none;
    background: #fff;
    display: block;
    height: auto;
}

/* Custom scrollbar for webkit browsers */
.jotform-modal-content::-webkit-scrollbar {
    width: 12px;
}

.jotform-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.jotform-modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.jotform-modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
.jotform-modal-content {
    scrollbar-width: auto;
    scrollbar-color: #888 #f1f1f1;
}

/* Scrolled state for modal content */
.jotform-modal-content.scrolled {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Smooth scrolling for modal content */
.jotform-modal-content {
    scroll-behavior: smooth;
}

/* Ensure iframe content is properly sized */
#jotform-iframe {
    min-height: 600px; /* Minimum height for forms */
}

/* Mobile scrolling improvements */
@media (max-width: 768px) {
    .jotform-modal-content {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    #jotform-iframe {
        min-height: 500px; /* Slightly smaller minimum on mobile */
    }
}

/* Loading State */
.jotform-modal.loading .jotform-modal-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Body scroll lock */
body.jotform-modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .jotform-modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .jotform-modal-content {
        max-height: 95vh;
    }
    
    .jotform-modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .jotform-modal-container {
        width: 98%;
        max-height: 98vh;
        border-radius: 8px;
    }
    
    .jotform-modal-content {
        max-height: 98vh;
    }
    
    .jotform-modal-close {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
        font-size: 18px;
    }
}

/* Accessibility improvements */
.jotform-modal-close:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .jotform-modal-overlay {
        background-color: rgba(0, 0, 0, 0.9);
    }
    
    .jotform-modal-container {
        border: 2px solid #000;
    }
    
    .jotform-modal-close {
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .jotform-modal,
    .jotform-modal-container,
    .jotform-modal-close {
        transition: none;
    }
    
    .jotform-modal.loading .jotform-modal-content::before {
        animation: none;
    }
} 