* {
    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;
    color: #333;
}

/* RTL语言支持 */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .tool-buttons {
    flex-direction: row-reverse;
}

[dir="rtl"] .options {
    flex-direction: row-reverse;
}

[dir="rtl"] .file-list-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .upload-label {
    text-align: center;
}

/* 语言选择器 */
.language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

[dir="rtl"] .language-selector {
    right: auto;
    left: 20px;
}

.language-selector label {
    font-size: 0.9em;
    font-weight: 600;
    color: #667eea;
}

.language-selector select {
    padding: 5px 10px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 0.9em;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    border-color: #764ba2;
}

.language-selector select:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

.tool-section {
    margin-bottom: 30px;
}

.tool-section h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #333;
}

.tool-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.tool-btn {
    padding: 12px 24px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tool-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.tool-btn.active {
    background: #667eea;
    color: white;
}

.tool-panel {
    display: none;
}

.tool-panel.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.main-content {
    margin-top: 30px;
}

.upload-area {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    border: 2px dashed #ddd;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3em;
}

.file-input {
    display: none;
}

.upload-label {
    display: inline-block;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

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

.upload-label .upload-icon {
    margin-right: 8px;
    font-size: 1.2em;
}

.options {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.options label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.options select,
.options input[type="number"],
.options input[type="text"],
.options input[type="range"] {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.options select:focus,
.options input:focus {
    outline: none;
    border-color: #667eea;
}

.options input[type="range"] {
    width: 150px;
}

#quality-value {
    font-weight: 600;
    color: #667eea;
    min-width: 50px;
}

.convert-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 15px;
    width: 100%;
    max-width: 300px;
}

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

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 首页样式 */
.home-page {
    padding: 20px 0;
}

.intro-section {
    text-align: center;
    margin-bottom: 50px;
}

.intro-section h2 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 20px;
}

.intro-section p {
    font-size: 1.1em;
    color: #666;
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.feature-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    background: #f0f4ff;
}

.feature-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 10px;
}

.feature-card p {
    color: #666;
    font-size: 0.95em;
}

.benefits-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #eee;
}

.benefits-section h3 {
    font-size: 1.8em;
    color: #333;
    text-align: center;
    margin-bottom: 40px;
}

.benefits-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.benefit-item:hover {
    background: #f0f4ff;
    transform: translateX(5px);
}

.benefit-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.benefit-item h4 {
    font-size: 1.2em;
    color: #667eea;
    margin-bottom: 8px;
}

.benefit-item p {
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
}

.file-list {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.file-list-item {
    padding: 10px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    transition: all 0.2s ease;
}

.file-list-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.file-list-item.dragging {
    opacity: 0.5;
    background: #dee2e6;
}

.file-list-item .drag-handle {
    cursor: grab;
    margin-right: 10px;
    font-size: 1.2em;
    color: #667eea;
}

.file-list-item .drag-handle:active {
    cursor: grabbing;
}

.file-list-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-item .remove-btn {
    padding: 5px 10px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
}

.file-list-item .remove-btn:hover {
    background: #ee3742;
}

.sortable-list .file-list-item {
    position: relative;
}

.sortable-list .file-list-item::before {
    content: '☰';
    color: #667eea;
    margin-right: 8px;
    font-size: 1.2em;
}

.progress-bar {
    margin-top: 30px;
    background: #f0f0f0;
    border-radius: 10px;
    height: 40px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s infinite;
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

.result-area {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    text-align: center;
}

.result-area h3 {
    margin-bottom: 15px;
    color: #333;
}

.download-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
}

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

.file-info {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    font-size: 0.9em;
    color: #666;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .tool-buttons {
        flex-direction: column;
    }

    .tool-btn {
        width: 100%;
    }

    .options {
        flex-direction: column;
        align-items: flex-start;
    }

    .convert-btn {
        width: 100%;
    }
}

