/**
 * Frontend styles
 *
 * @package ColabaYouTubeCategoryFeed
 */

/* Grid Container */
.cnycf-grid {
    display: flex;
    flex-wrap: wrap;
    margin: -15px;
}

.cnycf-grid-item {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 15px;
    box-sizing: border-box;
}

/* Desktop Columns */
.cnycf-grid-desktop-1 .cnycf-grid-item {
    flex: 0 0 100%;
    max-width: 100%;
}

.cnycf-grid-desktop-2 .cnycf-grid-item {
    flex: 0 0 50%;
    max-width: 50%;
}

.cnycf-grid-desktop-3 .cnycf-grid-item {
    flex: 0 0 33.333%;
    max-width: 33.333%;
}

.cnycf-grid-desktop-4 .cnycf-grid-item {
    flex: 0 0 25%;
    max-width: 25%;
}

.cnycf-grid-desktop-5 .cnycf-grid-item {
    flex: 0 0 20%;
    max-width: 20%;
}

.cnycf-grid-desktop-6 .cnycf-grid-item {
    flex: 0 0 16.666%;
    max-width: 16.666%;
}

/* Video Card */
.cnycf-video-card {
    background: #ffffff;
    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;
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

    .cnycf-video-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }

/* Thumbnail */
.cnycf-video-thumbnail {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 ratio */
    background: #000;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

    .cnycf-video-thumbnail img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

.cnycf-video-card:hover .cnycf-video-thumbnail img {
    transform: scale(1.05);
}

/* Play Button */
.cnycf-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

    .cnycf-play-button svg {
        width: 100%;
        height: 100%;
    }

.cnycf-video-card:hover .cnycf-play-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
}

/* Video Info */
.cnycf-video-info {
    padding: 12px 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cnycf-video-title {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
    color: #333333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

    .cnycf-video-title a {
        color: inherit;
        text-decoration: none;
    }

        .cnycf-video-title a:hover {
            color: #cc0000;
        }

.cnycf-video-date {
    font-size: 12px;
    color: #888888;
    margin-bottom: 6px;
}

.cnycf-video-description {
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: auto;
}

/* Load More */
.cnycf-load-more-container {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
}

.cnycf-load-more {
    display: inline-block;
    padding: 12px 30px;
    background: #cc0000;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

    .cnycf-load-more:hover {
        background: #990000;
    }

    .cnycf-load-more:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.cnycf-loading-spinner {
    display: none;
    margin-left: 10px;
    color: #666666;
}

    .cnycf-loading-spinner.active {
        display: inline-block;
    }

/* Modal */
.cnycf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cnycf-fade-in 0.3s ease;
}

.cnycf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.cnycf-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1;
    animation: cnycf-scale-in 0.3s ease;
}

.cnycf-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    padding: 0;
}

    .cnycf-modal-close:hover {
        background: rgba(0, 0, 0, 0.8);
    }

    .cnycf-modal-close svg {
        width: 24px;
        height: 24px;
        stroke: #ffffff;
    }

.cnycf-modal-iframe-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

    .cnycf-modal-iframe-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

/* Tabs */
.cnycf-tabs-container {
    margin-bottom: 30px;
}

.cnycf-tabs-header {
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
}

.cnycf-tabs-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0;
}

.cnycf-tab {
    display: inline-block;
    margin: 0;
    padding: 0;
}

    .cnycf-tab a {
        display: block;
        padding: 12px 20px;
        color: #666666;
        text-decoration: none;
        font-weight: 500;
        border-bottom: 3px solid transparent;
        transition: color 0.3s ease, border-color 0.3s ease;
    }

        .cnycf-tab a:hover {
            color: #cc0000;
        }

    .cnycf-tab.active a {
        color: #cc0000;
        border-bottom-color: #cc0000;
    }

.cnycf-tab-loader {
    text-align: center;
    padding: 40px 0;
    color: #666666;
}

/* Empty / Error States */
.cnycf-empty-state,
.cnycf-error-state {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
}

.cnycf-empty-icon,
.cnycf-error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    color: #cccccc;
}

    .cnycf-empty-icon svg,
    .cnycf-error-icon svg {
        width: 100%;
        height: 100%;
    }

.cnycf-error-state {
    color: #dc3232;
}

.cnycf-retry-button {
    margin-top: 15px;
    padding: 8px 20px;
    background: #cc0000;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

    .cnycf-retry-button:hover {
        background: #990000;
    }

/* Animations */
@keyframes cnycf-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes cnycf-scale-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .cnycf-grid-tablet-1 .cnycf-grid-item {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .cnycf-grid-tablet-2 .cnycf-grid-item {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .cnycf-grid-tablet-3 .cnycf-grid-item {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }

    .cnycf-grid-tablet-4 .cnycf-grid-item {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .cnycf-grid-mobile-1 .cnycf-grid-item {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .cnycf-grid-mobile-2 .cnycf-grid-item {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .cnycf-modal-content {
        width: 95%;
    }

    .cnycf-tab a {
        padding: 10px 15px;
        font-size: 14px;
    }

    .cnycf-video-title {
        font-size: 14px;
    }
}
