/**
 * MSCF Popup Form Styles - 2025 Modern Design
 * Glassmorphism modal with backdrop blur
 */

/* Popup Overlay */
.mscf-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: block; /* Changed from flex to allow page scrolling */
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 40px 20px; /* Increased top/bottom padding for scroll space */
    overflow-y: auto !important; /* Allow page scrolling */
    overflow-x: hidden !important;
}

.mscf-popup-overlay.mscf-popup-active {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.mscf-popup-container {
    position: relative;
    /* Container should not have overlay-like styling - only content wrapper */
    /* Form builder appearance settings control the actual form background */
    max-width: 600px;
    width: 100%;
    max-height: none; /* Remove height restriction */
    overflow: visible; /* Allow content to flow naturally */
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Popup Size Variants */
.mscf-popup-container.popup-size-small {
    max-width: 400px;
    margin: 0 auto; /* Center horizontally */
}

.mscf-popup-container.popup-size-medium {
    max-width: 600px;
    margin: 0 auto; /* Center horizontally */
}

.mscf-popup-container.popup-size-large {
    max-width: 800px;
    margin: 0 auto; /* Center horizontally */
}

.mscf-popup-container.popup-size-extra-large {
    max-width: 1000px;
    margin: 0 auto; /* Center horizontally */
}

.mscf-popup-container.popup-size-full {
    max-width: 90%;
    margin: 0 auto; /* Center horizontally */
}

.mscf-popup-active .mscf-popup-container {
    transform: scale(1) translateY(0);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .mscf-popup-container {
        background: rgba(30, 30, 30, 0.95);
        color: #ffffff;
    }
}

/* Close Button - Positioned inside modal container */
.mscf-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000; /* Above form content */
    flex-shrink: 0; /* Don't shrink in flex container */
}

.mscf-popup-close:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: rotate(90deg);
}

.mscf-popup-close::before,
.mscf-popup-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #333;
    transition: background 0.3s ease;
}

.mscf-popup-close:hover::before,
.mscf-popup-close:hover::after {
    background: white;
}

.mscf-popup-close::before {
    transform: rotate(45deg);
}

.mscf-popup-close::after {
    transform: rotate(-45deg);
}

/* Popup Form Styles */
.mscf-popup-container .mscf-schema-form {
    margin: 0;
    /* Form builder appearance settings will apply here */
}

.mscf-popup-container h2 {
    margin: 0 0 24px 0;
    font-size: 28px;
    font-weight: 700;
    /* Removed hardcoded gradient - will use form builder label color or default */
}

/* Form Fields in Popup - Minimal overrides, let form builder control most styles */
.mscf-popup-container .mscf-field-wrapper {
    margin-bottom: 20px;
}

.mscf-popup-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    /* Form builder label_color will apply */
}

.mscf-popup-container input[type="text"],
.mscf-popup-container input[type="email"],
.mscf-popup-container input[type="tel"],
.mscf-popup-container input[type="number"],
.mscf-popup-container input[type="date"],
.mscf-popup-container select,
.mscf-popup-container textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Form builder will control: background, border, border-radius, color */
}

.mscf-popup-container input:focus,
.mscf-popup-container select:focus,
.mscf-popup-container textarea:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    /* Border color on focus - can be enhanced to use form builder primary color */
}

/* Submit Button in Popup - Let form builder control colors */
.mscf-popup-container button[type="submit"] {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Form builder will control: background, color, border, border-radius */
}

.mscf-popup-container button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    /* Form builder will control hover background */
}

.mscf-popup-container button[type="submit"]:active {
    transform: translateY(0);
}

/* Success Message in Popup */
.mscf-popup-container .mscf-success-message {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

/* Error Message in Popup */
.mscf-popup-container .mscf-error-message {
/* Success Message in Popup */
.mscf-popup-container .mscf-success-message {
    background: #10b981;
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}
@media (max-width: 768px) {
    .mscf-popup-overlay {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }
    
    .mscf-popup-container {
        /* Removed hardcoded padding - form builder will control it */
        max-height: none;
        min-height: auto;
        margin: 20px 0;
    }
    
    .mscf-popup-container h2 {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .mscf-popup-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    
    .mscf-popup-container .mscf-field-wrapper {
        margin-bottom: 16px;
    }
    
    .mscf-popup-container input[type="text"],
    .mscf-popup-container input[type="email"],
    .mscf-popup-container input[type="tel"],
    .mscf-popup-container input[type="number"],
    .mscf-popup-container input[type="date"],
    .mscf-popup-container select,
    .mscf-popup-container textarea {
        padding: 12px 14px;
        font-size: 16px !important;
    }
    
    .mscf-popup-container button[type="submit"] {
        padding: 16px 24px;
        font-size: 16px;
    }
    
    /* Prevent zoom on iOS when focusing inputs */
    .mscf-popup-container input,
    .mscf-popup-container select,
    .mscf-popup-container textarea {
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
@media (max-width: 480px) {
    .mscf-popup-overlay {
        padding: 5px;
    }
    
    .mscf-popup-container {
        /* Removed hardcoded padding and border-radius - form builder will control it */
        margin: 10px 0;
    }
    
    .mscf-popup-container h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }
    .mscf-popup-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }
    
    .mscf-popup-close::before,
    .mscf-popup-close::after {
        width: 16px;
    }
    
    .mscf-popup-container .mscf-field-wrapper {
        margin-bottom: 14px;
    }
    
    .mscf-popup-container label {
        font-size: 13px !important;
        margin-bottom: 6px !important;
    }
    
    .mscf-popup-container input[type="text"],
    .mscf-popup-container input[type="email"],
    .mscf-popup-container input[type="text"],
    .mscf-popup-container input[type="email"],
    .mscf-popup-container input[type="tel"],
    .mscf-popup-container input[type="number"],
    .mscf-popup-container input[type="date"],
    .mscf-popup-container select,
    .mscf-popup-container textarea {
        padding: 11px 12px;
        /* Border-radius controlled by form builder */
    }mscf-popup-container button[type="submit"] {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .mscf-popup-container .mscf-subscriptions {
        padding: 12px;
    }
    
    .mscf-popup-container .mscf-subscriptions h4 {
        font-size: 13px;
    }
    
    .mscf-popup-container .mscf-subscriptions label {
        font-size: 13px !important;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .mscf-popup-container {
        max-height: 85vh;
        overflow-y: auto;
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .mscf-popup-container {
        max-width: 550px;
        /* Removed hardcoded padding - form builder will control it */
    }
}* Scrollbar Styling for Popup */
.mscf-popup-container::-webkit-scrollbar {
    width: 8px;
}

.mscf-popup-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.mscf-popup-container::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.6);
    border-radius: 10px;
}

.mscf-popup-container::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.8);
}


/* Checkboxes and radio buttons */
.mscf-popup-container input[type="checkbox"],
.mscf-popup-container input[type="radio"],
.mscf-subscriptions input[type="checkbox"],
.mscf-subscriptions input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
    pointer-events: auto !important;
    position: relative;
    z-index: 1;
}

.mscf-popup-container label,
.mscf-subscriptions label {
    cursor: pointer !important;
    user-select: none;
}

.mscf-subscriptions {
    margin: 24px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.mscf-subscriptions h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
}

/* Animation for entrance */
@keyframes mscfPopupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(40px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Prevent body scroll when popup is open */
body.mscf-popup-open {
    overflow: hidden;
}

