#custom-fs-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.custom-fs-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border-radius: 8px;
    animation: customModalFadeIn 0.3s ease-out;
}

#custom-fs-modal-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.custom-fs-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    color: #fff;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    background: #e63946;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s, background 0.2s;
    line-height: 1;
}

.custom-fs-modal-close:hover {
    background: #d62828;
    transform: scale(1.1);
}

#custom-fs-modal-html {
    display: none;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    color: #333;
    font-family: inherit;
    line-height: 1.6;
}

#custom-fs-modal-html img {
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Override FinalSite classes that may hide or misposition elements inside modal */
#custom-fs-modal-html article,
#custom-fs-modal-html .fsThumbnail,
#custom-fs-modal-html .fsPostLink,
#custom-fs-modal-html .fsThumbnailAlignLeft {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    float: none !important;
    width: auto !important;
    max-width: 300px;
    margin-bottom: 16px;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

#custom-fs-modal-html .fsTitle {
    display: block !important;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 12px;
}

#custom-fs-modal-html .fsBody {
    display: block !important;
}

@keyframes customModalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
