/* Design Tokens */
:root {
    --bg-main: #0a0e17;
    --bg-card: rgba(18, 24, 38, 0.65);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-card-hover: rgba(16, 185, 129, 0.25);
    
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.4);
    --primary-hover: #059669;
    
    --secondary: #06b6d4;
    --secondary-glow: rgba(6, 182, 212, 0.4);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-error: #ef4444;
    
    --font-outfit: 'Outfit', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-box: border-box;
    box-sizing: border-box;
    outline: none;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-outfit);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-x: hidden;
    position: relative;
}

/* Background Ambient Glow */
.background-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    left: -150px;
}

/* Container */
.container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 30px;
}

/* Header */
.app-header {
    text-align: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 2.2rem;
    animation: pulse-logo 2s infinite ease-in-out;
}

.app-header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #ffffff 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header h1 span {
    color: var(--primary);
    -webkit-text-fill-color: initial;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: var(--transition-smooth);
}

.main-card:hover {
    border-color: var(--border-card-hover);
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.05);
}

/* Input Fields & Groups */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: 0.2px;
}

.input-wrapper {
    display: flex;
    gap: 12px;
}

.input-wrapper input {
    flex-grow: 1;
    background: rgba(10, 14, 23, 0.8);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 16px 20px;
    font-family: var(--font-outfit);
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition-smooth);
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

/* Buttons */
.glow-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--font-outfit);
    font-size: 1rem;
    font-weight: 600;
    padding: 0 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px var(--primary-glow);
    white-space: nowrap;
}

.glow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.glow-btn:active {
    transform: translateY(0);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* Error Message */
.error-text {
    color: var(--text-error);
    font-size: 0.9rem;
    margin-top: 4px;
    font-weight: 400;
}

/* Status Cards */
.status-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-color: rgba(6, 182, 212, 0.15);
}

.status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-fetching { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-downloading { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-converting { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-completed { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Progress Bar */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar-wrapper {
    background: rgba(10, 14, 23, 0.8);
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Log Console */
.console-box {
    background: #060911;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

#clear-console-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-outfit);
    font-size: 0.75rem;
    cursor: pointer;
}

#clear-console-btn:hover {
    color: var(--text-main);
}

.console-logs {
    max-height: 120px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #34d399;
}

.console-log-line {
    line-height: 1.4;
    white-space: pre-wrap;
}

.console-log-line span {
    color: var(--text-muted);
    margin-right: 8px;
}

/* Download Link Wrapper */
.download-action-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    animation: fade-in 0.5s ease;
}

.success-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.success-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--primary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    animation: pulse-success 2s infinite;
}

.download-action-wrapper h4 {
    font-size: 1.2rem;
    font-weight: 600;
}

.download-action-wrapper p {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 400px;
}

.success-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
    padding: 16px 36px;
    text-decoration: none;
    font-size: 1.05rem;
}

.success-btn:hover {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Options/Providers selectors */
.options-wrapper {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

.option-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.option-field select {
    background: rgba(10, 14, 23, 0.8);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition-smooth);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

.option-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.option-field select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.option-field select option {
    background-color: var(--bg-main);
    color: var(--text-main);
}

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

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(16, 185, 129, 0)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 10px var(--primary-glow)); }
}

@keyframes pulse-success {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

/* Scrollbar Customization */
.console-logs::-webkit-scrollbar {
    width: 6px;
}

.console-logs::-webkit-scrollbar-track {
    background: transparent;
}

.console-logs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.console-logs::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 20px 10px;
    }
    
    .app-header h1 {
        font-size: 2.2rem;
    }
    
    .input-wrapper {
        flex-direction: column;
    }
    
    .options-wrapper {
        flex-direction: column;
        gap: 12px;
    }
    
    .glow-btn {
        padding: 16px;
    }
    
    .glass-card {
        padding: 20px;
    }
}
