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

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --log-bg: #1e293b;
    --log-text: #e2e8f0;
}

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --secondary-color: #94a3b8;
    --success-color: #34d399;
    --error-color: #f87171;
    --warning-color: #fbbf24;
    --bg-color: #1e293b;
    --card-bg: #0f172a;
    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --gradient-start: #4c1d95;
    --gradient-end: #5b21b6;
    --log-bg: #0f172a;
    --log-text: #cbd5e1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
    color: var(--text-color);
    line-height: 1.6;
    transition: background 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
}

.header-top {
    position: absolute;
    top: 1rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    padding: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.theme-toggle svg {
    stroke: white;
    flex-shrink: 0;
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 0.5rem;
}

.version {
    font-size: 0.9rem;
    opacity: 0.8;
}

main {
    padding: 2rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-weight: 600;
}

h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 600;
}

/* Info Section */
.info-section {
    margin-bottom: 2rem;
}

.info-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.info-card p {
    color: var(--text-color);
    line-height: 1.8;
    margin: 0;
}

.upload-section {
    margin-bottom: 2rem;
}

.file-input-wrapper {
    position: relative;
}

#fileInput {
    display: none;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

[data-theme="dark"] .file-label:hover {
    background: rgba(96, 165, 250, 0.1);
    border-color: var(--primary-color);
}

.file-label svg {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-label span:first-of-type {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.file-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.collapsible-section {
    margin-bottom: 2rem;
    background: var(--bg-color);
    border-radius: 12px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
    margin: 0;
}

.collapsible-header:hover {
    background: var(--border-color);
}

.collapsible-header .collapse-icon {
    transition: transform 0.3s ease;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 1.5rem 1.5rem;
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    padding: 0 1.5rem;
}

.options-section {
    margin-bottom: 2rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 0.95rem;
}

.option-group input[type="number"],
.option-group input[type="text"] {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.option-group input[type="number"]:focus,
.option-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.option-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.action-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

button {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    flex: 1;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

.files-section {
    margin-bottom: 2rem;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.file-name {
    font-weight: 500;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-status {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .status-pending {
    background: #422006;
    color: #fcd34d;
}

[data-theme="dark"] .status-processing {
    background: #1e3a8a;
    color: #93c5fd;
}

[data-theme="dark"] .status-success {
    background: #064e3b;
    color: #6ee7b7;
}

[data-theme="dark"] .status-error {
    background: #7f1d1d;
    color: #fca5a5;
}

.log-section {
    margin-bottom: 2rem;
}

.log-output {
    background: var(--log-bg);
    color: var(--log-text);
    padding: 1.5rem;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.8;
}

.log-output:empty::before {
    content: '等待操作...';
    color: var(--text-secondary);
}

.log-entry {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.log-info {
    color: #93c5fd;
}

.log-success {
    color: #86efac;
}

.log-warning {
    color: #fcd34d;
}

.log-error {
    color: #fca5a5;
}

footer {
    background: var(--bg-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

footer p {
    margin-bottom: 0.5rem;
}

/* Scrollbar styling */
.log-output::-webkit-scrollbar {
    width: 8px;
}

.log-output::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.log-output::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.log-output::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
    }

    header {
        padding: 2rem 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 1.5rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .action-section {
        flex-direction: column;
    }
}

/* Drag and drop states */
.file-label.drag-over {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: scale(1.02);
}
