/**
 * Cure Videos Grid Styles
 *
 * Frontend styles for the YouTube video grid display.
 *
 * @package Cure_Videos
 */

/* Grid Container */
.cure-videos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Video Card */
.cure-video-card {
    background: #e8f4f4;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cure-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Thumbnail Container */
.cure-video-thumbnail {
    position: relative;
    display: block;
    width: 100%;
    /* Use 16:10 ratio instead of 16:9 to naturally hide more black bars */
    aspect-ratio: 16 / 10;
    overflow: hidden;
    text-decoration: none;
}

.cure-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Position slightly higher to crop bottom black bar more */
    object-position: center 35%;
    border-radius: 12px 12px 0 0;
    transition: transform 0.3s ease;
    /* Aggressive scale to crop black bars from letterboxed thumbnails */
    transform: scale(1.35);
}

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

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

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

/* Play Button */
.cure-video-play-button {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    transition: transform 0.3s ease, background 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cure-video-play-button:hover {
    transform: scale(1.1);
    background: #ffffff;
}

.cure-video-play-button svg {
    width: 100%;
    height: 100%;
}

/* Duration Badge */
.cure-video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Content Section */
.cure-video-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Video Title */
.cure-video-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1a1a1a;
}

.cure-video-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cure-video-title a:hover {
    color: #0066cc;
}

/* Video Description */
.cure-video-description {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #666666;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Stats Section */
.cure-video-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.cure-video-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #888888;
}

.cure-video-stat svg {
    width: 16px;
    height: 16px;
    fill: #888888;
    flex-shrink: 0;
}

/* Error Messages */
.cure-videos-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin: 10px 0;
}

.cure-videos-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-size: 16px;
}

/* Editor Placeholder */
.cure-videos-grid-placeholder {
    background: #f5f5f5;
    border: 2px dashed #cccccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    color: #666666;
}

.cure-videos-grid-placeholder p {
    margin: 0 0 10px 0;
}

.cure-videos-grid-placeholder small {
    color: #999999;
}

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

@media (max-width: 1024px) {
    .cure-videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cure-video-title {
        font-size: 15px;
    }
    
    .cure-video-description {
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    .cure-videos-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .cure-video-content {
        padding: 14px;
    }
    
    .cure-video-title {
        font-size: 15px;
    }
    
    .cure-video-stats {
        gap: 12px;
    }
    
    .cure-video-stat {
        font-size: 12px;
    }
}

/* RTL Support */
[dir="rtl"] .cure-video-duration {
    right: auto;
    left: 8px;
}

[dir="rtl"] .cure-video-stats {
    flex-direction: row-reverse;
}

/* Accessibility */
.cure-video-thumbnail:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.cure-video-title a:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Animation for loading */
@keyframes cure-videos-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cure-video-card {
    animation: cure-videos-fade-in 0.4s ease forwards;
}

.cure-video-card:nth-child(1) { animation-delay: 0s; }
.cure-video-card:nth-child(2) { animation-delay: 0.05s; }
.cure-video-card:nth-child(3) { animation-delay: 0.1s; }
.cure-video-card:nth-child(4) { animation-delay: 0.15s; }
.cure-video-card:nth-child(5) { animation-delay: 0.2s; }
.cure-video-card:nth-child(6) { animation-delay: 0.25s; }
.cure-video-card:nth-child(7) { animation-delay: 0.3s; }
.cure-video-card:nth-child(8) { animation-delay: 0.35s; }

/* =====================================================
   Custom Lightbox Styles
   ===================================================== */

/* Body scroll is now controlled by inline JS styles */

/* Lightbox - desktop only (mobile opens YouTube directly) */
.cure-videos-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cure-videos-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

.cure-videos-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    z-index: 1;
}

.cure-videos-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.cure-videos-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.cure-videos-lightbox-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cure-videos-lightbox-video iframe,
#cure-videos-lightbox-player,
#cure-videos-lightbox-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Lightbox Responsive - minimal since mobile opens YouTube directly */
@media (max-width: 768px) {
    .cure-videos-lightbox-content {
        width: 95%;
    }
    
    .cure-videos-lightbox-close {
        top: -45px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
}

/* Lightbox animation */
@keyframes cure-lightbox-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes cure-lightbox-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cure-videos-lightbox {
    animation: cure-lightbox-fade-in 0.3s ease;
}

.cure-videos-lightbox-content {
    animation: cure-lightbox-scale-in 0.3s ease;
}

/* =====================================================
   Pagination / Load More Styles
   ===================================================== */

.cure-videos-wrapper {
    width: 100%;
}

.cure-videos-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
    padding: 20px 0;
}

/* Progress Section */
.cure-videos-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.cure-videos-progress-text {
    font-size: 14px;
    color: #666666;
    text-align: center;
}

.cure-videos-progress-bar {
    display: block;
    width: 100%;
    height: 4px;
    margin-top: 12px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.cure-videos-progress-fill {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    min-width: 2px;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Load More Button - Structure */
.cure-videos-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 14px 32px;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

/* Default background using :where() for zero specificity - any selector can override */
:where(.cure-videos-load-more) {
    background-color: #667eea;
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.cure-videos-load-more:hover {
    transform: translateY(-2px);
}

:where(.cure-videos-load-more:hover) {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.cure-videos-load-more:active {
    transform: translateY(0);
}

.cure-videos-load-more:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

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

.cure-videos-spinner {
    width: 18px;
    height: 18px;
}

/* Responsive Pagination */
@media (max-width: 767px) {
    .cure-videos-pagination {
        margin-top: 30px;
        gap: 16px;
    }
    
    .cure-videos-load-more {
        padding: 12px 28px;
        font-size: 14px;
    }
    
    .cure-videos-progress {
        max-width: 280px;
    }
    
    .cure-videos-progress-text {
        font-size: 13px;
    }
}
