/* Main Container */
.tvd-downloader-container {
    padding: 60px 20px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    border-radius: 5px;
    border-bottom: 1px solid #f1f1f1;
    background-color: #fff;
    margin-bottom: 30px;
}

/* Title - Dark Text */
.tvd-downloader-title {
    color: #212529;
    font-weight: 700;
    font-size: 2rem;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

/* Subtitle - Medium Dark Text */
.tvd-downloader-subtitle {
    color: #495057;
    font-size: 1rem;
    margin: 0 0 15px 0;
    line-height: 1.5;
    font-weight: 400;
}

/* Form Row */
.tvd-form-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    max-width: 750px;
    margin: 0 auto;
    gap: 10px;
    flex-wrap: wrap;
}

.tvd-input-wrapper {
    position: relative;
    flex-grow: 1;
}

/* Input Field */
.tvd-url-input {
    width: 100%;
    height: 52px;
    padding: 10px 100px 10px 20px;
    font-size: 1rem;
    color: #333;
    background-color: #ffffff;
    border: 2px solid #ced4da;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tvd-url-input::placeholder {
    color: #777;
    opacity: 1;
}

.tvd-url-input:focus {
    border-color: #4285f4;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(66, 133, 244, 0.25);
}

/* Paste Button */
.tvd-paste-button {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    width: 85px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #6c757d;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tvd-paste-button:hover {
    background-color: #5c636a;
}

.tvd-paste-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Download Button */
.tvd-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    padding: 0 25px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #007bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.tvd-submit-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.tvd-submit-button:hover {
    background-color: #0b5ed7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tvd-submit-button:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(52, 168, 83, 0.3);
}

.tvd-submit-button:disabled,
.tvd-submit-button[disabled] {
    background-color: #a5d6a7;
    color: rgba(0, 0, 0, 0.4);
    cursor: not-allowed;
    box-shadow: none;
}

.tvd-submit-button:disabled svg {
    fill: rgba(0, 0, 0, 0.4);
}

/* Loading Indicator - Darker text/spinner */
.tvd-loading-indicator {
    text-align: center;
    padding: 20px 0 0 0;
    color: #555;
    /* Darker text */
    font-size: 0.95rem;
}

.tvd-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-left-color: #444;
    border-radius: 50%;
    animation: tvd-spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes tvd-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Error Message */
.tvd-error-message {
    margin: 15px auto 0;
    max-width: 750px;
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 12px 15px;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

/* --- Author Info --- */
#tvd-author-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

#tvd-author-info .tvd-author-detail {
    display: flex;
    flex-direction: column;
}

.tvd-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tvd-author-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}

/* Results Grid */
#tvd-results-container {
    max-width: 750px;
    margin: 0 auto;
    text-align: left;
}

/* Adjusted top margin */
#tvd-results-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

#tvd-results-list li.tvd-result-item {
    background-color: #ffffff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.tvd-thumbnail-wrapper {
    position: relative;
    display: block;
}

.tvd-result-thumbnail {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    margin: 0 !important;
    background-color: #f0f0f0;
}

.tvd-thumbnail-wrapper::before {
    content: attr(data-label-text);
    position: absolute;
    top: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    padding: 3px 7px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1;
    z-index: 1;
    display: none;
    max-width: calc(100% - 10px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tvd-thumbnail-wrapper[data-label-text]::before {
    display: inline-block;
}

.tvd-result-details {
    display: none;
}

/* Keep hidden */
.tvd-result-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}

.tvd-result-actions .tvd-download-button {
    display: inline-block;
    width: 100%;
    max-width: 150px;
    padding: 8px 10px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    text-align: center;
    font-size: 0.85em;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.tvd-result-actions .tvd-download-button:hover {
    background-color: #0056b3;
}

.tvd-result-actions .tvd-download-mp3 {
    background-color: #28a745;
}

.tvd-result-actions .tvd-download-mp3:hover {
    background-color: #1e7e34;
}

/* --- Responsive Styles for Grid & Author --- */
@media (max-width: 767px) {
    #tvd-results-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    #tvd-author-info {
        margin-bottom: 20px;
    }

    .tvd-author-name {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    #tvd-results-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #tvd-results-list li {
        padding: 0;
    }

    .tvd-result-actions .tvd-download-button {
        font-size: 0.8em;
        padding: 7px 8px;
    }

    #tvd-author-info {
        gap: 8px;
    }

    .tvd-author-avatar {
        width: 35px;
        height: 35px;
    }

    .tvd-author-name {
        font-size: 0.95rem;
    }
}

/* Download Other Button */
#tvd-download-other-button {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 20px auto 0;
    padding: 10px 20px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

#tvd-download-other-button:hover {
    background-color: #5a6268;
}

/* Ad Position */
.tvd-ad-position {
    margin-top: 25px;
    text-align: center;
}

/* Maintenance Message */
.tvd-downloader-container.tvd-maintenance-message {
    background-color: #f8f9fa;
    color: #6c757d;
    text-align: center;
    font-style: italic;
    box-shadow: none;
    border: 1px dashed #ced4da;
}

/* Responsive Styles */
@media (max-width: 767px) {
    .tvd-downloader-container {
        padding: 40px 15px 30px 15px;
    }

    .tvd-downloader-title {
        font-size: 1.8rem;
    }

    .tvd-downloader-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }

    .tvd-form-row {
        max-width: 100%;
        gap: 8px;
    }

    .tvd-url-input {
        height: 48px;
        padding-right: 85px;
    }

    .tvd-paste-button {
        width: 75px;
        font-size: 0.85rem;
        gap: 4px;
    }

    .tvd-paste-button svg {
        width: 14px;
        height: 14px;
    }

    .tvd-submit-button {
        height: 48px;
        padding: 0 20px;
        font-size: 1rem;
        width: 100%;
        margin-top: 10px;
    }

    .tvd-input-wrapper {
        width: 100%;
    }

    #tvd-results-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    #tvd-results-list li {
        padding: 0;
    }

    .tvd-result-thumbnail {
        margin-right: 10px;
    }

    .tvd-result-details {
        width: calc(100% - 60px);
    }

    .tvd-result-actions {
        margin-left: 0;
        justify-content: flex-start;
        gap: 8px;
    }

    .tvd-result-actions .tvd-download-button {
        padding: 5px 10px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .tvd-downloader-title {
        font-size: 1.5rem;
    }

    .tvd-downloader-subtitle {
        font-size: 0.9rem;
    }

    .tvd-form-row {
        gap: 5px;
    }

    .tvd-url-input {
        height: 45px;
        padding: 8px 80px 8px 15px;
        font-size: 0.95rem;
    }

    .tvd-paste-button {
        width: 70px;
        font-size: 0.8rem;
        height: calc(100% - 12px);
    }

    .tvd-submit-button {
        height: 45px;
        font-size: 0.95rem;
        padding: 0 15px;
    }

    .tvd-submit-button svg {
        width: 16px;
        height: 16px;
    }

    #tvd-results-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #tvd-results-list li {
        padding: 0;
    }

    .tvd-result-actions .tvd-download-button {
        font-size: 0.8em;
        padding: 7px 8px;
    }
}