:root {
    /* Dark theme colors */
    --surface-bg: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(148, 163, 184, 0.1);
    --surface-card: rgba(30, 41, 59, 0.85);
    --surface-card-hover: rgba(51, 65, 85, 0.9);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --accent-primary: #818cf8;
    --accent-secondary: #c084fc;
    --accent-success: #34d399;
    --accent-error: #fb7185;
    
    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 12px -3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, 0.4);
    
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --glass-blur: blur(12px);
}

/* Light theme colors */
[data-theme="light"] {
    --surface-bg: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(148, 163, 184, 0.2);
    --surface-card: rgba(255, 255, 255, 0.85);
    --surface-card-hover: rgba(241, 245, 249, 0.9);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --accent-primary: #6366f1;
    --accent-secondary: #a855f7;
    --accent-success: #10b981;
    --accent-error: #f43f5e;
    
    --border-color: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 12px -3px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, 0.2);
    
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--surface-bg);
    background-image: 
        radial-gradient(circle at top right, rgba(129, 140, 248, 0.1), transparent 40%),
        radial-gradient(circle at bottom left, rgba(192, 132, 252, 0.1), transparent 40%);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    line-height: 1.5;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* Header Styles */
.app-header {
    background: var(--glass-bg);
    padding: 1rem;
    box-shadow: var(--glass-shadow);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.logo-icon {
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.3));
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.3));
}

/* Main Content Styles */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1rem;
}

.download-card {
    background: var(--surface-card);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.url-input-section {
    margin-bottom: 2rem;
}

.url-input-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

textarea#video-url {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s ease;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

textarea#video-url:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.url-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.options-section {
    background: var(--glass-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.options-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Format Select */
.format-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--surface-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.format-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

/* Checkbox Styles */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.checkbox-wrapper:last-child {
    margin-bottom: 0;
}

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

input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 4px;
    border: 2px solid var(--glass-border);
    appearance: none;
    background: var(--surface-card);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px rgba(129, 140, 248, 0.3);
}

input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: var(--text-primary);
    font-size: 0.75rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Custom Name Input */
.name-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.custom-name-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--surface-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.custom-name-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.custom-name-input:disabled {
    background: var(--glass-bg);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Action Section */
.action-section {
    display: flex;
    justify-content: center;
}

.download-button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--text-primary);
    border: none;
    border-radius: 12px;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.3);
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(129, 140, 248, 0.4);
}

.download-icon {
    width: 1.25rem;
    height: 1.25rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

/* Downloads Section */
.downloads-section {
    background: var(--surface-card);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.downloads-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.status-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-container {
    background: var(--glass-bg);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.url-display {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    word-break: break-all;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-card);
    border-radius: 6px;
    overflow: hidden;
    margin: 0.75rem 0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.3);
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: right;
}

.status-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Footer */
.app-footer {
    background: var(--glass-bg);
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.app-footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .download-card,
    .downloads-section {
        padding: 1.5rem;
    }

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

    .options-section {
        padding: 1rem;
    }

    .download-button {
        width: 100%;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Animations */
@keyframes glow {
    0% { box-shadow: 0 0 20px rgba(129, 140, 248, 0.3); }
    50% { box-shadow: 0 0 30px rgba(129, 140, 248, 0.5); }
    100% { box-shadow: 0 0 20px rgba(129, 140, 248, 0.3); }
}

.download-button {
    animation: glow 3s infinite;
}

/* Settings Button */
.settings-button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-left: auto;
}

.settings-button:hover {
    background: var(--glass-bg);
    transform: rotate(45deg);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.close-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    line-height: 1;
    transition: all 0.2s ease;
}

.close-button:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
}

/* Settings Form Styles */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.setting-item {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.setting-item label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    flex: 1;
}

.setting-input,
.setting-select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 200px;
    transition: all 0.2s ease;
}

.setting-input:focus,
.setting-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

/* Primary Button */
.primary-button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .setting-input,
    .setting-select {
        width: 100%;
    }
}