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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部标题栏 */
.header {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    padding: 20px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 28px;
    color: #2196F3;
}

.logo h1 {
    font-size: 24px;
    font-weight: 500;
    color: #2196F3;
}

.help-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
}

.help-link:hover {
    color: #2196F3;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 文件上传区域 */
.upload-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.upload-area {
    border: 2px dashed #2196F3;
    border-radius: 12px;
    padding: 60px 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fafbfc;
}

.upload-area:hover {
    border-color: #1976D2;
    background: #f0f8ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #FF9800;
    background: #fff8e1;
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    font-size: 48px;
    color: #2196F3;
    margin-bottom: 10px;
}

.upload-content h3 {
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

.upload-content p {
    color: #666;
    font-size: 14px;
}

.select-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.select-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* 文件列表 */
.file-list {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.file-list h4 {
    margin-bottom: 15px;
    color: #333;
    font-weight: 500;
}

.file-items {
    display: grid;
    gap: 15px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-item:hover {
    border-color: #2196F3;
    background: #f0f8ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.file-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.file-size {
    color: #666;
    font-size: 14px;
}

.file-remove {
    background: #f44336;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.file-remove:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* 压缩控制面板 */
.control-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.control-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.quality-control h4,
.size-info h4 {
    margin-bottom: 20px;
    color: #333;
    font-weight: 500;
}

.quality-slider {
    display: flex;
    align-items: center;
    gap: 20px;
}

#qualitySlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none; 
}

#qualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

#qualitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

.quality-value {
    background: #2196F3;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

.size-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.size-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.size-item.compression-ratio {
    background: #e8f5e8;
    border: 1px solid #4caf50;
}

.size-item .label {
    color: #666;
    font-weight: 500;
}

.size-item .value {
    color: #333;
    font-weight: 600;
}

.compression-ratio .value {
    color: #4caf50;
}

/* 预览对比区域 */
.preview-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.preview-panel h4 {
    margin-bottom: 15px;
    color: #333;
    font-weight: 500;
    text-align: center;
}

.image-container {
    position: relative;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-container img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 6px;
}

.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    font-size: 12px;
    text-align: center;
}

/* 操作按钮区域 */
.action-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: #2196F3;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-secondary {
    background: #4caf50;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #388e3c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-outline {
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
}

.btn-outline:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #bbb;
    transform: translateY(-1px);
}

/* 进度指示器 */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.progress-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.progress-circle {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease;
}

.progress-ring-circle.active {
    stroke: #2196F3;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #2196F3;
}

.progress-message {
    color: #666;
    font-size: 16px;
}

/* 底部信息 */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    margin-top: auto;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1001;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #4caf50;
}

.toast.error {
    background: #f44336;
}

.toast.warning {
    background: #ff9800;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
    
    .upload-content h3 {
        font-size: 16px;
    }
    
    .control-card {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .preview-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }
    
    .progress-content {
        margin: 20px;
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .main-content {
        gap: 20px;
    }
    
    .upload-section,
    .control-panel,
    .preview-section,
    .action-section {
        padding: 20px;
    }
    
    .file-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .quality-slider {
        flex-direction: column;
        gap: 15px;
    }
    
    #qualitySlider {
        width: 100%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* 全屏图片预览 */
.fullscreen-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    backdrop-filter: blur(10px);
}

.viewer-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.viewer-info span:first-child {
    font-weight: 500;
    font-size: 16px;
}

.viewer-info span:last-child {
    font-size: 14px;
    color: #ccc;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.viewer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
}

.viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.zoom-level {
    color: white;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
    font-size: 14px;
}

.viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.viewer-content.dragging {
    cursor: grabbing;
}

.viewer-content img {
    max-width: none;
    max-height: none;
    transition: transform 0.3s ease;
    user-select: none;
    pointer-events: none;
}

/* 图片容器添加点击效果 */
.image-container {
    position: relative;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-container:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: all 0.3s ease;
    pointer-events: none;
}

.image-container:hover::after {
    background: rgba(0, 0, 0, 0.1);
}

.image-container::before {
    content: '\f065';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.image-container:hover::before {
    opacity: 1;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 - 模态框 */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-body img {
        max-height: 50vh;
    }
    
    .modal-info {
        gap: 15px;
    }
    
    .info-item {
        min-width: 100px;
        padding: 12px 15px;
    }
}

/* 预览导航样式 */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preview-header h4 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.preview-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
}

.nav-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #dee2e6;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.image-counter {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

/* 文件列表选中状态 */
.file-item.active {
    border-color: #2196F3 !important;
    background: #e3f2fd !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.file-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #2196F3;
    border-radius: 0 4px 4px 0;
}

.file-item {
    position: relative;
}

.file-item img {
    transition: all 0.2s ease;
}

.file-item:hover img {
    transform: scale(1.05);
}

/* 文件项点击提示 */
.file-item::after {
    content: '点击选择';
    position: absolute;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.file-item:hover::after {
    opacity: 1;
}

.file-item.active::after {
    content: '已选中';
    background: rgba(33, 150, 243, 0.2);
    opacity: 1;
}
