/* Variables */
:root {
    --primary-color: #E1306C;
    --secondary-color: #833AB4;
    --background-color: #F0F2F5;
    --card-background: rgba(255, 255, 255, 0.9);
    --text-primary: #1c1e21;
    --text-secondary: #606770;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Global Styles */
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--background-color);
    background-image: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    color: var(--text-primary); /* Default text color */
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2rem; /* Space for the fixed header */
    padding-bottom: 2rem;
}

/* Header & Navigation */
header {
    width: 100%;
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 1000;
    background-color: var(--secondary-color); /* Fallback for gradient */
    background-image: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    max-width: 1200px; /* Limit nav width */
    margin: 0 auto;
    flex-wrap: wrap; /* Allow wrapping */
}

.nav-brand {
    flex-shrink: 0;
}

.logo {
    font-size: 2.2rem; /* Adjusted for navbar */
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px var(--shadow-color);
    text-decoration: none;
    white-space: nowrap; /* Keep logo on one line */
}

.logo span {
    font-weight: 400;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 20px; /* Space between links */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: center; /* Center items when wrapped */
}

.main-nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.2s;
    font-size: 1rem;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Main Container */
.container {
    background-color: var(--card-background);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 30px var(--shadow-color);
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

p.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Input Group */
.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group .icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #ccc;
    z-index: 1; /* Ensure icon is above input */
}

#url-input {
    width: 100%;
    padding: 15px 15px 15px 50px; /* Left padding for icon */
    padding-right: 50px; /* Right padding for paste button */
    border: 1px solid #ddd;
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 1rem;
    background-color: #F7F7F7;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#url-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(225, 48, 108, 0.2);
}

#paste-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
    transition: color 0.2s;
}

#paste-btn svg {
    width: 20px;
    height: 20px;
}

#paste-btn:hover {
    color: var(--primary-color);
}

/* Download Button */
#download-btn {
    background-image: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    color: #fff;
    border: none;
    padding: 15px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-size: 1.1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

#download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* Loader */
.loader-container {
    display: none;
    margin-top: 2rem;
    text-align: center;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #fff;
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
#error-message {
    color: #D8000C;
    background-color: #FFD2D2;
    border-radius: 8px;
    padding: 10px;
    margin-top: 1.5rem;
    display: none;
    font-weight: 500;
    text-align: center;
}

/* Result Display */
#result {
    margin-top: 2rem;
    display: none;
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-background);
    box-shadow: 0 4px 20px var(--shadow-color);
}

#thumbnail {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid rgba(0,0,0,0.05); /* Separator */
}

#video-download-link {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background-color: #28a745; /* Green for download */
    color: #fff;
    padding: 15px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: background-color 0.2s;
}

#video-download-link:hover {
    background-color: #218838; /* Darker green on hover */
}

/* FAQ Section */
.faq-container {
    background: #fff;
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 30px var(--shadow-color);
    text-align: left;
    margin-top: 2rem; /* Space from main container */
}

.faq-container h2 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.faq-item {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee; /* Separator for items */
    padding-bottom: 1.5rem;
}

.faq-item:last-child {
    border-bottom: none; /* No border for the last item */
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.faq-item p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.faq-item a {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
}

.faq-item a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    margin-top: 3rem; /* More space from content */
    padding: 20px;
    color: #fff;
    font-size: 0.9rem;
    opacity: 0.9;
    text-align: center;
    width: 100%;
}
footer p {
    margin: 5px 0;
}
footer a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
footer a:hover {
    opacity: 0.7;
}

/* General Page Styles (for other pages) */
.page-content {
    background-color: var(--card-background);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 800px; /* Wider for content pages */
    box-shadow: 0 10px 30px var(--shadow-color);
    text-align: left;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 2rem; /* Space from header */
}

.page-content h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.page-content h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}

.page-content p, .page-content ul, .page-content ol {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.page-content ul, .page-content ol {
    padding-left: 20px;
}

.page-content li {
    margin-bottom: 0.5rem;
}

.page-content a {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
}

.page-content a:hover {
    text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 15px;
        padding: 10px;
    }
    .main-nav ul {
        gap: 10px;
        justify-content: center;
        width: 100%; /* Take full width for centered items */
    }
    .main-nav ul li a {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    .logo {
        font-size: 2rem;
    }
    .container, .faq-container, .page-content {
        padding: 1.5rem;
        border-radius: 15px;
    }
    h1 {
        font-size: 1.5rem;
    }
    p.subtitle {
        font-size: 0.9rem;
    }
    #download-btn {
        font-size: 1rem;
        padding: 12px 15px;
    }
    .faq-container h2, .page-content h2 {
        font-size: 1.5rem;
    }
    .faq-item h3, .page-content h3 {
        font-size: 1rem;
    }
    .faq-item p, .page-content p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .main-nav {
        padding: 8px;
    }
    .logo {
        font-size: 1.8rem;
    }
    .main-nav ul {
        flex-direction: column; /* Stack links vertically */
        align-items: center;
    }
    .main-nav ul li a {
        width: calc(100% - 20px); /* Make links span almost full width */
        text-align: center;
    }
    .container, .faq-container, .page-content {
        padding: 1rem;
        border-radius: 10px;
    }
    h1 {
        font-size: 1.3rem;
    }
    .input-group #url-input {
        padding: 12px 12px 12px 45px;
    }
    #paste-btn {
        right: 5px;
    }
    #video-download-link {
        font-size: 0.95rem;
        padding: 12px;
    }
    footer {
        font-size: 0.8rem;
        padding: 15px;
    }
}