@layer business {
/* ===== File Preview Modal ===== */

.fp-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.fp-overlay.fp-visible {
    background: rgba(0, 0, 0, 0.52);
}

.fp-modal {
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    width: min(860px, 92vw);
    height: min(88vh, 900px);
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}
.fp-overlay.fp-visible .fp-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Header */
.fp-header {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 12px;
}
.fp-filename {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
}
.fp-filename i {
    color: var(--color-primary);
    flex-shrink: 0;
    font-size: 1rem;
}
.fp-filename span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 进度条 */
.fp-progress-bar {
    height: 3px;
    background: rgba(43, 94, 167, 0.1);
    flex-shrink: 0;
    display: none;
    overflow: hidden;
}
.fp-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

/* 内容区 */
.fp-body {
    flex: 1;
    overflow: auto;
    position: relative;
    background: var(--bg-void);
    border-radius: 0 0 12px 12px;
}
.fp-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.fp-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    padding: 24px;
}
.fp-text {
    padding: 20px 24px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-main);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
}
.fp-markdown {
    padding: 20px 28px;
    font-size: 0.88rem;
    line-height: 1.75;
    color: var(--text-main);
}
.fp-docx {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: var(--bg-card);
}
.fp-docx-content {
    margin: 0 auto;
}

/* 加载占位 */
.fp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.fp-loading i {
    font-size: 2rem;
    animation: fp-spin 1s linear infinite;
}
@keyframes fp-spin { to { transform: rotate(360deg); } }

/* 不可预览提示 */
.fp-no-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 14px;
    color: var(--text-muted);
}
.fp-no-preview > i {
    font-size: 3rem;
    opacity: 0.35;
}
.fp-no-preview p {
    font-size: 0.88rem;
}
/* 下载浮层 */
.fp-download-bar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease;
    pointer-events: auto;
    z-index: 1;
    white-space: nowrap;
}
.fp-download-bar.fp-hidden {
    opacity: 0;
    pointer-events: none;
}
.fp-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 26px;
    background: rgba(43, 94, 167, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border-radius: 20px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 14px rgba(43, 94, 167, 0.32);
    transition: background 0.15s;
}
.fp-download-btn:hover { background: rgba(43, 94, 167, 0.95); }
.fp-download-btn i { font-size: 1rem; }
.fp-newwin-btn { padding: 9px 14px; margin-left: 6px; }
.fp-newwin-btn i { font-size: 1.05rem; }

/* 移动端 */
@media (max-width: 768px) {
    .fp-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .fp-modal {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        transform: translateY(40px) scale(1);
    }
    .fp-overlay.fp-visible .fp-modal {
        transform: translateY(0) scale(1);
    }
    .fp-download-bar {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
    .fp-markdown { padding: 14px 16px; }
    .fp-text { padding: 14px 16px; }
}

}