/* ============================================
   MODERN TIKTOK DOWNLOADER UI/UX
   Mobile-First Design with Pastel Colors
   Optimized for India & Southeast Asia
   ============================================ */

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

:root {
    /* Pastel Color Palette - Light, Asian-friendly */
    --primary-light: #a8d5e2;      /* Soft Blue */
    --primary: #7eb3c2;            /* Medium Blue */
    --primary-dark: #5a9fb0;      /* Darker Blue */
    
    --accent-light: #e8c5e0;      /* Soft Purple */
    --accent: #c996b8;            /* Medium Purple */
    --accent-dark: #a8739b;      /* Darker Purple */
    
    --success: #90d4a3;           /* Soft Green */
    --warning: #f5d99c;           /* Soft Yellow */
    --error: #f5a09c;             /* Soft Red */
    
    --bg-main: #f8f9fa;           /* Light Gray */
    --bg-card: #ffffff;           /* White */
    --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #f0e8ff 50%, #fff0f5 100%);
    
    --text-primary: #2d3748;      /* Dark Gray */
    --text-secondary: #718096;    /* Medium Gray */
    --text-light: #a0aec0;       /* Light Gray */
    
    --border: #e2e8f0;           /* Light Border */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    
    /* Typography */
    --font-main: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-base: 16px;
    --line-height: 1.6;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Base Styles */
body {
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--text-primary);
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    padding: var(--spacing-sm);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* Language Switcher */
.lang-switcher {
    position: fixed;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    z-index: 1000;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.lang-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.lang-btn svg {
    width: 18px;
    height: 18px;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + var(--spacing-xs));
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    min-width: 150px;
}

.lang-switcher.active .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    width: 100%;
    padding: var(--spacing-sm);
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
    border-radius: var(--radius-sm);
}

.lang-option:hover {
    background: var(--bg-main);
}

.lang-option:first-child {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.lang-option:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Header */
.main-header {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-sm) var(--spacing-lg);
    animation: fadeInDown 0.6s ease;
}

.main-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Main Content */
.main-content {
    padding-bottom: var(--spacing-xl);
}

/* Download Section */
.download-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease 0.2s both;
}

.input-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    transition: all var(--transition-base);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(126, 179, 194, 0.1);
}

.input-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.url-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

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

.paste-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--primary-light);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--primary-dark);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

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

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    box-shadow: var(--shadow-md);
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-download {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-download:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.btn-hd {
    border-color: var(--accent);
}

.btn-hd:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.btn-mp3 {
    border-color: var(--success);
}

.btn-mp3:hover {
    border-color: var(--success);
    background: rgba(144, 212, 163, 0.2);
}

.btn-image {
    border-color: var(--warning);
}

.btn-image:hover {
    border-color: var(--warning);
    background: rgba(245, 217, 156, 0.2);
}

/* Result Section */
.result-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease;
}

.video-preview-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
}

.video-thumbnail-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto var(--spacing-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 9/16;
    background: var(--bg-main);
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.video-thumbnail-container:hover .play-overlay {
    opacity: 1;
}

.video-info {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.video-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
}

.video-author-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

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

.download-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.download-options .btn {
    width: 100%;
    min-width: 0;
}

@media (max-width: 480px) {
    .download-options {
        grid-template-columns: 1fr;
    }
}

/* Progress Bar */
.progress-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

#progressPercent {
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
}

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

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    width: 0%;
    transition: width 0.3s ease;
}

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

/* Error Message */
.error-message {
    background: var(--error);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    animation: shake 0.5s ease;
}

/* Features Section */
.features-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease 0.4s both;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.feature-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
    transition: all var(--transition-base);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.feature-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* How to Use Section */
.how-to-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease 0.6s both;
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.step-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
    position: relative;
    transition: all var(--transition-base);
}

.step-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.step-number {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto var(--spacing-md);
}

.step-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* FAQ Section */
.faq-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease 0.8s both;
}

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

.faq-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-sm);
    border: 2px solid var(--border);
    overflow: hidden;
    transition: all var(--transition-base);
}

.faq-item:hover {
    border-color: var(--primary-light);
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: inherit;
    transition: all var(--transition-fast);
}

.faq-question:hover {
    background: var(--bg-main);
}

.faq-icon {
    flex-shrink: 0;
    transition: transform var(--transition-base);
    color: var(--primary);
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base), padding var(--transition-base);
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding: 0 var(--spacing-md) var(--spacing-md);
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.875rem;
}

/* Footer */
.main-footer {
    background: var(--bg-card);
    border-top: 2px solid var(--border);
    padding: var(--spacing-lg) var(--spacing-sm);
    text-align: center;
    margin-top: var(--spacing-xl);
}

.main-footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.footer-links span {
    color: var(--text-light);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Loading Animation */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading span {
    display: none;
}

.btn.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Mobile Optimizations */
@media (max-width: 640px) {
    :root {
        --spacing-xl: 2rem;
        --spacing-lg: 1.5rem;
    }
    
    body {
        padding: var(--spacing-xs);
    }
    
    .main-title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.875rem;
    }
    
    .input-card {
        padding: var(--spacing-md);
    }
    
    .input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-icon {
        display: none;
    }
    
    .paste-btn {
        width: 100%;
        padding: var(--spacing-sm);
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .steps-container {
        grid-template-columns: 1fr;
    }
    
    .download-options {
        flex-direction: column;
    }
    
    .lang-switcher {
        top: var(--spacing-xs);
        right: var(--spacing-xs);
    }
    
    .lang-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .main-header {
        padding: var(--spacing-lg) var(--spacing-sm) var(--spacing-md);
    }
}

/* Low-end Device Optimizations */
@media (max-width: 480px) {
    .feature-card,
    .step-card {
        padding: var(--spacing-md);
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .video-thumbnail-container {
        max-width: 100%;
    }
}

/* Reduce animations for low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
