/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #475569;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-box {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: var(--primary);
    background: var(--surface-light);
}

.upload-box.dragover {
    border-color: var(--secondary);
    background: rgba(16, 185, 129, 0.1);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-box h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.upload-box p {
    color: var(--text-muted);
}

.file-types {
    font-size: 0.85rem;
    margin-top: 16px;
}

/* Preview Section */
.preview-section {
    margin-top: 30px;
}

.preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.preview-box {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.preview-box h3 {
    text-align: center;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.preview-image {
    background: var(--background);
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-image img,
.preview-image video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

.placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.image-info {
    text-align: center;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.arrow {
    font-size: 2rem;
}

/* Options Section */
.options-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.options-section h3 {
    margin-bottom: 16px;
    font-size: 1rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.option-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-item label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.option-item select {
    background: var(--background);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 1rem;
    cursor: pointer;
}

.option-item select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.process-btn,
.download-btn {
    width: 100%;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.process-btn:hover,
.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.process-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.2rem;
}

.reset-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 12px;
    width: 100%;
    transition: all 0.2s;
}

.reset-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

/* Progress Section */
.progress-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.progress-bar {
    background: var(--background);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 12px;
    color: var(--text-muted);
}

/* Download Section */
.download-section {
    margin-bottom: 30px;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.feature-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.feature-card h3 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--surface-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 16px;
    }
    
    .header {
        padding: 30px 0;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .upload-box {
        padding: 40px 20px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .preview-container {
        flex-direction: column;
    }
    
    .arrow {
        transform: rotate(90deg);
    }
}

/* Config Section */
.config-section {
    margin: 30px 0;
}

.config-section details {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
}

.config-section summary {
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
    list-style: none;
}

.config-section summary::-webkit-details-marker {
    display: none;
}

.config-content {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.config-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.config-input-group {
    display: flex;
    gap: 10px;
}

.config-input-group input {
    flex: 1;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.9rem;
}

.config-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.config-input-group button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.config-input-group button:hover {
    background: var(--primary-dark);
}

.config-input-group .test-btn {
    background: var(--secondary);
}

.config-input-group .test-btn:hover {
    background: #059669;
}

.config-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.config-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid var(--secondary);
}

.config-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid #ef4444;
}

.config-status.pending {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid var(--primary);
}

.config-hint {
    color: var(--secondary) !important;
    font-size: 0.85rem !important;
    margin-top: 12px !important;
}

/* Error State */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
}

/* Success State */
.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--secondary);
    color: #6ee7b7;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
}
