/* 全局样式 - 苹果设计语言 */
:root {
    --primary-color: #0071e3;
    --primary-hover: #0077ed;
    --secondary-color: #86868b;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --error-color: #ff3b30;
    --background-color: #f5f5f7;
    --card-background: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #d2d2d7;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.16);
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 16px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 32px 0;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.app-title {
    font-size: 40px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 400;
}

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

/* 卡片样式 */
.card {
    background-color: var(--card-background);
    border-radius: var(--radius-large);
    padding: 32px;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

/* 上传区域 */
.upload-section {
    margin-bottom: 8px;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-large);
    padding: 64px 32px;
    text-align: center;
    transition: all var(--transition-normal);
    background-color: rgba(0, 113, 227, 0.03);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary-color); background-color: rgba(0, 113, 227, 0.05); transform: translateY(-2px); box-shadow: var(--shadow-medium); }

/* 上传框变小样式 */
.drop-zone.small { padding: 24px 16px; border-color: var(--primary-color); }

.drop-zone.small .upload-icon { width: 32px; height: 32px; margin-bottom: 12px; }

.drop-zone.small .drop-zone-title { font-size: 18px; margin-bottom: 4px; }

.drop-zone.small .drop-zone-subtitle { font-size: 14px; margin-bottom: 8px; }

.drop-zone.small .drop-zone-hint { font-size: 12px; }

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin-bottom: 24px;
    transition: all var(--transition-normal);
}

.drop-zone:hover .upload-icon {
    transform: scale(1.1);
}

.drop-zone-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drop-zone-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.browse-btn {
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.browse-btn:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.drop-zone-hint {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: none;
}

.upload-progress.show {
    display: block;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width var(--transition-fast);
}

/* 压缩设置 - 增强视觉层级 */
.settings-section {
    margin-bottom: 8px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 8px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.compression-levels {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.level-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: var(--radius-medium);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    background-color: rgba(134, 134, 139, 0.03);
    position: relative;
    overflow: hidden;
}

.level-option:hover {
    background-color: rgba(134, 134, 139, 0.06);
    transform: translateX(4px);
    border-color: rgba(0, 113, 227, 0.2);
}

.level-option input[type="radio"] {
    margin-right: 16px;
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.level-option input[type="radio"]:checked {
    transform: scale(1.1);
}

.level-option input[type="radio"]:checked + .level-content .level-label {
    font-weight: 600;
    color: var(--primary-color);
}

.level-option input[type="radio"]:checked {
    background-color: rgba(0, 113, 227, 0.1);
    border-color: var(--primary-color);
}

.level-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.level-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
    transition: color var(--transition-fast);
}

.level-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 压缩状态 */
.status-section {
    margin-bottom: 8px;
}

.status-message {
    padding: 16px;
    border-radius: var(--radius-medium);
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background-color: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
}

.status-message.warning {
    background-color: rgba(255, 149, 0, 0.1);
    color: var(--warning-color);
}

.status-message.error {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--error-color);
}

/* 集成的压缩设置和压缩列表 */
.integrated-section {
    display: flex;
    flex-direction: row;
    gap: 24px;
    overflow: hidden;
}

.settings-container {
    flex: 0 0 350px;
    min-height: 250px;
}

.images-container {
    flex: 1;
    overflow-y: auto;
    max-height: 600px;
}

/* 图片列表 - 增强视觉层级 */
.images-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-card {
    background-color: var(--card-background);
    border-radius: var(--radius-large);
    padding: 24px;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-normal);
    border: 1px solid rgba(134, 134, 139, 0.1);
    position: relative;
    overflow: hidden;
}

.image-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform var(--transition-slow);
}

.image-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.image-card:hover::before {
    transform: scaleX(1);
}

.image-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(134, 134, 139, 0.1);
}

.image-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-actions {
    display: flex;
    gap: 12px;
}
/* 按钮样式 - 增强视觉层级和反馈 */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-medium);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 按钮背景光效 */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--transition-slow), height var(--transition-slow);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    box-shadow: var(--shadow-light);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(134, 134, 139, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(134, 134, 139, 0.2);
}

.btn-secondary:hover {
    background-color: rgba(134, 134, 139, 0.2);
    box-shadow: var(--shadow-light);
    border-color: rgba(134, 134, 139, 0.3);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled::before {
    display: none;
}

/* 按钮文本保持在顶层 */
.btn * {
    position: relative;
    z-index: 1;
}

/* 图片预览 */
.image-preview {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background-color: rgba(134, 134, 139, 0.03);
    border-radius: var(--radius-medium);
}

.preview-item {
    flex: 1;
    text-align: center;
}

.preview-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.preview-box {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-medium);
    overflow: hidden;
    background-color: rgba(134, 134, 139, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid rgba(134, 134, 139, 0.1);
}

.preview-box:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-medium);
}

.preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 统计信息 - 增强视觉层级 */
.image-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px;
    background-color: rgba(0, 113, 227, 0.03);
    border-radius: var(--radius-medium);
    border: 1px solid rgba(0, 113, 227, 0.1);
}

.stat-item {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-small);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.stat-item:hover {
    background-color: rgba(0, 113, 227, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.stat-item:hover::before {
    transform: scaleX(1);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    transition: transform var(--transition-normal);
}

.stat-item:hover .stat-value {
    transform: translateY(-2px);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* 下载选项 - 增强视觉层级 */
.download-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(134, 134, 139, 0.1);
}

.file-name-input,
.file-format-select {
    flex: 1;
    min-width: 200px;
}

.file-name-input label,
.file-format-select label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-name-input input,
.file-format-select select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid transparent;
    border-radius: var(--radius-medium);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    background-color: rgba(245, 245, 247, 0.8);
    transition: all var(--transition-normal);
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.file-name-input input:hover,
.file-format-select select:hover {
    background-color: rgba(245, 245, 247, 1);
    border-color: rgba(134, 134, 139, 0.2);
}

.file-name-input input:focus,
.file-format-select select:focus {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    transform: translateY(-1px);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    animation: fadeIn var(--transition-normal);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: var(--radius-large);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-heavy);
    animation: slideUp var(--transition-normal);
}

.preview-modal-content {
    max-width: 1200px;
    width: 95%;
}

/* 对比预览样式 */
.comparison-container {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.comparison-item {
    flex: 1;
    text-align: center;
}

.comparison-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.comparison-preview {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-medium);
    padding: 20px;
    margin-bottom: 16px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-params {
    background-color: rgba(245, 245, 247, 0.8);
    border-radius: var(--radius-medium);
    padding: 16px;
    text-align: left;
}

.param-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(134, 134, 139, 0.1);
}

.param-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.param-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.param-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
}

.modal-close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color var(--transition-fast);
    line-height: 1;
    position: absolute;
    top: 16px;
    right: 24px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.error-message {
    font-size: 16px;
    color: var(--text-primary);
    text-align: center;
}

.modal-btn {
    padding: 12px 24px;
    border-radius: var(--radius-medium);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    outline: none;
    background-color: var(--primary-color);
    color: white;
}

.modal-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
}

/* 对比预览 - 增强视觉层级 */
.comparison-container {
    display: flex;
    gap: 30px;
    margin: 30px 0;
    align-items: stretch;
    flex-wrap: wrap;
}

.comparison-item {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comparison-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    padding: 12px;
    background-color: rgba(245, 245, 247, 0.5);
    border-radius: var(--radius-medium);
    border: 1px solid rgba(134, 134, 139, 0.1);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.comparison-title::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform var(--transition-slow);
}

.comparison-item:hover .comparison-title {
    background-color: rgba(245, 245, 247, 0.8);
    box-shadow: var(--shadow-light);
}

.comparison-item:hover .comparison-title::before {
    transform: scaleX(1);
}

.comparison-preview {
    flex: 1;
    min-height: 300px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-large);
    border: 2px solid transparent;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-normal);
    position: relative;
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.comparison-preview:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.comparison-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* 移除transform过渡 */
    box-shadow: var(--shadow-light);
    border-radius: var(--radius-small);
    background-color: white;
}

.comparison-preview:hover img {
    /* 移除transform缩放 */
    box-shadow: var(--shadow-medium);
}

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.footer-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* 保留加载动画 */

/* 图片卡片样式 */
.image-card {
    /* 移除动画 */
}

/* 按钮点击反馈 */
.btn:active {
    transform: scale(0.98);
    transition: transform var(--transition-fast);
}

/* 输入框聚焦效果（简化，移除动画） */
.file-name-input input:focus,
.file-format-select select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
    /* 移除transform */
}

/* 移除平滑滚动 */
html {
    /* scroll-behavior: smooth; */
}

/* 模态框样式 */
.modal.show .modal-content {
    /* 移除动画 */
}

/* 加载状态（简化，移除动画） */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 113, 227, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    /* 移除旋转动画 */
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .app-title {
        font-size: 32px;
    }
    
    .app-subtitle {
        font-size: 16px;
    }
    
    .card {
        padding: 24px;
    }
    
    .drop-zone {
        padding: 48px 24px;
    }
    
    /* 响应式集成布局 */
    .integrated-section {
        flex-direction: column;
    }
    
    .settings-container {
        flex: 0 0 auto;
        margin-bottom: 24px;
    }
    
    .images-container {
        max-height: none;
    }
    
    .upload-icon {
        width: 48px;
        height: 48px;
    }
    
    .drop-zone-title {
        font-size: 20px;
    }
    
    .image-preview {
        flex-direction: column;
        gap: 16px;
    }
    
    .preview-box {
        height: 140px;
    }
    
    .image-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 16px;
    }
    
    .comparison-container {
        flex-direction: column;
        gap: 24px;
    }
    
    .comparison-preview {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 28px;
    }
    
    .card {
        padding: 20px;
    }
    
    .drop-zone {
        padding: 32px 16px;
    }
    
    .drop-zone-title {
        font-size: 18px;
    }
    
    .download-options {
        flex-direction: column;
    }
    
    .file-name-input,
    .file-format-select {
        min-width: 100%;
    }
    
    .image-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .image-name {
        max-width: 100%;
    }
    
    .image-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .image-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .comparison-preview {
        height: 250px;
    }
}
