/* UI/UX Pro Style Guidelines Implementation */
:root {
    /* Color Palette (#0a0a0f background, #6c63ff accent, e0e0e0 text) */
    --bg-main: #0a0a0f;
    --bg-card: #15151e;
    --bg-input: #1f1f2e;
    
    --accent-primary: #6c63ff;
    --accent-hover: #5b54d6;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #666677;

    --border-color: #2a2a3c;
    
    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition-fast: 0.2s ease;
}

/* Accessibility & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* UI/UX Pro: Focus states */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.logo i {
    color: var(--accent-primary);
    font-size: 1.5rem;
}

.navbar nav {
    display: flex;
    gap: 1.5rem;
}

.navbar nav a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Hero Section */
.hero {
    padding: 5rem 0 3rem;
    text-align: center;
    background: radial-gradient(circle at top center, rgba(108, 99, 255, 0.15) 0%, rgba(10, 10, 15, 0) 50%);
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero h1 span {
    color: var(--accent-primary);
}

.hero p {
    color: var(--text-secondary);
    font-size: clamp(1rem, 2vw, 1.125rem);
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* Downloader Card */
.downloader-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.input-group:focus-within {
    border-color: var(--accent-primary);
}

.platform-icon {
    padding: 0 1.2rem;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.platform-icon.tiktok { color: #fff; }
.platform-icon.instagram { color: #E1306C; }
.platform-icon.youtube { color: #FF0000; }

#videoUrl {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.125rem;
    padding: 1.2rem 0;
    outline: none;
}

#videoUrl::placeholder {
    color: var(--text-muted);
}

.btn-clear {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0 1.2rem;
    cursor: pointer;
    font-size: 1.2rem;
}
.btn-clear:hover { color: var(--text-primary); }

.options-group {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

.options-group label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

select {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

/* UI/UX Pro: Touch Targets (min 44px) */
.btn-primary, .btn-success, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 50px;
}

#btnDownload {
    width: 100%;
    margin-top: 1.5rem;
    background-color: var(--accent-primary);
    color: white;
}

#btnDownload:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

#btnDownload:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results & Feedback */
.result-container {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.progress-wrapper {
    margin-bottom: 1.5rem;
}

.progress-status {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-align: left;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--accent-primary);
    transition: width 0.3s ease;
}

.download-card {
    display: flex;
    gap: 1.5rem;
    background-color: var(--bg-input);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: left;
}

.video-thumbnail {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    background-color: #000;
}

.video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.video-info h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.download-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-success {
    background-color: var(--accent-success);
    color: white;
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
}
.btn-success:hover { background-color: #0d9668; }

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
}
.btn-secondary:hover { background-color: var(--border-color); }

.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

/* Layout Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin-top: 4rem;
}

/* Benefits Section */
.benefits h2, .faq h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.features {
    display: grid;
    gap: 2rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.feature-item i {
    font-size: 2rem;
    color: var(--accent-primary);
}

.feature-item h3 {
    font-size: 1.25rem;
}

.feature-item p {
    color: var(--text-secondary);
}

/* Sidebar History */
.history-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.history-widget h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.history-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    background-color: var(--bg-input);
}

.history-details {
    flex: 1;
    overflow: hidden;
}

.history-details p {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Skeleton loader for history */
.skeleton-loader {
    width: 100%;
    height: 60px;
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-color) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 6px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* FAQ Accordion */
.faq {
    margin-top: 4rem;
    margin-bottom: 4rem;
    max-width: 800px;
}

.accordion details {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.accordion summary {
    padding: 1.5rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none; /* Hide default arrow */
    position: relative;
    padding-right: 3rem;
}

.accordion summary::-webkit-details-marker {
    display: none;
}

.accordion summary::after {
    content: "\F282"; /* Bootstrap icon chevron-down */
    font-family: "bootstrap-icons";
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.accordion details[open] summary::after {
    transform: rotate(180deg);
}

.accordion p {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    background-color: rgba(10, 10, 15, 0.5);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
}

.legal-links {
    display: flex;
    gap: 1.5rem;
}

.legal-links a {
    color: var(--text-muted);
}
.legal-links a:hover { color: var(--text-secondary); }

/* Responsive adjustments */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .hero {
        padding: 3rem 0;
    }

    .download-card {
        flex-direction: column;
    }

    .video-thumbnail {
        width: 100%;
        height: 200px;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}
