:root {
    /* Light Theme Colors */
    --bg-gradient-start: #edf2ff;
    --bg-gradient-end: #d9e3fa;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-shadow: rgba(0, 0, 0, 0.07);
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --input-bg: rgba(255, 255, 255, 0.85);
    --input-border: rgba(59, 130, 246, 0.18);
    --button-gradient-start: #ef4444;
    --button-gradient-end: #ec4899;
    --button-shadow: rgba(239, 68, 68, 0.28);
    --format-btn-bg: rgba(255, 255, 255, 0.8);
    --format-btn-active: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --progress-bg: rgba(0, 0, 0, 0.1);
    --progress-fill: linear-gradient(90deg, #ef4444, #ec4899);
}

[data-theme="dark"] {
    /* Dark Theme Colors */
    --bg-gradient-start: #000000;
    --bg-gradient-end: #000000;
    --card-bg: rgba(0, 0, 0, 0.9);
    --card-shadow: rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --input-bg: rgba(255, 255, 255, 0.10);
    --input-border: rgba(59, 130, 246, 0.3);
    --button-gradient-start: #ef4444;
    --button-gradient-end: #ec4899;
    --button-shadow: rgba(239, 68, 68, 0.4);
    --format-btn-bg: rgba(255, 255, 255, 0.15);
    --format-btn-active: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --progress-bg: rgba(255, 255, 255, 0.1);
    --progress-fill: linear-gradient(90deg, #ef4444, #ec4899);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-primary);
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* Support Message */
.support-message {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.support-text {
    margin-bottom: 8px;
}

.support-link-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.boycott-link {
    color: #3b82f6;
    text-decoration: underline;
    transition: color 0.2s;
}

.boycott-link:hover {
    color: #2563eb;
}

/* Main Card */
.main-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 8px 32px var(--card-shadow);
    transition: all 0.3s ease;
}

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: scale(1.1);
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    transition: 0.4s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

/* Title */
.title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
}

/* URL Input */
.url-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.url-input {
    flex: 1;
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.url-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.url-input::placeholder {
    color: var(--text-secondary);
}

.refresh-btn {
    padding: 12px;
    background: var(--format-btn-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #3b82f6;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    transform: rotate(180deg);
    background: rgba(59, 130, 246, 0.1);
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Formats */
.loading-formats {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    border: 4px solid var(--progress-bg);
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Format Selector */
.format-selector {
    margin-bottom: 20px;
}

.format-label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.format-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.format-btn {
    padding: 10px 20px;
    background: var(--format-btn-bg);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.format-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.format-btn.active {
    background: var(--format-btn-active);
    color: white;
    border-color: transparent;
}

/* Settings */
.settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.toggle-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.toggle-label .icon {
    font-size: 1.2rem;
}

/* Fast Download Badge */
.fast-download-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.rocket-icon {
    font-size: 1.2rem;
}

/* Download Button */
.download-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--button-gradient-start), var(--button-gradient-end));
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 6px 20px var(--button-shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.download-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--button-shadow);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.download-btn.downloading {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6, #ec4899, #ef4444);
    background-size: 300% 300%;
    animation: gradientShift 2s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-icon {
    font-size: 1.5rem;
}

/* Progress Container */
.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--progress-fill);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

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

/* Message Container */
.message-container {
    margin-top: 16px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
}

.message-container.error {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
}

.message-container.success {
    background: rgba(34, 197, 94, 0.1);
    border-left-color: #22c55e;
}

#messageText {
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Contact Info */
.contact-info {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.contact-info a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s;
}

.contact-info a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 640px) {
    .main-card {
        padding: 24px;
    }

    .title {
        font-size: 1.5rem;
    }

    .format-buttons {
        justify-content: center;
    }

    .support-link-text {
        font-size: 0.8rem;
    }
}

/* Smooth Animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
