/* ==========================================================================
   Zype by 2Ton - Clean & Minimal Styles
   ========================================================================== */

/* --- Filters --- */
.zype-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.zype-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-right: 4px;
}

.zype-filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zype-filter-btn:hover {
    border-color: #999;
}

.zype-filter-btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* --- Video Grid --- */
.zype-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.zype-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.zype-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.zype-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.zype-card-thumb {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: #f0f0f0;
    overflow: hidden;
}

.zype-card-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zype-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
}

.zype-card-info {
    padding: 12px 16px;
}

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

/* --- Pagination --- */
.zype-pagination {
    text-align: center;
    margin-top: 32px;
}

.zype-load-more {
    padding: 12px 32px;
    border: 2px solid #333;
    border-radius: 4px;
    background: transparent;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zype-load-more:hover {
    background: #333;
    color: #fff;
}

.zype-load-more.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* --- Error / Empty --- */
.zype-error,
.zype-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 15px;
}

.zype-error {
    color: #c00;
}

/* ==========================================================================
   Single Video Page
   ========================================================================== */
.zype-single-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px;
}

.zype-player-section {
    margin-bottom: 32px;
}

.zype-player-poster {
    position: relative;
    padding-top: 56.25%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

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

.zype-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.zype-play-btn:hover {
    opacity: 0.9;
}

.zype-play-btn svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.zype-video-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.3;
    color: #1a1a1a;
}

.zype-video-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
}

.zype-meta-item::before {
    content: none;
}

.zype-meta-item + .zype-meta-item::before {
    content: "·";
    margin-right: 16px;
}

.zype-video-description {
    font-size: 16px;
    line-height: 1.7;
    color: #333;
    margin-bottom: 24px;
}

.zype-video-description p:last-child {
    margin-bottom: 0;
}

.zype-video-categories,
.zype-video-keywords {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
}

/* ==========================================================================
   Single Video Shortcode
   ========================================================================== */
.zype-single-video-wrap {
    margin: 20px 0;
}

.zype-single-video-poster {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.zype-single-video-poster:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.zype-single-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.zype-single-play-btn:hover {
    opacity: 0.9;
}

.zype-single-play-icon {
    max-width: 60px !important;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.zype-single-video-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: #fff;
    font-weight: 600;
    pointer-events: none;
    text-align: center;
    padding: 8px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
    font-size: .8em;
}

/* ==========================================================================
   Related Videos Shortcode
   ========================================================================== */
.zype-related-videos {
    margin: 20px 0;
}

/* ==========================================================================
   Fancybox Lightbox Overrides (scoped to .zype-fancybox)
   Ensures the video iframe maintains 16:9 aspect ratio and the close
   button renders correctly even when themes load conflicting Fancybox CSS.
   ========================================================================== */

/* --- Responsive 16:9 iframe container --- */
.zype-fancybox .fancybox__content {
    padding: 0 !important;
    width: 90vw !important;
    max-width: 960px !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.zype-fancybox .fancybox__content iframe {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border: 0;
}

/* --- Close button fix --- */
.zype-fancybox .fancybox__backdrop {
    background: rgba(0, 0, 0, 0.85);
}

.zype-fancybox .carousel__button.is-close,
.zype-fancybox .fancybox__button--close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: background 0.2s ease;
    box-shadow: none !important;
    font-size: 0; /* hide any stray text */
    line-height: 1;
    z-index: 10;
}

.zype-fancybox .carousel__button.is-close:hover,
.zype-fancybox .fancybox__button--close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

.zype-fancybox .carousel__button.is-close svg,
.zype-fancybox .fancybox__button--close svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
    display: block;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .zype-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }

    .zype-video-title {
        font-size: 22px;
    }

    .zype-single-wrap {
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .zype-grid {
        grid-template-columns: 1fr;
    }

    .zype-filters {
        gap: 6px;
    }

    .zype-filter-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
}
