/* Reusable file preview modal (GDE)
   Light, compact viewer matching the "View Template" design.
   Loaded once from the main site + dashboard layouts. */

#gdeFilePreviewModal .gde-fp-dialog {
    max-width: 1100px;
    width: calc(100% - 32px);
    margin: 1.75rem auto;
}

#gdeFilePreviewModal .modal-content.gde-fp-content {
    background: #ffffff;
    color: #1f2937;
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}

#gdeFilePreviewModal .gde-fp-header {
    position: relative;
    display: block;
    padding: 16px 52px;
    text-align: center;
    background: #ffffff;
    border-bottom: 1px solid #eef0f3;
}

#gdeFilePreviewModal .gde-fp-header .modal-title {
    display: block;
    width: 100%;
    margin: 0;
    color: #111827;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}

#gdeFilePreviewModal .gde-fp-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#gdeFilePreviewModal .gde-fp-close {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    padding: .35rem;
    opacity: .8;
}

#gdeFilePreviewModal .gde-fp-body {
    background: #f4f5f7;
    padding: 16px;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gdeFilePreviewModal .gde-fp-stage {
    width: 100%;
    max-height: 68vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

#gdeFilePreviewModal .gde-fp-stage img {
    display: block;
    max-width: 100%;
    max-height: 64vh;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .08);
}

#gdeFilePreviewModal .gde-fp-stage iframe {
    width: 100%;
    min-height: 62vh;
    border: 0;
    background: #ffffff;
}

#gdeFilePreviewModal .gde-fp-stage video {
    display: block;
    max-width: 100%;
    max-height: 64vh;
}

#gdeFilePreviewModal .gde-fp-stage audio {
    width: 100%;
}

#gdeFilePreviewModal .gde-fp-text {
    width: 100%;
    max-height: 64vh;
    margin: 0;
    padding: 16px;
    overflow: auto;
    color: #1f2937;
    background: #ffffff;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

#gdeFilePreviewModal .gde-fp-message {
    width: 100%;
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: #6b7280;
    background: #ffffff;
    border-radius: 4px;
}

#gdeFilePreviewModal .gde-fp-message h5 {
    color: #111827;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: .5rem;
}

#gdeFilePreviewModal .gde-fp-message p {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 1rem;
}

#gdeFilePreviewModal .gde-fp-message .btn {
    background: var(--primary-color, #7ed957);
    border-color: transparent;
    color: #0b1120;
    font-size: 13px;
    font-weight: 600;
}

#gdeFilePreviewModal .gde-fp-message .btn:hover {
    filter: brightness(.96);
    color: #0b1120;
}

#gdeFilePreviewModal .gde-fp-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(17, 24, 39, .12);
    border-top-color: var(--primary-color, #7ed957);
    border-radius: 50%;
    animation: gdeFpSpin .8s linear infinite;
}

@keyframes gdeFpSpin {
    to { transform: rotate(360deg); }
}

#gdeFilePreviewModal .gde-fp-docx {
    width: 100%;
    max-height: 64vh;
    overflow: auto;
    background: #f4f5f7;
}

#gdeFilePreviewModal .gde-fp-docx .docx-wrapper {
    background: transparent;
    padding: 0;
}

#gdeFilePreviewModal .gde-fp-docx .docx-wrapper > section.docx,
#gdeFilePreviewModal .gde-fp-docx .gde-fp-docx-page-wrapper > section.gde-fp-docx-page {
    margin: 0 auto .75rem;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .1);
}

#gdeFilePreviewModal .gde-fp-footer {
    display: block;
    padding: 0;
    border-top: 0;
    background: #ffffff;
}

#gdeFilePreviewModal .gde-fp-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    border: 0;
    border-radius: 0;
    background: var(--primary-color, #7ed957);
    color: #0b1120;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

#gdeFilePreviewModal .gde-fp-download:hover,
#gdeFilePreviewModal .gde-fp-download:focus {
    background: var(--primary-color, #7ed957);
    filter: brightness(.96);
    color: #0b1120;
}

#gdeFilePreviewModal .gde-fp-download svg {
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    #gdeFilePreviewModal .gde-fp-dialog {
        max-width: none;
        margin: .5rem;
    }

    #gdeFilePreviewModal .gde-fp-header {
        padding: 14px 44px;
    }

    #gdeFilePreviewModal .gde-fp-header .modal-title {
        font-size: 14px;
    }

    #gdeFilePreviewModal .gde-fp-body {
        padding: 12px;
    }

    #gdeFilePreviewModal .gde-fp-stage,
    #gdeFilePreviewModal .gde-fp-text,
    #gdeFilePreviewModal .gde-fp-docx {
        max-height: 60vh;
    }

    #gdeFilePreviewModal .gde-fp-stage iframe {
        min-height: 55vh;
    }

    #gdeFilePreviewModal .gde-fp-stage img,
    #gdeFilePreviewModal .gde-fp-stage video {
        max-height: 58vh;
    }
}
