/* 大模型论文跟踪系统 - 公共样式 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
    margin: 0;
    padding: 0;
}

/* 加载动画和指示器 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
    gap: 12px;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e8e8e8;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.loading-text {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

.loading-progress {
    width: 180px;
    height: 3px;
    background: #e8e8e8;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.loading-progress-bar {
    height: 100%;
    background: #1a1a1a;
    width: 0%;
    transition: width 0.3s ease;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* 错误提示 */
.iframe-error {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fafafa;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 40px;
    text-align: center;
}

.iframe-error.show {
    display: flex;
}

.iframe-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.iframe-error-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.iframe-error-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.iframe-error-retry {
    padding: 8px 16px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.iframe-error-retry:hover {
    background: #333;
}

/* 预览模态框 */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
    margin: 0;
    padding: 0;
}

.preview-modal.active {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.preview-content {
    background: white;
    border-radius: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    animation: slideUp 0.3s;
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.preview-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
    min-height: 48px;
}

.preview-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.preview-btn {
    padding: 6px 12px;
    border: 1px solid #e8e8e8;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.preview-btn:hover {
    background: #fafafa;
    border-color: #1a1a1a;
}

.preview-btn.primary {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

.preview-btn.primary:hover {
    background: #333;
}

.preview-close {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.preview-close:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.preview-iframe-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .preview-modal {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        position: fixed !important;
    }

    .preview-modal.active {
        display: flex;
        align-items: stretch;
        justify-content: stretch;
    }

    .preview-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
        margin: 0;
        padding: 0;
        position: relative;
    }

    .preview-header {
        padding: 12px 14px;
        min-height: 44px;
        flex-wrap: nowrap;
    }

    .preview-header h2 {
        font-size: 15px;
        font-weight: 600;
        margin: 0;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .preview-actions {
        gap: 6px;
        flex-shrink: 0;
    }

    .preview-btn {
        padding: 6px 12px;
        font-size: 13px;
        white-space: nowrap;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .preview-close {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 24px;
    }

    .loading-overlay {
        padding: 10px 12px;
        gap: 8px;
    }

    .loading-spinner {
        width: 18px;
        height: 18px;
    }

    .loading-text {
        font-size: 12px;
    }

    .loading-progress {
        width: 120px;
    }
}

