/* Video Grid Layout - YouTube Style */

:root {
    --vg-gap: 16px;
    --vg-radius: 12px;
    --vg-card-bg: #fff;
    --vg-text-color: #0f0f0f;
    --vg-meta-color: #606060;
    --vg-hover-bg: #f2f2f2;
    --vg-duration-bg: rgba(0, 0, 0, 0.8);
    --vg-font-family: "Roboto", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --vg-card-bg: #0f0f0f;
        --vg-text-color: #f1f1f1;
        --vg-meta-color: #aaaaaa;
        --vg-hover-bg: #272727;
    }
}

/* Container */
.video-grid-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--vg-font-family);
}

.video-library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
}

.video-filter-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1;
}

.video-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.video-filter-field span {
    font-size: 13px;
    color: var(--vg-meta-color);
}

.video-filter-field select,
.video-filter-field input[type="search"] {
    height: 42px;
    border-radius: 8px;
    border: 1px solid #d9d9d9;
    padding: 0 12px;
    font-size: 14px;
    color: var(--vg-text-color);
    background: #fff;
}

.video-filter-field input[type="search"] {
    min-width: 280px;
}

.video-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-filter-actions button {
    height: 42px;
    border-radius: 8px;
    border: 1px solid #111;
    background: #111;
    color: #fff;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.video-filter-reset {
    color: var(--vg-meta-color);
    text-decoration: none;
    font-size: 14px;
}

.video-filter-reset:hover {
    color: var(--vg-text-color);
}

.video-track-section + .video-track-section {
    margin-top: 40px;
}

.video-track-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.video-track-title {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    color: var(--vg-text-color);
}

.video-track-count {
    color: var(--vg-meta-color);
    font-size: 14px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--vg-gap);
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 800px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .video-grid {
        grid-template-columns: 1fr;
    }

    .video-filter-field,
    .video-filter-field input[type="search"] {
        min-width: 100%;
    }

    .video-filter-actions {
        width: 100%;
    }
}

/* Card Structure */
.video-card {
    display: flex;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.video-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Thumbnail Section */
.video-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    border-radius: var(--vg-radius);
    overflow: hidden;
    background-color: #ccc;
    margin-bottom: 12px;
}

.video-thumbnail-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail-wrapper img {
    transform: scale(1.05);
}

/* Badges & Overlays */
.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: var(--vg-duration-bg);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.video-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: #cc0000;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    z-index: 2;
}

/* Info Section */
.video-info {
    display: flex;
    gap: 12px;
    padding-right: 24px; /* Space for menu dots if needed */
}

.video-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--vg-text-color);
    margin: 0 0 4px 0;
    
    /* Max 2 lines with ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta-block {
    font-size: 14px;
    color: var(--vg-meta-color);
    line-height: 1.2;
}

.video-excerpt {
    font-size: 13px;
    color: var(--vg-meta-color);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-name {
    display: block;
    margin-bottom: 2px;
}

.channel-name:hover {
    color: var(--vg-text-color);
}

.video-stats {
    display: flex;
    align-items: center;
}

.video-stats span:not(:last-child):after {
    content: "•";
    margin: 0 4px;
}

/* Pagination */
.video-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.video-pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    color: var(--vg-text-color);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.video-pagination .page-numbers.current,
.video-pagination .page-numbers:hover {
    background-color: #e5e5e5;
}

@media (prefers-color-scheme: dark) {
    .video-filter-field select,
    .video-filter-field input[type="search"] {
        background: #1d1d1d;
        border-color: #3b3b3b;
        color: #f1f1f1;
    }

    .video-filter-actions button {
        background: #f1f1f1;
        border-color: #f1f1f1;
        color: #111111;
    }

    .video-filter-reset {
        color: #aaaaaa;
    }

    .video-filter-reset:hover {
        color: #f1f1f1;
    }

    .video-pagination .page-numbers.current,
    .video-pagination .page-numbers:hover {
        background-color: #3f3f3f;
    }
}
