/* Modern Theme System with Dark/Light Mode */

/* CSS Variables for Theme System */
:root {
    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-accent: linear-gradient(135deg, #f78e43 0%, #e67828 100%);
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-accent: #f78e43;
    --text-inverse: #ffffff;
    
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    --border-accent: #f78e43;
    
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-accent: 0 8px 25px rgba(102, 126, 234, 0.3);
    
    --success-bg: #ecfdf5;
    --success-text: #059669;
    --success-border: #86efac;
    
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --error-border: #fca5a5;
    
    --warning-bg: #fffbeb;
    --warning-text: #d97706;
    --warning-border: #fcd34d;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-accent: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --bg-surface: #1e293b;
    --bg-card: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-accent: #818cf8;
    --text-inverse: #0f172a;
    
    --border-primary: #475569;
    --border-secondary: #64748b;
    --border-accent: #818cf8;
    
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-accent: 0 8px 25px rgba(129, 140, 248, 0.4);
    
    --success-bg: #064e3b;
    --success-text: #34d399;
    --success-border: #059669;
    
    --error-bg: #7f1d1d;
    --error-text: #f87171;
    --error-border: #dc2626;
    
    --warning-bg: #78350f;
    --warning-text: #fbbf24;
    --warning-border: #f59e0b;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-surface);
    border: 2px solid var(--border-primary);
    border-radius: 25px;
    width: 50px;
    height: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-right: 1rem;
}

.theme-toggle:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-sm);
}

.theme-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    transition: all 0.3s ease;
}

.theme-icon.sun {
    left: 4px;
    opacity: 1;
}

.theme-icon.moon {
    right: 4px;
    opacity: 0;
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0;
    left: -20px;
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
    right: 4px;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Upload Layout */
.upload-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* Format Selection */
.format-selection {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
    height: fit-content;
}

.format-selection h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.format-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.format-option {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.format-option:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.format-option.active {
    background: var(--bg-accent);
    border-color: var(--border-accent);
    color: var(--text-inverse);
    box-shadow: var(--shadow-accent);
}

.format-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.format-name {
    font-weight: 600;
    font-size: 1rem;
}

.format-desc {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Quality Section */
.quality-section {
    margin-bottom: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-primary);
}

.quality-section label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.quality-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quality-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.quality-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.quality-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#qualityValue {
    font-weight: 600;
    color: var(--text-accent);
    min-width: 35px;
    text-align: right;
    font-size: 0.9rem;
}

/* Resize Section */
.resize-section {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-primary);
}

.resize-section label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.resize-section input[type="checkbox"] {
    transform: scale(1.1);
    accent-color: var(--text-accent);
}

.resize-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.resize-inputs input[type="number"] {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.9rem;
    text-align: center;
    width: 80px;
    color: var(--text-primary);
}

.resize-inputs input[type="number"]:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.resize-inputs span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Drop Zone - Compact */
.drop-zone {
    background: var(--bg-card);
    border: 3px dashed var(--border-secondary);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--border-accent);
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.drop-zone-content {
    text-align: center;
}

.drop-zone-content .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.7;
}

.drop-zone-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-zone-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.upload-formats {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
}

.privacy-note {
    font-size: 0.85rem;
    color: var(--success-text);
    font-weight: 500;
    background: var(--success-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    display: inline-block;
    margin-top: 0.75rem;
    border: 1px solid var(--success-border);
}

/* Convert Section */
.convert-section {
    text-align: center;
    margin-top: 2rem;
}

.convert-btn {
    background: var(--bg-accent);
    color: var(--text-inverse);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-accent);
    position: relative;
    overflow: hidden;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.convert-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.convert-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.convert-btn:hover::before {
    left: 100%;
}

/* Files Section */
.files-section {
    margin-top: 2rem;
    background: var(--bg-card);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.files-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
}

.clear-btn {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: var(--error-text);
    color: var(--text-inverse);
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .upload-layout {
        grid-template-columns: 280px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .upload-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .format-selection {
        order: 2;
    }
    
    .drop-zone {
        order: 1;
        min-height: 150px;
        padding: 1.5rem 1rem;
    }
    
    .format-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .format-option {
        flex: 1;
        min-width: 0;
        padding: 0.75rem;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }
}

@media (max-width: 480px) {
    .upload-container h2 {
        font-size: 1.75rem;
    }
    
    .drop-zone-content .upload-icon {
        font-size: 2rem;
    }
    
    .format-buttons {
        flex-direction: column;
    }
    
    .resize-inputs {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .resize-inputs input[type="number"] {
        width: 120px;
    }
    
    .convert-btn {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

/* Progress Section */
.progress-section {
    max-width: 600px;
    margin: 2rem auto;
    background: var(--bg-card);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 1px solid var(--border-primary);
}

.progress-container h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.progress-bar {
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--bg-accent);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 5px;
}

.progress-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-accent);
}

/* Animation for theme transition */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}
