/* static/css/preview.css - 预览面板相关样式 */

/* 预览控制区域 */
.preview-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preview-controls .btn {
    margin: 0;
}

/* 预览内容区域 */
.preview-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.placeholder-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.6;
}

.preview-placeholder h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.preview-placeholder p {
    line-height: 1.6;
    margin-bottom: 30px;
}

.placeholder-features {
    margin-top: 30px;
    display: grid;
    gap: 15px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.feature-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: #f0f8ff;
    border-radius: var(--border-radius);
    border: 1px solid #e3f2fd;
    transition: var(--transition);
}

.feature-item:hover {
    background: #e3f2fd;
    transform: translateY(-1px);
}

.feature-icon {
    font-size: 1.2em;
    opacity: 0.8;
}

/* 律师函内容样式 */
.preview-area .lawyer-letter {
    font-family: 'Times New Roman', 'SimSun', serif;
    line-height: 1.8;
    color: #333;
    font-size: 14px;
}

.preview-area .lawyer-letter h1 {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #000;
    letter-spacing: 2px;
}

.preview-area .lawyer-letter h2 {
    font-size: 18px;
    font-weight: bold;
    margin: 20px 0 10px 0;
    color: #000;
}

.preview-area .lawyer-letter h3 {
    font-size: 16px;
    font-weight: bold;
    margin: 15px 0 8px 0;
    color: #000;
}

.preview-area .lawyer-letter p {
    text-indent: 2em;
    margin-bottom: 12px;
    text-align: justify;
}

.preview-area .lawyer-letter .no-indent {
    text-indent: 0;
}

.preview-area .lawyer-letter .right-align {
    text-align: right;
    text-indent: 0;
    margin-top: 40px;
}

.preview-area .lawyer-letter .legal-article {
    font-weight: bold;
    color: #000;
    background: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
}

.preview-area .lawyer-letter .warning {
    background: #f9f9f9;
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin: 20px 0;
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.preview-area .lawyer-letter .signature-section {
    margin-top: 40px;
    text-align: right;
}

.preview-area .lawyer-letter .date-section {
    margin-bottom: 30px;
    text-align: right;
}

.preview-area .lawyer-letter .contact-info {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.preview-area .lawyer-letter ol,
.preview-area .lawyer-letter ul {
    margin: 15px 0;
    padding-left: 2em;
}

.preview-area .lawyer-letter li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.preview-area .lawyer-letter .evidence-list {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 15px 0;
}

.preview-area .lawyer-letter .evidence-list h4 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 14px;
}

/* 加载状态样式 */
.loading {
    text-align: center;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin: 20px 0;
}

.loading .spinner {
    margin: 0 auto 20px;
}

.loading h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.loading p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* 进度信息区域 */
.progress-info {
    background: #e8f4f8;
    border: 1px solid #bee5eb;
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 15px 0;
    font-size: 14px;
    color: #0c5460;
}

.cancel-area {
    text-align: center;
    margin-top: 20px;
}

/* 简单加载容器样式 */
.simple-loading-container {
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #e9ecef 100%);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
    margin: 20px 0;
}

.loading-header {
    margin-bottom: 30px;
}

.loading-header h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin-bottom: 15px;
    font-weight: 600;
}

.loading-header p {
    color: var(--text-secondary);
    font-size: 1em;
    margin: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.loading-header p::before {
    content: '💭';
    position: absolute;
    left: -30px;
    opacity: 0.6;
}

/* 进度条样式 */
.progress-container {
    margin: 25px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar-simple {
    flex: 1;
    height: 12px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.progress-fill-simple {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--success-color) 50%, var(--warning-color) 100%);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill-simple::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShimmer 1.5s infinite;
}

.progress-fill-simple[style*="100%"] {
    background: linear-gradient(90deg, var(--success-color) 0%, #2ecc71 100%);
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.3);
}

.progress-fill-simple[style*="100%"]::before {
    animation: none;
}

.progress-text {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 1.1em;
    min-width: 45px;
    text-align: center;
}

/* 加载底部 */
.loading-footer {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.loading-footer .btn {
    min-width: 120px;
    font-size: 0.9em;
}

/* 脉冲动画效果 */
.simple-loading-container {
    animation: loadingPulse 3s infinite;
}

/* AI处理提示样式 */
.ai-processing-hint {
    margin-top: 10px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
    font-size: 14px;
}

.ai-processing-hint p {
    margin: 0 0 8px 0;
}

.ai-processing-hint p:last-child {
    margin-bottom: 0;
}

.processing-dots {
    text-align: center;
    margin-top: 10px;
}

.processing-dots span {
    display: inline-block;
    margin: 0 2px;
    font-size: 16px;
}

/* 消息区域样式 */
#messageArea {
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

#messageArea:empty {
    display: none;
}

/* 预览内容打印样式 */
.preview-area.print-mode {
    background: white;
    border: none;
    box-shadow: none;
    padding: 40px;
    font-size: 14px;
}

.preview-area.print-mode .lawyer-letter {
    color: #000;
}

/* 复制功能反馈 */
.copy-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.copy-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

/* 下载状态指示 */
.download-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--info-color);
    color: white;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-size: 13px;
    margin-left: 10px;
}

.download-status .spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    border-color: white;
    border-top-color: transparent;
    margin: 0;
}

/* 预览工具栏 */
.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.preview-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-toolbar .btn {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.zoom-level {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

/* 全屏预览模式 */
.preview-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.preview-fullscreen .preview-area {
    flex: 1;
    margin: 0;
    border-radius: 0;
    border: none;
}

.preview-fullscreen .preview-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    margin: 0;
}

.fullscreen-exit {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 12px;
}

.fullscreen-exit:hover {
    background: #7f8c8d;
}

/* 预览内容缩放 */
.preview-area.zoom-small {
    font-size: 12px;
}

.preview-area.zoom-normal {
    font-size: 14px;
}

.preview-area.zoom-large {
    font-size: 16px;
}

.preview-area.zoom-extra-large {
    font-size: 18px;
}

/* 水印效果 */
.preview-area::before {
    content: '预览版本';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 60px;
    color: rgba(0, 0, 0, 0.03);
    pointer-events: none;
    z-index: 1;
    font-weight: bold;
}

/* 预览加载状态 */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-secondary);
}

.preview-loading .spinner {
    margin-bottom: 20px;
}

.preview-loading h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.preview-loading p {
    text-align: center;
    line-height: 1.5;
    max-width: 300px;
}

/* 图片预览样式 */
.image-preview-container {
    padding: 20px;
    text-align: center;
}

.preview-notice {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    text-align: left;
}

.notice-icon {
    font-size: 24px;
    margin-right: 15px;
}

.notice-content h4 {
    margin: 0 0 8px 0;
    color: #495057;
}

.notice-content p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.image-preview-wrapper {
    margin: 20px 0;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-image {
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.preview-image:hover {
    transform: scale(1.05);
}

/* HTML预览保护样式 */
.html-preview-container {
    position: relative;
    padding: 20px;
}

.protected-content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.content-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 48px;
    color: rgba(0, 0, 0, 0.05);
    pointer-events: none;
    z-index: 1000;
    font-weight: bold;
    white-space: nowrap;
}

.html-preview-content {
    position: relative;
    z-index: 1;
}

/* 图片保护样式 */
.protected-image-container {
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.protected-image {
    pointer-events: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 在图片上方添加透明遮罩防止右键 */
.protected-image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10;
    cursor: default;
}

/* 防止通过CSS选择器获取图片 */
.protected-image-container img {
    position: relative;
    z-index: 1;
}

/* 打印时隐藏 */
@media print {
    .protected-image-container {
        display: none !important;
    }
}