/**
 * Modal Styles
 * 
 * Modern popup modal styling with responsive design
 */

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.modal-active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* Modal container */
.modal-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    height: auto;
    max-height: 95vh;
    overflow: visible;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.modal-active .modal-container {
    transform: scale(1) translateY(0);
}

/* Modal header */
.modal-header {
    position: relative;
    padding: 20px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--global-color-8);
    border-radius: 16px 16px 0 0;
    margin: -1px -1px 0 -1px;
}

/* Modal title */
.modal-title {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    flex-grow: 1;
}

/* Close button */
.modal-close {
    background: rgba(255, 255, 255, 0.2)!important;
    border: 2px solid rgba(255, 255, 255, 0.3)!important;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.modal-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.modal-close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Modal content */
.modal-content {
    position: relative;
    padding: 0 20px 20px;
}



/* Modal body */
.modal-body {
    padding: 20px;
}

.modal-body > *:first-child {
    margin-top: 0;
}

.modal-body > *:last-child {
    margin-bottom: 0;
}





/* Body scroll prevention */
body.modal-open {
    overflow: hidden;
}

/* Responsive design */
@media (max-width: 767px) {
    .modal-overlay {
        padding: 15px;
    }
    
    .modal-container {
        max-height: 98vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px 15px 15px;
        border-radius: 12px 12px 0 0;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    .modal-content {
        padding: 0;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
    }
    
    .modal-close svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-container {
        max-height: 99vh;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 12px 12px 12px;
        border-radius: 8px 8px 0 0;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-content {
        padding: 0;
    }
    
    .modal-body {
        padding: 12px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal-overlay {
        background-color: rgba(0, 0, 0, 0.8);
    }
    
    .modal-container {
        border: 2px solid #000;
    }
    
    .modal-close {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-container,
    .modal-close {
        transition: none;
    }
}

/* Screen reader only class */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus visible support for better accessibility */
.modal-close:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .modal-overlay {
        display: none !important;
    }
}

/* PDF Modal Specific Styles */
.pdf-modal-overlay {
    z-index: 999998; /* Slightly lower than main modal */
}

.pdf-modal-container {
    max-width: 65vw; /* 65% screen width as requested */
    max-height: 90vh;
    width: 65vw;
    height: auto; /* Auto height to match content */
    position: relative; /* For absolute positioning of close button */
    background: transparent; /* No background color */
    box-shadow: none; /* Remove box shadow */
    border-radius: 0; /* Remove border radius */
}

.pdf-modal-body {
    padding: 0; /* No padding */
    height: auto; /* Auto height to match shortcode output */
    overflow: visible; /* Allow content to show naturally */
}

/* Position close button in top-right corner */
.pdf-modal-container .pdf-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-modal-container .pdf-modal-close:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.1);
}

/* Ensure shortcode content displays naturally */
.pdf-modal-body > * {
    width: 100% !important;
    max-width: none !important;
}

/* Mobile optimizations for PDF modal */
@media (max-width: 768px) {
    .pdf-modal-container {
        max-width: 95vw; /* Larger on mobile as requested */
        max-height: 95vh;
        width: 95vw;
        height: auto;
    }
    
    .pdf-modal-body {
        height: auto;
    }
    
    .pdf-modal-overlay {
        padding: 10px;
    }
    
    /* Adjust close button position for mobile */
    .pdf-modal-container .pdf-modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
}
