/* 基础变量 */
:root {
    /* 主题色系 */
    --primary-color: #4F46E5;  /* 主色调：优雅的靛蓝色 */
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;  /* 用于图标背景 */
    
    /* 背景色 */
    --bg-color: #fafafa;
    --card-bg: #FFFFFF;
    
    /* 文字颜色 */
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-desc: #6b7280;
    --text-light: #FFFFFF;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    /* 更新配色 */
    --sidebar-bg: #2b2b5e;  /* 更深的蓝紫色 */
    --sidebar-hover: #3d3d7d;
    
    /* 间距系统 */
    --spacing-xs: 8px;   /* 组内小间距 */
    --spacing-sm: 12px;  /* 组内常规间距 */
    --spacing-md: 24px;  /* 组间距 */
    --spacing-lg: 40px;  /* 大区块间距 */
    
    /* 辅助色系 */
    --success-color: #34C759;
    --success-light: #E8FFF3;
    --purple-light: #F5F3FF;
    --hover-light: #F8FAFC;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: #1d1d1f;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    overflow: hidden;  /* 防止内容溢出 */
}

/* 上传区域样式 */
.upload-area {
    text-align: center;
    padding: 15px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background-color: #f8f8f8;
    margin-bottom: 20px;
}

.upload-btn {
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    box-shadow: var(--shadow-sm);
}

.upload-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.upload-tip {
    margin-top: 12px;
    color: #86868b;
}

/* 格式选择样式优化 */
.format-options {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    gap: 8px;
}

.format-option {
    flex: 1;
    min-width: 90px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.format-option:hover {
    background: #f5f5f7;
}

.format-option.selected {
    border-color: #0071e3;
    background-color: #f0f7ff;
}

.format-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
}

.format-name {
    font-size: 0.85em;
    font-weight: 500;
    color: #1d1d1f;
}

/* 转换按钮 */
.download-btn {
    width: 100%;
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 20px;
    box-shadow: var(--shadow-sm);
}

.download-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.download-btn:disabled {
    background-color: #999;
    cursor: not-allowed;
}

/* 功能选择区域样式 */
.feature-section {
    display: block;
    min-height: 200px;  /* 防止内容闪烁 */
}

.feature-card {
    padding: 24px 20px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    gap: 16px;
    align-items: center;
}

.feature-icon {
    min-width: 52px;
    height: 52px;
    background: #F5F3FF;  /* 统一使用浅紫色背景 */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-icon i {
    font-size: 26px;
    color: #4F46E5;  /* 保持图标本身的颜色 */
}

.feature-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.feature-desc {
    color: var(--text-desc);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 280px;
}

.feature-card:not(.coming-soon):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.1);
    background: var(--hover-light);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:not(.coming-soon)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.8s ease-in-out;
}

.feature-card:not(.coming-soon):hover::after {
    transform: translateX(100%);
}

/* 文件列表样式 */
.file-list {
    margin-top: 15px;
    background: #fff;
    border-radius: 8px;
    overflow-y: auto;
    max-height: 300px;  /* 限制列表最大高度 */
}

.file-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e5e7;
}

.file-item:last-child {
    border-bottom: none;
}

.file-thumbnail {
    width: 40px;       /* 缩小缩略图尺寸 */
    height: 40px;
    border-radius: 4px;
    object-fit: cover;  /* 保持图片比例 */
    margin-right: 12px;
}

.file-info {
    flex: 1;
    min-width: 0;  /* 防止文件名溢出 */
}

.file-name {
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-size {
    font-size: 0.8em;
    color: #86868b;
}

.file-status {
    font-size: 0.85em;
    min-width: 48px;
}

.file-status.processing {
    color: #0071e3;
}

.file-status.done {
    color: var(--success-color);
    background: var(--success-light);
    padding: 2px 8px;
    border-radius: 4px;
}

.file-status.error {
    color: #ff3b30;
}

.file-progress {
    width: 40px;
    height: 3px;
    background: #e5e5e7;
    border-radius: 2px;
    overflow: hidden;
}

.file-progress-bar {
    width: 0;
    height: 100%;
    background: #0071e3;
    transition: width 0.3s ease;
}

/* 文件操作按钮样式 */
.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.convert-single-btn,
.delete-btn,
.download-single-btn {
    background-color: #0071e3;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-btn {
    background-color: #e3e3e8;
    color: #86868b;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    padding: 0;
    line-height: 24px;
    font-size: 16px;
}

.delete-btn:hover {
    background-color: #d1d1d6;
    color: #1d1d1f;
}

.download-single-btn {
    background-color: var(--success-color);
}

.convert-single-btn:hover,
.delete-btn:hover,
.download-single-btn:hover {
    opacity: 0.9;
}

.convert-single-btn:disabled,
.delete-btn:disabled,
.download-single-btn:disabled {
    background-color: #999;
    cursor: not-allowed;
}

.download-action {
    margin-left: 8px;
}

.file-status {
    margin: 0 8px;
}

.compress-single-btn {
    background-color: #0071e3;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compress-single-btn:hover {
    opacity: 0.9;
}

.compress-single-btn:disabled {
    background-color: #999;
    cursor: not-allowed;
}

/* 质量控制样式 */
.quality-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
}

.quality-slider {
    width: 100px;
    height: 4px;
}

.quality-value {
    font-size: 0.85em;
    color: #86868b;
    min-width: 40px;
}

.compressed-size {
    color: var(--success-color);
    background: var(--success-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* 调整文件信息布局 */
.file-info {
    flex: 1;
    min-width: 0;
}

.file-size {
    font-size: 0.8em;
    color: #86868b;
    display: flex;
    gap: 4px;
    align-items: center;
}

@media screen and (max-width: 768px) {
  /* 移动端基础样式 */
  .container {
    width: 100%;
    padding: 0 15px;
  }
  
  .feature-section {
    flex-direction: column;
    gap: 15px;
  }
  
  /* 标题样式调整 */
  .header h1 {
    font-size: 1.8rem;
  }
  
  /* 功能卡片样式调整 */
  .feature-card {
    max-width: 100%;
    padding: 20px;
  }
  
  /* 文件列表项调整 */
  .file-item {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* 按钮样式调整 */
  .upload-btn, .download-btn {
    width: 100%;
    padding: 15px;
  }
  
  /* 格式转换区域调整 */
  .convert-container {
    flex-direction: column;
  }
  
  .convert-control-area {
    width: 100%;
    margin-top: 20px;
  }
  
  /* 格式选择按钮调整 */
  .format-options {
    flex-wrap: wrap;
    justify-content: space-around;
  }
  
  .format-option {
    min-width: calc(50% - 10px);
    margin-bottom: 10px;
  }
  
  /* 质量控制滑块优化 */
  .quality-control {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .quality-control input[type="range"] {
    width: 100%;
  }
  
  .quality-control label {
    text-align: center;
  }
}

/* 功能组样式 */
.feature-group {
    margin-bottom: 32px;  /* 减小底部间距 */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 分组标题样式 */
.group-title {
    grid-column: 1 / -1;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: left;
    margin-bottom: 12px;
    position: relative;
    padding-left: 16px;
    display: flex;
    align-items: center;
}

/* 添加装饰竖条 */
.group-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* 第二个及以后的分组标题添加额外的顶部间距 */
.feature-group:not(:first-child) .group-title {
    margin-top: 48px;  /* 不同分组之间的间距 */
}

/* 最后一个分组不需要底部间距 */
.feature-group:last-child {
    margin-bottom: 0;
}

/* 布局结构 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    padding: 24px;
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;  /* 确保侧边栏始终在最上层 */
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    font-size: 1.5rem;
    font-weight: 600;
}

.logo i {
    width: 32px;
    height: 32px;
    font-size: 24px;
    color: #fff;
}

.logo span {
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--sidebar-bg);  /* 确保导航菜单背景色与侧边栏一致 */
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    background: transparent;  /* 确保导航项背景透明 */
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: white;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin: 0 0 0 240px;
    padding: 40px 48px;
    max-width: 1400px;
    overflow-x: hidden;  /* 防止水平滚动条 */
}

/* 工具卡片网格布局 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* 搜索框 */
.search-bar {
    background: white;
    border-radius: 12px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}

.search-bar input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 64px;
        padding: 16px 8px;
    }

    .sidebar .logo span,
    .sidebar .nav-item span {
        display: none;
    }

    .main-content {
        margin-left: 64px;
        padding: 16px;
    }

    .feature-group {
        grid-template-columns: 1fr;  /* 移动端单列 */
    }
}

/* 功能区域显示/隐藏 */
.hidden {
    display: none;
}

.feature-text {
    flex: 1;
}

/* 添加即将上线状态样式 */
.feature-card.coming-soon {
    cursor: not-allowed;
    position: relative;
}

/* 让卡片内容半透明 */
.feature-card.coming-soon .feature-icon,
.feature-card.coming-soon .feature-text {
    opacity: 0.6;
}

.feature-card.coming-soon::before {
    content: '即将上线';
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 0 16px 0 8px;
    z-index: 2;
}

.feature-card.coming-soon:hover {
    cursor: not-allowed;
}