/* General Styles */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
    overflow: hidden;
    padding: 0 20px;
}

header {
    background: #ffffff;
    color: #333;
    padding: 15px 0;
    min-height: 70px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 1000; /* Ensure header is above other content */
}

header a {
    color: #333;
    text-decoration: none;
    font-size: 16px;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: auto;
}

header .logo {
    font-size: 28px;
    font-weight: bold;
    color: #1877f2; /* Example prominent color */
}

/* Language Switcher Dropdown */
.lang-switcher .dropdown {
    position: relative;
    display: inline-block;
}

.lang-switcher .dropdown-toggle {
    background-color: #f0f2f5;
    color: #333;
    padding: 8px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.lang-switcher .dropdown-toggle:hover {
    background-color: #e9ebee;
}

.lang-switcher .dropdown-menu {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 100px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    padding: 5px 0;
    right: 0; /* Align to the right of the button */
}

.lang-switcher .dropdown-menu a {
    color: black;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    text-transform: none; 
}

.lang-switcher .dropdown-menu a:hover {
    background-color: #f1f1f1;
}

.lang-switcher .dropdown:hover .dropdown-menu {
    display: block;
}


/* Hero Section - More Prominent */
.hero {
    background: linear-gradient(135deg, #1877f2 0%, #3b5998 100%); 
    color: #fff;
    padding: 70px 20px; /* Adjusted padding */
    text-align: center;
    /* border-radius: 0 0 12px 12px; */ /* Removed bottom radius for seamless transition */
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.hero h1 {
    font-size: 42px; /* Adjusted font size */
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.hero p {
    font-size: 20px; /* Adjusted font size */
    margin-bottom: 30px; /* Adjusted margin */
    font-weight: 300;
}

#download-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.input-container {
    position: relative;
    display: inline-block;
    width: 55%; /* Adjusted width */
    max-width: 550px; /* Adjusted max-width */
}

#download-form input[type="text"] {
    padding: 16px 50px 16px 22px; /* Adjusted padding to make room for clear button */
    font-size: 17px; /* Adjusted font size */
    width: 100%;
    border: 2px solid transparent; 
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0; /* Reduced padding */
    font-size: 16px; /* Fixed font size for 'x' */
    width: 24px; /* Fixed width */
    height: 24px; /* Fixed height */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 10; /* Ensure it's above the input */
}

.clear-btn:hover {
    color: #666;
    background-color: transparent; /* No background on hover */
}

.clear-btn.show {
    opacity: 1;
    visibility: visible;
}

#download-form input[type="text"] {
    padding: 16px 36px 16px 22px; /* Adjusted padding to make room for smaller clear button */
    font-size: 17px; /* Adjusted font size */
    width: 100%;
    border: 2px solid transparent; 
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

#download-form input[type="text"]:focus {
    border-color: #fff; 
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5); 
    outline: none;
}


#download-form button {
    padding: 16px 28px; /* Adjusted padding */
    font-size: 17px; /* Adjusted font size */
    background-color: #ff6b6b; 
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#download-form button:hover {
    background-color: #ff4757;
    transform: translateY(-2px);
}

/* Loading Spinner & Messages */
.loader-container {
    display: flex;
    flex-direction: column; /* Stack spinner and text */
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    text-align: center;
}

.spinner {
    border: 5px solid #f3f3f3; 
    border-top: 5px solid #ff6b6b; 
    border-radius: 50%;
    width: 40px; /* Adjusted size */
    height: 40px; /* Adjusted size */
    animation: spin 1s linear infinite;
    margin-bottom: 15px; /* Space between spinner and text */
}

.loader-container p {
    font-size: 18px;
    color: #555;
}

.error-message {
    color: red;
    text-align: center;
    font-size: 18px;
    padding: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Area Styling */
#results {
    padding: 20px 0; /* Reduced top padding */
    background-color: #ffffff;
    margin: 20px auto; /* Centered with margin */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 900px; /* Limit width for better readability */
}

/* Video Info Card */
.video-info-card {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    padding: 25px;
    gap: 20px; /* Space between thumbnail and details */
    border-bottom: 1px solid #e9ebee; /* Separator */
    margin-bottom: 20px;
}

.video-thumbnail {
    width: 200px; /* Fixed width for thumbnail */
    height: auto;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.video-details {
    flex-grow: 1; /* Allow details to take remaining space */
    text-align: left;
}

.video-title {
    font-size: 22px; /* Adjusted font size */
    color: #1c1e21; /* Darker title color */
    margin-top: 0;
    margin-bottom: 8px;
    font-weight: 600;
}

.video-uploader, .video-duration {
    font-size: 15px; /* Adjusted font size */
    color: #606770; /* Softer color for meta details */
    margin-bottom: 5px;
}

/* Formats Table Container */
.formats-table-container {
    padding: 0 25px 25px; /* Padding around the table */
}

.formats-table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: none; /* Remove individual table shadow if container has one */
}

.formats-table th, .formats-table td {
    border: 1px solid #e9ebee;
    padding: 12px 15px;
    text-align: left;
    font-size: 15px; /* Consistent font size */
}

.formats-table th {
    background-color: #f5f6f7; /* Lighter header for table */
    font-weight: 600;
    color: #4b4f56;
}

.formats-table tbody tr:nth-child(even) {
    background-color: #fcfcfc; /* Very light even row color */
}

.formats-table tbody tr:hover {
    background-color: #f0f2f5;
}

.download-format-button {
    background-color: #28a745; 
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.download-format-button:hover {
    background-color: #218838;
    transform: scale(1.05);
}

.download-format-button:disabled,
.download-format-button.error {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}
.download-format-button.error {
    background-color: #dc3545; /* Red for error state */
}


/* Sections */
section:not(.hero) { /* Apply to sections other than hero */
    padding: 50px 20px;
    text-align: center;
    background-color: #ffffff; /* Default white background for other sections */
    margin-bottom: 20px; /* Space between sections */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
section.how-to {
    background-color: #f0f2f5; /* Specific background for how-to */
}

section h2 {
    font-size: 30px; /* Adjusted font size */
    margin-bottom: 35px; /* Adjusted margin */
    color: #1c1e21;
    font-weight: 600;
}

.features {
    /* background: #ffffff; */ /* Already handled by general section style */
    padding-top: 50px;
    padding-bottom: 50px;
}

.features .feature-item {
    display: inline-block; 
    width: calc(25% - 40px); 
    margin: 15px;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    vertical-align: top;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.features .feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
}

.features .feature-item h3 {
    font-size: 20px; /* Adjusted font size */
    margin-bottom: 10px;
    color: #1877f2;
}

.how-to ol {
    list-style-type: none; /* Remove default list style */
    padding-left: 0;
    max-width: 700px;
    margin: 0 auto;
    text-align: left;
}

.how-to li {
    margin-bottom: 15px; /* Increased margin */
    font-size: 17px; /* Adjusted font size */
    padding-left: 30px; /* Space for custom bullet */
    position: relative;
}

.how-to li::before {
    content: "\2714"; /* Checkmark, or use a number with counter-reset/increment */
    color: #1877f2;
    position: absolute;
    left: 0px;
    font-weight: bold;
    font-size: 18px;
}

.faq div {
    max-width: 800px;
    margin: 0 auto 20px auto;
    text-align: left;
    padding: 20px;
    background: #f9f9f9;
    border-left: 4px solid #1877f2; /* Thinner border */
    border-radius: 0 6px 6px 0;
}

.faq h3 {
    font-size: 18px; /* Adjusted font size */
    margin-bottom: 8px;
    color: #1c1e21;
}

/* Footer */
footer {
    background: #343a40; /* Darker footer */
    color: #adb5bd; /* Lighter text for footer */
    text-align: center;
    padding: 30px 0;
    margin-top: 30px;
}

footer p {
    margin: 8px 0;
    font-size: 14px;
}

footer a {
    color: #1877f2;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
    color: #4a90e2;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    .features .feature-item {
        width: calc(50% - 30px); /* 2 items per row, adjusted margin */
    }
    .video-info-card {
        flex-direction: column; /* Stack thumbnail and details */
        align-items: center; /* Center items when stacked */
        text-align: center;
    }
    .video-thumbnail {
        margin-bottom: 15px;
        width: 80%;
        max-width: 280px;
    }
    .video-details {
        text-align: center;
    }
}

@media (max-width: 768px) {
    header nav {
        flex-direction: column;
        text-align: center;
    }

    header .logo {
        margin-bottom: 15px;
    }

    header .lang-switcher {
        margin-top: 10px;
    }
    .lang-switcher .dropdown-menu {
        left: 50%;
        transform: translateX(-50%);
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero p {
        font-size: 17px;
    }

    #download-form {
        flex-direction: column;
    }

    #download-form input[type="text"] {
        width: 100%;
        max-width: none;
        margin-bottom: 10px;
        margin-right: 0;
        text-align: center;
    }

    .input-container {
        width: 85%;
        max-width: none;
    }

    #download-form button {
        /*width: 85%;*/
        max-width: 300px;
    }

    .features .feature-item {
        width: calc(100% - 40px); 
        margin: 15px auto;
        display: block;
    }

    section:not(.hero) h2 {
        font-size: 26px;
    }

    .how-to ol {
        padding: 0 15px;
    }
    .formats-table th, .formats-table td {
        font-size: 13px;
        padding: 10px 8px;
    }
    .download-format-button {
        padding: 7px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 26px;
    }
    .hero p {
        font-size: 15px;
    }
    #download-form input[type="text"],
    #download-form button {
        font-size: 15px;
        padding: 14px;
    }
    section:not(.hero) h2 {
        font-size: 22px;
    }
    .features .feature-item h3 {
        font-size: 18px;
    }
    .how-to li, .faq p, .faq h3 {
        font-size: 15px;
    }
     .formats-table th, .formats-table td {
        font-size: 11px;
        padding: 8px 5px;
    }
    .download-format-button {
        padding: 6px 8px;
        font-size: 11px;
    }
    .video-title {
        font-size: 18px;
    }
    .video-uploader, .video-duration {
        font-size: 13px;
    }
}

