.downloader-container {
    max-width: 800px;
    margin: 0 auto;
}

.input-bar {
    position: relative;
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.link_bar {
    display: flex;
    position: relative;
    width: 100%;
}

.link_bar .form-control {
    flex-grow: 1;
    font-size: 1.1rem;
    padding: 1rem 2.8rem 1rem 3.5rem;
}

.link_bar>i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--text-color-light);
}

.link_bar .clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-color-light);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.link_bar .form-control:not(:placeholder-shown)+.clear-btn {
    opacity: 1;
}

.loading-container {
    text-align: center;
    padding: 3rem 0;
}

.error-message {
    text-align: center;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 1rem;
    border-radius: 8px;
}

.results-area {
    margin-top: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    animation: fadeIn 0.5s;
}

.video-info-card {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
}

.video-info-card .thumbnail {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.video-details h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.video-details p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-color-light);
}

.formats-table {
    padding: 0;
}

.formats-table table {
    width: 100%;
    border-collapse: collapse;
}

.formats-table th, .formats-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.formats-table tr:last-child td {
    border-bottom: none;
}

.formats-table th {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color-light);
}

.formats-table td .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.download-section {
    padding: 1.5rem;
    text-align: center;
}


/* @media screen and (max-width:480px) {
    .input-bar {
        flex-direction: column;
        margin: 0;
    }

    .video-info-card{
        flex-direction: column;
    }
} */


/* --- THE RESPONSIVE FIX STARTS HERE --- */

@media screen and (max-width: 768px) {
    .video-info-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Hide the table header on small screens */
    .formats-table thead {
        display: none;
    }

    /* Make table and its elements behave like blocks */
    .formats-table, .formats-table tbody, .formats-table tr, .formats-table td {
        display: block;
        width: 100%;
    }

    .formats-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--card-border);
        border-radius: 8px;
        padding: 1rem;
    }
    
    .formats-table td {
        display: flex;
        align-items: center;
        padding: 0.75rem 0;
        border-bottom: none; /* Remove original borders */
        border-top: 1px solid var(--card-border);
    }
    .formats-table tr td:first-child {
        border-top: none;
    }

    .video-info-card .thumbnail{
        width: 100%;
        height: 100%;
    }
    
    /* Add labels using ::before pseudo-element */
    .formats-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-color-light);
        margin-right: 1rem;
    }
    
    .formats-table td:last-child {
        justify-content: center; /* Center the download button */
    }
    
    .formats-table td:last-child::before {
        display: none; /* No label for the download button cell */
    }
    
    .formats-table td .btn {
        width: 100%;
    }
}


@media screen and (max-width:480px) {
    .input-bar {
        flex-direction: column;
    }
    .link_bar .clear-btn {
        right: 15px; /* Adjust clear button position */
    }
}