/* =====================================================
   tldv Downloader - Modern Dark Theme Styles
   ===================================================== */

:root {
    /* Colors */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-input: rgba(15, 15, 26, 0.6);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    --accent-primary: #6366f1;
    --accent-secondary: #ec4899;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);

    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 16px;
    --border-radius-sm: 8px;

    /* Shadows */
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-medium: 300ms ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background Gradient */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* Container */
.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main Card */
.main-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    flex: 1;
}

/* Steps */
.step {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.step-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.label-text {
    font-weight: 500;
    font-size: 0.9rem;
}

.label-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.label-hint a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.label-hint a:hover {
    color: var(--accent-secondary);
}

input[type="url"],
input[type="text"],
textarea,
select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' 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 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    width: auto;
}

/* Button Loader */
.btn-loader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

/* Help Box */
.help-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    animation: fadeIn 0.3s ease;
}

.help-box h4 {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.help-box ol {
    margin-left: 1.25rem;
}

.help-box li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.help-box code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.help-box kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.help-box a {
    color: var(--accent-primary);
}

/* Video Info */
.video-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.video-icon {
    font-size: 2rem;
}

.video-details h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.video-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Status Box */
.status-box {
    text-align: center;
    padding: 2rem 1rem;
}

.status-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.status-box h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.status-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    transition: width 0.3s ease;
    animation: indeterminate 1.5s infinite linear;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
        width: 50%;
    }

    100% {
        transform: translateX(200%);
        width: 50%;
    }
}

.progress-fill.determinate {
    animation: none;
}

.progress-percent {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted, var(--text-secondary));
    text-align: center;
    min-height: 1.25rem;
}

/* Error Box */
.error-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.error-icon {
    font-size: 1.25rem;
}

.error-box p {
    flex: 1;
    font-size: 0.9rem;
    color: var(--error);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

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

.footer .note {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Success State */
.status-box.success .status-icon {
    animation: none;
}

.status-box.success h3 {
    color: var(--success);
}

/* Error State */
.status-box.error .status-icon {
    animation: none;
}

.status-box.error h3 {
    color: var(--error);
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .main-card {
        padding: 1.5rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }
}

/* Login Info */
.login-info {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Login Status */
.login-status {
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-sm);
    animation: fadeIn 0.3s ease;
}

.login-status p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

/* Auth Badge */
.auth-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.badge-icon {
    font-size: 1rem;
}

.badge-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--success);
    font-weight: 500;
}

/* Button Link */
.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color var(--transition-fast);
}

.btn-link:hover {
    color: var(--text-secondary);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    padding: 0 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}