/* Modal Trigger Button */
.elementor-modal-widget .modal-trigger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    transition: all 0.3s ease;
    text-decoration: none;
}

.elementor-modal-widget .modal-trigger-button:focus {
    outline: 2px solid rgba(0, 115, 170, 0.5);
    outline-offset: 2px;
}

.elementor-modal-widget .modal-trigger-button .button-text {
    display: inline-block;
}

.elementor-modal-widget .modal-trigger-button .icon-left,
.elementor-modal-widget .modal-trigger-button .icon-right {
    display: inline-flex;
    align-items: center;
}

/* Modal Overlay - Works even when moved to body */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    visibility: hidden;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-overlay.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Hide and disable videos when modal is closed */
.modal-overlay:not(.active) video {
    display: none !important;
    visibility: hidden !important;
}

/* Modal Content Wrapper */
.modal-content-wrapper {
    position: relative;
    width: 90vw;
    min-width: 80vw;
    max-width: 1600px;
    max-height: 95vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-sizing: border-box;
    margin: auto;
    flex-shrink: 0;
    background: transparent !important;
    border: none !important;
}

.modal-overlay.active .modal-content-wrapper {
    transform: scale(1);
}

/* Custom Scrollbar for Modal Content */
.modal-content-wrapper::-webkit-scrollbar {
    width: 8px;
}

.modal-content-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Modal Close Button */
.modal-close-button {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 1000000 !important;
    transition: all 0.3s ease;
    color: #ffffff;
    backdrop-filter: blur(10px);
}

/* Show close button when modal is active */
.modal-overlay.active .modal-close-button {
    display: flex !important;
}

.modal-close-button:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: rotate(90deg);
}

.modal-close-button:focus {
    outline: 2px solid rgba(0, 115, 170, 0.5);
    outline-offset: 2px;
}

.modal-close-button svg {
    width: 20px;
    height: 20px;
}

/* Modal Body */
.modal-body {
    position: relative;
    background: transparent !important;
    padding: 0 !important;
}

/* Remove default Elementor section margins and padding */
.modal-body .elementor-section {
    margin: 0 !important;
}

.modal-body .elementor-container {
    padding: 0 !important;
}

/* Force show Elementor hidden elements inside modal */
.modal-body .elementor-hidden-mobile,
.modal-body .elementor-hidden-tablet,
.modal-body .elementor-hidden-desktop {
    display: block !important;
}

.modal-body .elementor-section.elementor-hidden-mobile,
.modal-body .elementor-section.elementor-hidden-tablet,
.modal-body .elementor-section.elementor-hidden-desktop {
    display: flex !important;
}

/* Modal Title */
.elementor-modal-widget .modal-title {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
}

/* Modal Content */
.elementor-modal-widget .modal-content {
    line-height: 1.6;
}

.elementor-modal-widget .modal-content p:last-child {
    margin-bottom: 0;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Animation classes */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
    }
    to {
        transform: scale(1) translateY(0);
    }
}

.modal-overlay.active {
    animation: modalFadeIn 0.3s ease;
}

.modal-overlay.active .modal-content-wrapper {
    animation: modalSlideIn 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important;
    }

    .modal-overlay.active {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .modal-content-wrapper {
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .modal-close-button {
        top: 15px !important;
        right: 15px !important;
        left: auto !important;
        width: 36px;
        height: 36px;
        z-index: 1000001 !important;
    }

    .modal-close-button svg {
        width: 18px;
        height: 18px;
    }
}

/* Accessibility improvements */
.modal-overlay:focus {
    outline: none;
}

/* Support for RTL languages */
[dir="rtl"] .modal-close-button {
    right: auto !important;
    left: 20px !important;
}

@media (max-width: 768px) {
    [dir="rtl"] .modal-close-button {
        left: 15px !important;
    }
}
