/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1d9bf0;
    --primary-dark: #1a8cd8;
    --text: #0f1419;
    --text-light: #536471;
    --bg: #ffffff;
    --bg-secondary: #f7f9f9;
    --border: #eff3f4;
    --error: #f4212e;
    --success: #00ba7c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: 0.2s ease;
    --error-bg: #fff1f2;
    --error-border: #ffe4e6;
}

/* Dark mode colors */
[data-theme="dark"] {
    --primary: #1d9bf0;
    --primary-dark: #1a8cd8;
    --text: #e7e9ea;
    --text-light: #8b98a5;
    --bg: #000000;
    --bg-secondary: #0a0a0a;
    --border: #2f3336;
    --error: #f4212e;
    --success: #00ba7c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.7);
    --error-bg: #200a0a;
    --error-border: #3a1515;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition), color var(--transition);
    padding-bottom: 100px;
}

/* ========================================
   Layout
   ======================================== */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: #1d9bf0;
    flex-shrink: 0;
}

/* ========================================
   Input Section
   ======================================== */
.input-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.url-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    transition: border-color var(--transition);
    outline: none;
    margin-bottom: 1rem;
}

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

.url-input:focus {
    border-color: var(--primary);
}

.download-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color var(--transition), transform var(--transition);
}

.download-btn:hover {
    background: var(--primary-dark);
    /* transform: translateY(-1px); */
}

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

.download-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   Loading Spinner
   ======================================== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-spinner p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ========================================
   Error Message
   ======================================== */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 8px;
    color: var(--error);
    font-size: 0.95rem;
    margin-top: 1rem;
}

.error-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ========================================
   Video Preview
   ======================================== */
.video-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

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

.video-container {
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    margin-bottom: 1.5rem;
}

.video-container video {
    width: 100%;
    display: block;
    max-height: 500px;
}

.video-info {
    margin-bottom: 1.5rem;
}

.video-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.video-author {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ========================================
   Quality Options
   ======================================== */
.quality-options h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.quality-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.quality-btn {
    padding: 0.625rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.quality-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-light);
    font-size: 0.9rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.footer-text {
    margin: 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

.heart {
    color: #e74c3c;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(1.1); }
    20%, 40% { transform: scale(1); }
}

.footer-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

.footer-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.social-link {
    color: var(--text-light);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    transition: all var(--transition);
    opacity: 0.7;
}

.social-link:hover {
    color: var(--text);
    opacity: 1;
    /* transform: translateY(-2px); */
}

.social-link svg {
    flex-shrink: 0;
}

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

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

    .input-section,
    .video-preview {
        padding: 1.5rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .quality-buttons {
        flex-direction: column;
    }

    .quality-btn {
        width: 100%;
    }

    .footer-content {
        gap: 0.5rem;
    }

    .footer-text {
        font-size: 0.8rem;
    }

    .social-link {
        padding: 0.375rem;
    }

    .social-link svg {
        width: 18px;
        height: 18px;
    }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-preview:not(.hidden) {
    animation: fadeIn 0.3s ease;
}
