/* Video Library Container */
.video-library-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.video-library-header {
    text-align: center;
    margin-bottom: 50px;
}

.video-library-header .page-title {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #333;
}

.video-library-header .page-description {
    font-size: 1.1em;
    color: #666;
}

/* Video Grid */
.video-library-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 3rem 2rem;
}

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

@media (max-width: 576px) {
    .video-library-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Video Card */
.video-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

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

/* Video Thumbnail */
.video-card-thumbnail {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
}

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

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

/* Play Overlay */
.video-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-card:hover .video-card-overlay {
    opacity: 1;
}

.play-icon {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.video-card:hover .play-icon {
    transform: scale(1.1);
}

/* Video Content */
.video-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-card-title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 12px 0;
    line-height: 1.4;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.video-author {
    font-weight: 600;
    color: #444;
}

.video-date {
    color: #999;
}

.video-date::before {
    content: "•";
    margin-right: 12px;
}

.video-card-description {
    font-size: 0.9em;
    color: #666;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Load More Section */
.video-library-load-more {
    text-align: center;
    margin-top: 50px;
}

.load-more-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 15px 50px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.load-more-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

.spinner-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* No Videos Message */
.no-videos {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.1em;
}

/* ============================================
   CUSTOM VIDEO MODAL
   ============================================ */

/* Modal Overlay */
.video-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.98);
    z-index: 9999;
    overflow: hidden;
}

.video-modal-overlay.active {
    display: block;
}

/* Modal Container */
.video-modal {
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #fff;
}

/* Header */
.video-modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 20px 40px;
    z-index: 10001;
}

.video-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 10px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.video-modal-close:hover {
    transform: scale(1.2);
}

/* Main Content Area */
.video-modal-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px 20px;
    position: relative;
    overflow: hidden;
}

/* Navigation Arrows */
.video-modal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.video-modal-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.video-modal-arrow.hidden {
    opacity: 0;
    pointer-events: none;
}

.video-modal-arrow.prev {
    left: 10px;
}

.video-modal-arrow.next {
    right: 10px;
}

.video-modal-arrow svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

/* Video and Description Container */
.video-modal-main {
    display: flex;
    width: 100%;
    gap: 30px;
    align-items: flex-start; /* Changed from stretch */
}

/* Video Area (70%) */
.video-modal-video-area {
    flex: 0 0 70%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.video-modal-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
}

.video-modal-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-modal-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    padding: 40px;
    text-align: center;
}

.video-modal-video-overlay:hover {
    background: rgba(0, 0, 0, 0.85);
}

.video-modal-overlay-author {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.video-modal-overlay-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    line-height: 1.4;
    max-width: 600px;
}

.video-modal-play-icon {
    width: 80px;
    height: 80px;
    transition: transform 0.3s ease;
}

.video-modal-video-overlay:hover .video-modal-play-icon {
    transform: scale(1.1);
}

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

/* Description Area (30%) - Height set by JavaScript */
.video-modal-description {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px; /* Minimum height for very short videos */
}

.video-modal-description-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.video-modal-description h3 {
    color: #fff;
    font-size: 20px;
    margin: 0 0 15px 0;
    line-height: 1.4;
}

.video-modal-meta {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
}

.video-modal-meta span {
    margin-right: 15px;
}

.video-modal-description p {
    font-size: 15px;
    line-height: 1.7;
    color: #ccc;
    white-space: pre-line;
}

/* Scrollbar for description */
.video-modal-description-content::-webkit-scrollbar {
    width: 8px;
}

.video-modal-description-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.video-modal-description-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.video-modal-description-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Footer Thumbnail Carousel */
.video-modal-footer {
    padding: 0;
    display: none;
}

@media (min-width: 1024px) {
    .video-modal-footer {
        display: block;
    }
}

.video-modal-carousel {
    position: relative;
    width: 100%;
}

.video-modal-carousel-track {
    overflow: hidden;
    padding: 0 50px;
}

.video-modal-carousel-items {
    display: flex;
    gap: 0;
    transition: transform 0.4s ease;
}

.video-modal-thumbnail {
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

/* 16:9 aspect ratio for thumbnails */
.video-modal-thumbnail::before {
    content: '';
    display: block;
    padding-bottom: 56.25%; /* 16:9 */
}

.video-modal-thumbnail.active {
    border-color: #0073aa;
}

.video-modal-thumbnail:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.video-modal-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-modal-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 10px;
    text-align: center;
}

.video-modal-thumbnail:hover .video-modal-thumbnail-overlay {
    opacity: 1;
}

.video-modal-thumbnail-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-modal-thumbnail-play {
    width: 30px;
    height: 30px;
}

/* Carousel Arrows */
.video-modal-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.video-modal-carousel-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-modal-carousel-arrow.hidden {
    opacity: 0;
    pointer-events: none;
}

.video-modal-carousel-arrow.prev {
    left: 0;
}

.video-modal-carousel-arrow.next {
    right: 0;
}

.video-modal-carousel-arrow svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Mobile Adjustments */
@media (max-width: 1023px) {
    .video-modal-header {
        padding: 15px 20px;
    }
    
    .video-modal-content {
        padding: 0 15px 20px;
        align-items: flex-start;
    }
    
    .video-modal-main {
        flex-direction: column;
        gap: 20px;
        width: 100%;
    }
    
    .video-modal-video-area,
    .video-modal-description {
        flex: 0 0 100%;
        width: 100%;
    }
    
    /* Override JS height setting on mobile */
    .video-modal-description {
        height: auto !important;
        max-height: 300px;
        min-height: auto;
    }
    
    .video-modal-video-container {
        width: 100%;
        padding-bottom: 56.25%;
    }
    
    .video-modal-arrow {
        width: 40px;
        height: 40px;
    }
    
    .video-modal-arrow.prev {
        left: 5px;
    }
    
    .video-modal-arrow.next {
        right: 5px;
    }
}

/* Shortcode Column Support */
.video-library-shortcode .video-library-grid.columns-1 {
    grid-template-columns: 1fr;
}

.video-library-shortcode .video-library-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.video-library-shortcode .video-library-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.video-library-shortcode .video-library-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
    .video-library-shortcode .video-library-grid.columns-3,
    .video-library-shortcode .video-library-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .video-library-shortcode .video-library-grid {
        grid-template-columns: 1fr !important;
    }
}

.video-library-shortcode {
    margin: 40px 0;
}