/**
 * Frontend Styles for YouTube Video Grid
 * 
 * @package YT_Video_Grid
 */

/* ===========================
   Video Grid Container
   =========================== */
.yt-video-grid-wrapper {
    margin: 30px 0;
    width: 100%;
}

.yt-video-grid {
    display: grid;
    gap: 30px;
    width: 100%;
}

/* Grid Column Variations */
.yt-video-grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.yt-video-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.yt-video-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.yt-video-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.yt-video-grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.yt-video-grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* ===========================
   Video Card
   =========================== */
.yt-video-card {
    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;
}

.yt-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ===========================
   Video Thumbnail
   =========================== */
.yt-video-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    overflow: hidden;
}

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

.yt-video-card:hover .yt-video-thumbnail {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Play Overlay */
.yt-video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.yt-video-card:hover .yt-video-play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.yt-play-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.yt-video-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* ===========================
   Video Content
   =========================== */
.yt-video-content {
    padding: 20px;
}

.yt-video-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-video-date {
    font-size: 14px;
    color: #666;
}

.yt-video-date time {
    display: inline-block;
}

/* ===========================
   Empty State
   =========================== */
.yt-video-grid-empty {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.yt-video-grid-empty p {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* ===========================
   Pagination Wrapper
   =========================== */
.yt-video-pagination {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

/* ===========================
   Numbered Pagination
   =========================== */
.yt-pagination-numbers ul {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.yt-pagination-numbers li {
    margin: 0;
}

.yt-pagination-numbers a,
.yt-pagination-numbers span {
    display: inline-block;
    padding: 10px 16px;
    min-width: 44px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.yt-pagination-numbers a:hover {
    background: #f0f0f0;
    border-color: #999;
}

.yt-pagination-numbers .current {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
    font-weight: 600;
}

.yt-pagination-numbers .dots {
    border: none;
    background: transparent;
    padding: 10px 8px;
}

/* ===========================
   Previous/Next Pagination
   =========================== */
.yt-pagination-prev-next {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.yt-pagination-prev,
.yt-pagination-next {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.yt-pagination-prev:hover,
.yt-pagination-next:hover {
    background: #005a87;
}

.yt-pagination-prev .arrow,
.yt-pagination-next .arrow {
    font-size: 18px;
}

.yt-pagination-info {
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
}

/* ===========================
   Load More Pagination
   =========================== */
.yt-pagination-load-more {
    text-align: center;
}

.yt-load-more-btn {
    display: inline-block;
    padding: 14px 32px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-bottom: 15px;
}

.yt-load-more-btn:hover:not(:disabled) {
    background: #005a87;
}

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

.yt-load-more-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.yt-load-more-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: yt-spin 0.8s linear infinite;
}

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

/* ===========================
   Video Lightbox Modal
   =========================== */
.yt-video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    padding: 20px;
    overflow: auto;
}

.yt-video-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-video-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.yt-video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 1;
    z-index: 10;
    transition: opacity 0.2s;
}

.yt-video-modal-close:hover {
    opacity: 0.7;
}

.yt-video-modal-iframe-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
}

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

/* ===========================
   Responsive Design
   =========================== */

/* Tablet (768px - 1024px) */
@media screen and (max-width: 1024px) {
    .yt-video-grid-cols-4,
    .yt-video-grid-cols-5,
    .yt-video-grid-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .yt-video-grid {
        gap: 24px;
    }
}

/* Mobile (max 767px) */
@media screen and (max-width: 767px) {
    .yt-video-grid-wrapper {
        margin: 20px 0;
    }
    
    .yt-video-grid-cols-2,
    .yt-video-grid-cols-3,
    .yt-video-grid-cols-4,
    .yt-video-grid-cols-5,
    .yt-video-grid-cols-6 {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .yt-video-grid {
        gap: 20px;
    }
    
    .yt-video-title {
        font-size: 16px;
    }
    
    .yt-video-content {
        padding: 16px;
    }
    
    /* Pagination Adjustments */
    .yt-video-pagination {
        margin-top: 30px;
        padding-top: 20px;
    }
    
    .yt-pagination-numbers a,
    .yt-pagination-numbers span {
        padding: 8px 12px;
        min-width: 38px;
        font-size: 14px;
    }
    
    .yt-pagination-prev-next {
        flex-direction: column;
        gap: 12px;
    }
    
    .yt-pagination-prev,
    .yt-pagination-next {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
    
    .yt-load-more-btn {
        width: 100%;
        padding: 12px 24px;
    }
    
    /* Modal Adjustments */
    .yt-video-modal {
        padding: 10px;
    }
    
    .yt-video-modal-close {
        top: -35px;
        font-size: 28px;
    }
}

/* Small Mobile (max 480px) */
@media screen and (max-width: 480px) {
    .yt-pagination-numbers ul {
        gap: 4px;
    }
    
    .yt-pagination-numbers a,
    .yt-pagination-numbers span {
        padding: 6px 10px;
        min-width: 34px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .yt-video-play-overlay,
    .yt-video-pagination {
        display: none;
    }
}
