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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

h2 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* 转换类型按钮 */
.convert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.convert-btn {
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.convert-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    background: #fff;
}

.convert-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(118,75,162,0.15) 100%);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.2);
}

.convert-btn .icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.convert-btn .name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 5px;
}

.convert-btn .desc {
    font-size: 0.8rem;
    color: #888;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fafafa;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #667eea;
    background: #f8f5ff;
}

.upload-area.dragover {
    transform: scale(1.01);
}

.upload-content p {
    color: #666;
    margin: 10px 0;
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.browse-link {
    color: #667eea;
    cursor: pointer;
    font-weight: 600;
}

.browse-link:hover {
    text-decoration: underline;
}

.upload-tip {
    font-size: 0.85rem;
    color: #999 !important;
}

#fileInput {
    display: none;
}

/* 文件列表 */
.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.file-item:hover {
    background: #f0f0f0;
}

.file-item .file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.file-item .file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-item .file-name {
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    font-size: 0.85rem;
    color: #888;
    flex-shrink: 0;
    margin-left: 10px;
}

.file-item .file-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-item .file-remove:hover {
    color: #e74c3c;
    background: rgba(231,76,60,0.1);
}

/* 操作按钮 */
.action-bar {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-icon {
    font-size: 1.2rem;
}

/* 进度条 */
.progress-section {
    margin-top: 30px;
    text-align: center;
}

.progress-bar {
    height: 24px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 12px;
}

.progress-text {
    color: #666;
    font-size: 1rem;
}

/* 结果区 */
.result-section {
    margin-top: 30px;
}

.result-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.result-item .file-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.result-item .file-icon {
    margin-right: 8px;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
}

.modal-close:hover {
    color: #333;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.modal-message {
    color: #333;
    font-size: 1.1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* footer */
footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    opacity: 0.9;
}

footer p {
    margin: 8px 0;
}

.clean-link {
    color: white;
    text-decoration: underline;
    cursor: pointer;
}

.clean-link:hover {
    opacity: 0.8;
}

/* 响应式 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    main {
        padding: 20px;
    }
    
    .convert-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .convert-btn {
        padding: 15px 10px;
    }
    
    .convert-btn .icon {
        font-size: 1.5rem;
    }
    
    .convert-btn .desc {
        display: none;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .result-item {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .result-item .file-name {
        max-width: 100%;
    }
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}
