/**
 * YouTube Grid Feed - Complete Frontend Styles
 * Includes all original styles plus improved hover effects
 */

/* Container */
.youtube-grid-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* Error and Empty States */
.youtube-grid-error,
.youtube-grid-empty {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #6c757d;
    font-style: italic;
}

.youtube-grid-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Hero Video Styles */
.youtube-hero {
    margin-bottom: 30px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.youtube-hero:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.youtube-hero-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.youtube-hero-thumbnail {
    flex: 0 0 60%;
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.youtube-hero-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: scale(1);
}

.youtube-hero-info {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.youtube-hero-title {
    margin: 0 0 15px 0;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youtube-hero-title a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
}

.youtube-hero-title a:hover {
    color: #ff0000;
}

.youtube-hero-description {
    margin-bottom: 15px;
    color: #666;
    line-height: 1.5;
    font-size: 0.95em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youtube-hero-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: #999;
}

/* Grid Styles */
.youtube-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--row-gap, 20px) var(--col-gap, 20px);
    margin: 0;
}

.youtube-video-item {
    flex: 1 1 calc((100% - (var(--col-gap, 20px) * (var(--columns, 3) - 1))) / var(--columns, 3));
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.youtube-video-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.youtube-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.youtube-thumbnail img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: scale(1);
}

/* Play Overlay */
.youtube-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.youtube-thumbnail:hover .youtube-play-overlay,
.youtube-hero-thumbnail:hover .youtube-play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.youtube-hero-thumbnail .youtube-play-overlay svg {
    width: 68px;
    height: 48px;
}

.youtube-thumbnail .youtube-play-overlay svg {
    width: 48px;
    height: 34px;
}

/* Video Info */
.youtube-video-info {
    padding: 15px;
}

.youtube-video-title {
    margin: 0 0 10px 0;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youtube-video-title a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
}

.youtube-video-title a:hover {
    color: #ff0000;
}

.youtube-video-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
    font-size: 0.8em;
    color: #999;
}

.youtube-author {
    font-weight: 500;
    color: #666;
}

.youtube-date {
    color: #999;
}

.youtube-video-description {
    font-size: 0.85em;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hover Effects with Smooth Transitions */
.thumbnail-hover-zoom .youtube-thumbnail:hover img,
.thumbnail-hover-zoom .youtube-hero-thumbnail:hover img {
    transform: scale(1.05);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumbnail-hover-zoom-out .youtube-thumbnail img,
.thumbnail-hover-zoom-out .youtube-hero-thumbnail img {
    transform: scale(1.05);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumbnail-hover-zoom-out .youtube-thumbnail:hover img,
.thumbnail-hover-zoom-out .youtube-hero-thumbnail:hover img {
    transform: scale(1);
}

.thumbnail-hover-none .youtube-thumbnail:hover img,
.thumbnail-hover-none .youtube-hero-thumbnail:hover img {
    transform: none;
    transition: none;
}

/* Lazy Loading */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Lightbox Integration */
.has-lightbox .youtube-lightbox-trigger {
    cursor: pointer;
}

.has-lightbox .youtube-lightbox-trigger:hover {
    text-decoration: none;
}

/* Accessibility */
.youtube-video-item:focus-within,
.youtube-hero:focus-within {
    outline: 2px solid #ff0000;
    outline-offset: 2px;
    transition: outline-offset 0.2s ease;
}

.youtube-video-title a:focus,
.youtube-hero-title a:focus {
    outline: 2px solid #ff0000;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Loading States */
.youtube-grid-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.youtube-grid-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .youtube-grid {
        --columns: 2 !important;
        --col-gap: 15px;
        --row-gap: 15px;
    }
    
    .youtube-hero-content {
        flex-direction: column;
        gap: 0;
    }
    
    .youtube-hero-thumbnail {
        flex: none;
    }
    
    .youtube-hero-info {
        padding: 15px;
    }
    
    .youtube-hero-title {
        font-size: 1.2em;
    }
    
    .youtube-video-info {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .youtube-grid {
        --columns: 1 !important;
        --col-gap: 0px;
        --row-gap: 15px;
    }
    
    .youtube-hero-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .youtube-video-meta {
        gap: 3px;
    }
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    .youtube-thumbnail img,
    .youtube-hero-thumbnail img,
    .youtube-play-overlay,
    .youtube-video-item,
    .youtube-hero,
    .youtube-video-title a,
    .youtube-hero-title a,
    .lazy-load {
        transition: none;
    }
    
    .thumbnail-hover-zoom .youtube-thumbnail:hover img,
    .thumbnail-hover-zoom .youtube-hero-thumbnail:hover img,
    .thumbnail-hover-zoom-out .youtube-thumbnail img,
    .thumbnail-hover-zoom-out .youtube-hero-thumbnail img {
        transform: none;
    }
    
    .youtube-grid-loading::after {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .youtube-play-overlay {
        display: none;
    }
    
    .youtube-video-item,
    .youtube-hero {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .youtube-video-item:hover,
    .youtube-hero:hover {
        transform: none;
        box-shadow: none;
    }
}