/* ===== 精灵图切割工具样式文件 ===== */
/* 更新时间: 2025-07-30 - 添加作者信息和开源地址 */

/* 图块预览模态框样式 */
#tilePreviewModal {
    animation: modalFadeIn 0.3s ease-out;
}

#tilePreviewModal img {
    transition: transform 0.3s ease;
}

#tilePreviewModal img:hover {
    transform: scale(1.05);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

/* 全局样式 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0;
    padding: 0;
    color: #333;
    min-height: 100vh;
    position: relative; /* 建立堆叠上下文 */
}

/* 容器布局 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 头部样式 */
header {
    position: relative;
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

/* 语言切换器样式 */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.language-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    color: #333;
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.language-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.lang-zh, .lang-en {
    padding: 2px 6px;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 500;
}

.lang-separator {
    color: #999;
    font-weight: 300;
    margin: 0 4px;
}

/* 默认状态 - 中文激活 */
.language-toggle-btn[data-lang="zh-CN"] .lang-zh {
    background: #3b82f6;
    color: white;
    font-weight: 600;
}

.language-toggle-btn[data-lang="zh-CN"] .lang-en {
    color: #666;
    opacity: 0.7;
}

/* 英文激活状态 */
.language-toggle-btn[data-lang="en-US"] .lang-en {
    background: #3b82f6;
    color: white;
    font-weight: 600;
}

.language-toggle-btn[data-lang="en-US"] .lang-zh {
    color: #666;
    opacity: 0.7;
}

/* 悬停效果 */
.language-toggle-btn:hover .lang-zh,
.language-toggle-btn:hover .lang-en {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .language-switcher {
        top: 15px;
        right: 15px;
    }
    
    .language-toggle-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .lang-zh, .lang-en {
        padding: 1px 4px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .language-switcher {
        top: 15px;
        right: 15px;
    }
    
    .language-toggle-btn {
        padding: 8px 14px;
        font-size: 0.85em;
        min-width: 85px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .language-switcher {
        top: 15px;
        right: 15px;
    }
    
    .language-switcher select {
        min-width: 100px;
        padding: 8px 12px;
        font-size: 0.85em;
    }
}

/* 头部样式 */
header h1 {
    color: #2c3e50;
    font-size: 2.8em;
    margin-bottom: 10px;
    font-weight: 600;
    background: linear-gradient(45deg, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: #7f8c8d;
    font-size: 1.2em;
    margin: 0;
}

/* 主内容区域 - 左右分栏布局 */
.main-content {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* 左侧控制面板 */
.control-panel {
    flex: 0 0 420px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 右侧预览面板 */
.preview-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: fit-content; /* 根据内容自适应高度 */
}

/* 响应式设计 - 在小屏幕上恢复垂直布局 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .control-panel {
        flex: none;
    }
}

/* 卡片样式 */
.upload-section, 
.settings-section, 
.preview-section, 
.advanced-section {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.upload-section:hover,
.settings-section:hover,
.advanced-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.upload-section h2,
.settings-section h2,
.preview-section h2,
.advanced-section h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
}

/* 标签页样式 */
.settings-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: #4299e1;
    background: rgba(66, 153, 225, 0.05);
}

.tab-button.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
    background: rgba(66, 153, 225, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 标签页内的操作按钮 */
.tab-content .action-buttons {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* 预览区域底部的操作按钮 */
.preview-actions {
    margin-top: 16px;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.preview-actions .btn {
    margin: 0 6px;
    min-width: 100px; /* 确保按钮有合适的最小宽度 */
}

/* 文件上传区域 */
.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border: 2px dashed #cbd5e0;
    padding: 32px;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: linear-gradient(145deg, #f7fafc, #edf2f7);
    cursor: pointer;
}

.file-upload:hover {
    border-color: #4299e1;
    background: linear-gradient(145deg, #ebf8ff, #bee3f8);
}

.file-upload.drag-over {
    border-color: #38a169;
    background: linear-gradient(145deg, #f0fff4, #c6f6d5);
    transform: scale(1.02);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload label {
    background: linear-gradient(145deg, #4299e1, #3182ce);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    border: none;
    font-size: 1em;
}

.file-upload label:hover {
    background: linear-gradient(145deg, #3182ce, #2c5282);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

#fileNameDisplay {
    color: #718096;
    font-size: 1em;
    text-align: center;
}

/* 设置网格 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95em;
}

.setting-group input[type="number"] {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #fff;
}

.setting-group input[type="number"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 高级选项 */
.advanced-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-group:hover {
    background: #edf2f7;
}

.checkbox-group input[type="checkbox"] {
    transform: scale(1.2);
    accent-color: #4299e1;
}

.checkbox-group label {
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
}

/* 单选按钮组 */
.radio-group {
    background: #f7fafc;
    padding: 16px;
    border-radius: 8px;
}

.radio-group h3 {
    margin: 0 0 16px 0;
    font-size: 1.1em;
    color: #2d3748;
    font-weight: 600;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.radio-option:hover {
    background: #edf2f7;
}

.radio-option input[type="radio"] {
    transform: scale(1.2);
    accent-color: #4299e1;
}

.radio-option label {
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
    flex: 1;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 24px 0;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn.primary {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn.primary:hover {
    background: linear-gradient(145deg, #38a169, #2f855a);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(72, 187, 120, 0.4);
}

.btn.secondary {
    background: linear-gradient(145deg, #4299e1, #3182ce);
    color: white;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn.secondary:hover {
    background: linear-gradient(145deg, #3182ce, #2c5282);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 153, 225, 0.4);
}

/* 预览区域 */
.preview-container {
    position: relative;
    min-height: 500px;
    background: linear-gradient(145deg, #f7fafc, #edf2f7);
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    overflow: auto;
    margin-bottom: 0; /* 移除底部边距，让按钮更靠近 */
}

/* 预览模式切换 */
.preview-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
}

.preview-mode-toggle {
    display: flex;
    gap: 20px;
}

.preview-mode-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
}

.preview-mode-toggle input[type="radio"] {
    transform: scale(1.2);
    accent-color: #4299e1;
}

/* 重置按钮容器 */
.reset-button-container {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

.reset-btn {
    background: linear-gradient(145deg, #ed8936, #dd6b20);
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: linear-gradient(145deg, #dd6b20, #c05621);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3);
}

.restore-btn {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.restore-btn:hover {
    background: linear-gradient(145deg, #38a169, #2f855a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* 预览序号控制样式 */
.preview-number-controls {
    margin-bottom: 16px;
}

.preview-number-control {
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 6px;
    border-left: 3px solid #4299e1;
    margin-bottom: 8px;
}

.preview-number-control:last-child {
    margin-bottom: 0;
}

.preview-number-control label {
    font-weight: 500;
    color: #2d3748;
    font-size: 0.9em;
}

.preview-number-control small {
    font-size: 0.8em;
    color: #718096;
    display: block;
    margin-top: 2px;
}

/* 可拖拽网格样式 */
.draggable-grid {
    display: none; /* 默认隐藏 */
    gap: 8px;
    background: #e2e8f0;
    padding: 0;
    border-radius: 8px;
    /* 使用绝对定位确保完美居中 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Grid内部对齐 */
    justify-items: center;
    align-items: center;
    box-sizing: border-box;
    overflow: visible;
    z-index: 5;
}

.draggable-grid.active {
    display: grid !important; /* 使用!important确保优先级 */
}

.grid-tile {
    position: relative;
    background-size: contain; /* 改为contain确保完整显示内容 */
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid #fff;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 自适应大小，保持宽高比 */
    width: 100%;
    height: 100%;
    min-width: 20px;
    min-height: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

/* 添加双击预览的视觉提示 */
.grid-tile::after {
    content: '👁';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-tile:hover::after {
    opacity: 0.8;
}

/* 兼容不支持aspect-ratio的浏览器 */
.grid-tile::before {
    content: '';
    display: block;
    padding-bottom: 100%; /* 1:1 宽高比 */
    width: 0;
}

.grid-tile:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.grid-tile.dragging {
    cursor: grabbing;
    transform: rotate(5deg) scale(1.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0.8;
}

.grid-tile.drop-target {
    border-color: #4299e1;
    background-color: rgba(66, 153, 225, 0.1);
}

.grid-tile-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: clamp(10px, 2vw, 16px); /* 响应式字体大小 */
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 10;
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 拖拽插入指示器样式 */
.grid-tile.insert-left {
    border-left: 4px solid #4299e1;
    background: linear-gradient(90deg, rgba(66, 153, 225, 0.2) 0%, transparent 20%);
}

.grid-tile.insert-right {
    border-right: 4px solid #4299e1;
    background: linear-gradient(270deg, rgba(66, 153, 225, 0.2) 0%, transparent 20%);
}

.grid-tile.insert-top {
    border-top: 4px solid #4299e1;
    background: linear-gradient(180deg, rgba(66, 153, 225, 0.2) 0%, transparent 20%);
}

.grid-tile.insert-bottom {
    border-bottom: 4px solid #4299e1;
    background: linear-gradient(0deg, rgba(66, 153, 225, 0.2) 0%, transparent 20%);
}

.grid-tile.swap-target {
    border: 3px solid #f56565;
    background-color: rgba(245, 101, 101, 0.1);
}

/* 拖拽插入指示器动画 */
.grid-tile.insert-left,
.grid-tile.insert-right,
.grid-tile.insert-top,
.grid-tile.insert-bottom,
.grid-tile.swap-target {
    transition: all 0.2s ease;
}

.grid-tile-original-number {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(255, 255, 255, 0.95);
    color: #718096;
    font-size: clamp(6px, 1vw, 10px); /* 响应式字体大小 */
    padding: 1px 3px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 10;
}

/* 删除按钮样式 */
.grid-tile-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 15;
    line-height: 1;
    padding: 0;
}

.grid-tile:hover .grid-tile-delete-btn {
    opacity: 1;
}

.grid-tile-delete-btn:hover {
    background: rgba(185, 28, 28, 1);
    transform: scale(1.1);
}

/* 已删除图块样式 */
.grid-tile.deleted {
    opacity: 0.3;
    filter: grayscale(100%);
    position: relative;
}

.grid-tile.deleted::before {
    content: '已删除';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 38, 38, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 20;
    pointer-events: none;
}

.grid-tile.deleted .grid-tile-delete-btn {
    background: rgba(34, 197, 94, 0.9);
    opacity: 1;
}

.grid-tile.deleted .grid-tile-delete-btn:hover {
    background: rgba(22, 163, 74, 1);
}

.grid-tile.deleted .grid-tile-delete-btn {
    content: '↻';
}

/* 拖拽排序控制样式 */
.drag-sort-controls {
    background: #f7fafc;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.drag-sort-controls h3 {
    margin: 0 0 12px 0;
    font-size: 1.1em;
    color: #2d3748;
    font-weight: 600;
}

#previewImg {
    max-width: calc(100% - 40px);
    max-height: calc(100% - 40px);
    display: none;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    /* 绝对定位居中 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10; /* 确保在其他元素之上 */
}

#previewPlaceholder {
    color: #a0aec0;
    font-style: italic;
    font-size: 1.1em;
    text-align: center;
    /* 绝对定位居中 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

/* 状态栏 */
.status-bar {
    margin-top: 24px;
    padding: 16px;
    background: linear-gradient(145deg, #f7fafc, #edf2f7);
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

#statusMessage {
    font-weight: 600;
    color: #4a5568;
    font-size: 1em;
}

/* 作者信息样式 */
.author-info {
    margin-top: 16px;
    padding: 12px 16px;
    text-align: center;
    background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    font-size: 0.9em;
    color: #718096;
}

.author-info p {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.author-info .separator {
    color: #a0aec0;
    font-weight: 300;
}

.author-info strong {
    color: #4a5568;
    font-weight: 600;
}

.author-info a {
    color: #4299e1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    padding: 2px 6px;
    border-radius: 4px;
}

.author-info a:hover {
    color: #3182ce;
    background: rgba(66, 153, 225, 0.1);
    transform: translateY(-1px);
}

.github-icon {
    fill: currentColor;
    vertical-align: middle;
}

/* 历史窗格 */
.history-pane {
    display: none;
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 9999999 !important; /* 设置极高的z-index确保始终置顶 */
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    padding: 0; /* 改为0，让header控制padding */
    overflow: hidden; /* 防止内容溢出 */
    width: 450px;
    height: 380px;
    min-width: 300px;
    min-height: 200px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    transition: box-shadow 0.3s ease; /* 只保留阴影过渡，移除位置过渡 */
    border: 2px solid rgba(66, 153, 225, 0.5);
    /* 确保始终在视口内且置顶 */
    box-sizing: border-box;
    pointer-events: auto;
    /* 添加拖拽相关样式 */
    resize: both; /* 允许调整大小 */
    /* 确保在任何情况下都能置顶显示 */
    isolation: isolate;
    contain: layout style paint;
}

.history-pane.dragging {
    transition: none; /* 拖拽时禁用过渡 */
    user-select: none; /* 拖拽时禁用文本选择 */
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4); /* 拖拽时增强阴影效果 */
    transform: rotate(1deg); /* 轻微旋转增加拖拽感 */
}

.history-pane:hover {
    box-shadow: 0 16px 56px rgba(0, 0, 0, 0.35);
}

.history-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0; /* 移除底部边距 */
    background: linear-gradient(145deg, #4299e1, #3182ce);
    color: white;
    padding: 12px 16px;
    border-radius: 8px 8px 0 0; /* 只有顶部圆角 */
    user-select: none;
    font-weight: 600;
    cursor: move; /* 显示移动光标 */
    position: relative;
}

.history-pane-header:hover {
    background: linear-gradient(145deg, #3182ce, #2c5aa0);
}

.history-pane-content {
    padding: 16px;
    height: calc(100% - 56px); /* 减去header高度 */
    overflow-y: auto;
    overflow-x: hidden;
}

.history-clear-btn,
.history-close-btn {
    padding: 6px 12px;
    font-size: 0.9em;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.history-clear-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    margin-right: 8px;
}

.history-clear-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.history-close-btn {
    background: #e53e3e;
    color: white;
}

.history-close-btn:hover {
    background: #c53030;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    height: 100%;
    overflow-y: auto;
}

.history-list li {
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-list li:hover {
    background: #edf2f7;
    transform: translateX(4px);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .control-panel {
        flex: none;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 16px;
        border-radius: 12px;
    }
    
    header h1 {
        font-size: 2.2em;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    /* 预览区域底部按钮在移动端的样式 */
    .preview-actions {
        margin-top: 16px;
        padding: 12px;
    }
    
    .preview-actions .btn {
        width: 100%;
        max-width: none;
        margin: 4px 0;
    }
    
    /* 预览控制行响应式 */
    .preview-controls-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .reset-button-container {
        align-self: center;
    }
    
    .history-pane {
        width: calc(100vw - 20px);
        height: 70vh;
        bottom: 10px !important;
        right: 10px !important;
        left: auto !important;
        top: auto !important;
        z-index: 9999999 !important; /* 确保在移动端也置顶 */
        max-width: calc(100vw - 20px) !important;
        max-height: calc(100vh - 20px) !important;
        border-width: 1px; /* 移动端使用更细的边框 */
    }
}

@media (max-width: 480px) {
    .file-upload {
        padding: 20px;
    }
    
    .file-upload label {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .preview-container {
        min-height: 250px;
    }
    
    /* 作者信息移动端样式 */
    .author-info p {
        flex-direction: column;
        gap: 8px;
    }
    
    .author-info .separator {
        display: none;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content > * {
    animation: fadeIn 0.6s ease-out;
}

.main-content > *:nth-child(1) { animation-delay: 0.1s; }
.main-content > *:nth-child(2) { animation-delay: 0.2s; }
.main-content > *:nth-child(3) { animation-delay: 0.3s; }
.main-content > *:nth-child(4) { animation-delay: 0.4s; }
.main-content > *:nth-child(5) { animation-delay: 0.5s; }

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, #cbd5e0, #a0aec0);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, #a0aec0, #718096);
}
