/* Modal Overlay */
#pmc-preview-modal {
    will-change: opacity;
    display: none; 
    position: fixed;
    inset: 0;
    z-index: 2147483647 !important; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* Safari support */
}

body.pmc-modal-open header,
body.pmc-modal-open .ct-header,
body.pmc-modal-open .ct-sticky-container {
    z-index: 0 !important;
}

body.pmc-modal-open {
    overflow: hidden !important;
    height: 100%;
}

/* Modal Box */
.pmc-modal-content {
    background: #fff;
    padding: 30px 40px; 
    width: 95%;
    max-width: 750px;
    position: relative;
    border-radius: 5px;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

/* Header & Close Button Alignment */
.pmc-modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 1.6rem; 
    font-weight: 700;
    padding: 0 40px;
}

.pmc-close-modal {
    position: absolute;
    right: 20px; 
    top: 25px;   
    font-size: 34px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    transition: color 0.2s;
}

.pmc-close-modal:hover { color: #333; }

/* Link Trigger */
.pmc-text-link-container {
    width: 100%;
    margin: 0 0 20px 0 !important;
    display: none; 
    justify-content: flex-start;
}

.pmc-open-preview-link {
    font-family: var(--theme-button-font-family, var(--theme-font-family));
    font-size: var(--theme-button-font-size);
    font-style: var(--theme-button-font-style);
    line-height: var(--theme-button-line-height);
    letter-spacing: var(--theme-button-letter-spacing);
    text-transform: var(--theme-button-text-transform);
    padding: var(--theme-button-padding);
    border-radius: var(--theme-button-border-radius, 3px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--theme-button-min-height, 50px);
    background-color: #237286 !important;
    color: #ffffff !important;
    font-weight: 500 !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color 0.2s ease;
    appearance: none;
    user-select: none;
}

.pmc-open-preview-link:hover {
    background-color: #388092 !important;
}

.pmc-open-preview-link:active {
    background-color: #EEF1EA !important;
}

/* Image/Loading Area */
.pmc-preview-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; 
    background: #f9f9f9;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#pmc-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 5px;
}

#pmc-preview-img.loaded { 
    display: block;
    opacity: 1; 
}

.pmc-loading-spinner {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #666;
}

.pmc-loading .pmc-loading-spinner {
    display: flex;
}

/* The Animated Spinner */
.pmc-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: pmc-spin 0.8s linear infinite;
}

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

.pmc-modal-atc-btn.button.alt {
    width: 100% !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    min-height: 55px;
    margin-top: 25px;
    font-size: 18px !important;
    background-color: #000 !important;
    color: #fff;
    border-radius: 5px !important;
}

.pmc-modal-atc-btn.button.alt:hover {
    background-color: #444 !important;
}

.pmc-disclaimer {
    font-size: 11px;
    color: #777;
    margin: 15px 0 0 0;
    line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .pmc-modal-content { padding: 25px 15px; }
    .pmc-modal-content h3 { font-size: 1.1rem; padding: 0 25px; }
    .pmc-close-modal { font-size: 28px; right: 20px; top: 20px; }
    .pmc-modal-atc-btn.button.alt { min-height: 50px; font-size: 16px !important; }
}