/**
 * YouTube Channel Display - Frontend Styles
 */

/* Container */
.ycd-videos {
    margin: 0 auto;
    padding: 0;
}

/* Grid Layout */
.ycd-videos.ycd-layout-grid .ycd-videos-container {
    display: grid;
    gap: 24px;
}

.ycd-videos.ycd-layout-grid.ycd-columns-1 .ycd-videos-container {
    grid-template-columns: 1fr;
}

.ycd-videos.ycd-layout-grid.ycd-columns-2 .ycd-videos-container {
    grid-template-columns: repeat(2, 1fr);
}

.ycd-videos.ycd-layout-grid.ycd-columns-3 .ycd-videos-container {
    grid-template-columns: repeat(3, 1fr);
}

.ycd-videos.ycd-layout-grid.ycd-columns-4 .ycd-videos-container {
    grid-template-columns: repeat(4, 1fr);
}

.ycd-videos.ycd-layout-grid.ycd-columns-5 .ycd-videos-container {
    grid-template-columns: repeat(5, 1fr);
}

.ycd-videos.ycd-layout-grid.ycd-columns-6 .ycd-videos-container {
    grid-template-columns: repeat(6, 1fr);
}

/* List Layout */
.ycd-videos.ycd-layout-list .ycd-videos-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ycd-videos.ycd-layout-list .ycd-video-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.ycd-videos.ycd-layout-list .ycd-video-thumbnail {
    flex: 0 0 240px;
    max-width: 240px;
}

.ycd-videos.ycd-layout-list .ycd-video-info {
    flex: 1;
}

/* Video Item */
.ycd-video-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ycd-layout-grid .ycd-video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Thumbnail */
.ycd-video-thumbnail {
    position: relative;
    overflow: hidden;
    background: #000;
}

.ycd-video-thumbnail a {
    display: block;
    position: relative;
}

.ycd-video-thumbnail img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ycd-video-item:hover .ycd-video-thumbnail img {
    transform: scale(1.05);
}

/* Play Icon */
.ycd-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.ycd-video-item:hover .ycd-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.ycd-play-icon svg {
    width: 68px;
    height: 48px;
}

/* Duration Badge */
.ycd-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

/* Video Info */
.ycd-video-info {
    padding: 12px;
}

.ycd-layout-list .ycd-video-info {
    padding: 0;
}

/* Title */
.ycd-video-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.ycd-video-title a {
    color: #0f0f0f;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ycd-video-title a:hover {
    color: #065fd4;
}

/* Description */
.ycd-video-description {
    margin: 0 0 8px;
    font-size: 13px;
    color: #606060;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta Info */
.ycd-video-meta {
    font-size: 13px;
    color: #606060;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ycd-video-meta span {
    display: inline-flex;
    align-items: center;
}

.ycd-video-meta span:not(:last-child)::after {
    content: "•";
    margin-left: 6px;
}

/* Load More Button */
.ycd-load-more-wrap {
    text-align: center;
    margin-top: 24px;
}

.ycd-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: #065fd4;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ycd-load-more:hover {
    background: #0056b3;
}

.ycd-load-more:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ycd-load-more.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ycd-spin 0.8s linear infinite;
}

@keyframes ycd-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Single Video Embed */
.ycd-single-video {
    margin: 0 auto;
    max-width: 100%;
}

.ycd-single-video iframe {
    max-width: 100%;
}

/* Error & Empty States */
.ycd-error {
    padding: 16px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c00;
    font-size: 14px;
}

.ycd-no-videos {
    padding: 24px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Modal/Lightbox */
.ycd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ycd-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ycd-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    background: #000;
}

.ycd-modal-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.ycd-modal-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.ycd-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.ycd-modal-close:hover {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 1024px) {
    .ycd-videos.ycd-layout-grid.ycd-columns-5 .ycd-videos-container,
    .ycd-videos.ycd-layout-grid.ycd-columns-6 .ycd-videos-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .ycd-videos.ycd-layout-grid.ycd-columns-3 .ycd-videos-container,
    .ycd-videos.ycd-layout-grid.ycd-columns-4 .ycd-videos-container,
    .ycd-videos.ycd-layout-grid.ycd-columns-5 .ycd-videos-container,
    .ycd-videos.ycd-layout-grid.ycd-columns-6 .ycd-videos-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .ycd-videos.ycd-layout-list .ycd-video-item {
        flex-direction: column;
    }

    .ycd-videos.ycd-layout-list .ycd-video-thumbnail {
        flex: none;
        max-width: 100%;
        width: 100%;
    }

    .ycd-play-icon svg {
        width: 54px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    .ycd-videos.ycd-layout-grid .ycd-videos-container {
        grid-template-columns: 1fr !important;
    }

    .ycd-video-title {
        font-size: 14px;
    }

    .ycd-video-meta {
        font-size: 12px;
    }
}

/* Widget Specific */
.widget .ycd-videos {
    font-size: 14px;
}

.widget .ycd-video-title {
    font-size: 14px;
}

.widget .ycd-video-meta {
    font-size: 12px;
}

.widget .ycd-videos.ycd-layout-list .ycd-video-thumbnail {
    flex: 0 0 120px;
    max-width: 120px;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .ycd-video-item {
        background: #1a1a1a;
    }

    .ycd-video-title a {
        color: #f1f1f1;
    }

    .ycd-video-title a:hover {
        color: #3ea6ff;
    }

    .ycd-video-description,
    .ycd-video-meta {
        color: #aaa;
    }
}

/* Theme Compatibility */
.ycd-video-thumbnail a,
.ycd-video-title a {
    box-shadow: none !important;
    border: none !important;
}

.ycd-video-thumbnail a:hover,
.ycd-video-title a:hover {
    box-shadow: none !important;
}
