/* ============================================================
   JJ Project Video Grid Widget  v2.0
   ============================================================ */

/* ── Wrapper ────────────────────────────────────────────── */
.jj-widget-wrap {
    position: relative;
    width: 100%;
}

/* ── Loading overlay ─────────────────────────────────────── */
.jj-loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 10;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.jj-loading-overlay.is-visible {
    display: flex;
}
.jj-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #333;
    border-radius: 50%;
    animation: jj-spin 0.7s linear infinite;
}
@keyframes jj-spin {
    to { transform: rotate(360deg); }
}

/* ── Grid ────────────────────────────────────────────────── */
.jj-video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
    transition: opacity 0.2s ease;
}

/* ── Card ─────────────────────────────────────────────────── */
.jj-video-card {
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    /* Responsive max-width is controlled by Elementor selectors */
/*     max-width: 380px;      /* Figma default — overridden by Elementor responsive controls */ */
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.jj-video-card:hover {
    transform: translateY(-4px);
}

/* ── Thumbnail wrap (anchor) ─────────────────────────────── */
.jj-video-card__thumbnail-wrap {
    display: block;
    text-decoration: none;
}

/* ── Thumbnail ───────────────────────────────────────────── */
.jj-video-card__thumbnail {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    border-radius: 12px;
    background: #e0dbd5;
}

.jj-video-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, opacity 0.3s ease;
}
.jj-video-card:hover .jj-video-card__img {
    transform: scale(1.04);
}

/* ── Overlay ─────────────────────────────────────────────── */
.jj-video-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    z-index: 1;
    border-radius: inherit;
    transition: background 0.3s ease;
}
.jj-video-card:hover .jj-video-card__overlay {
    background: rgba(0, 0, 0, 0.25);
}

/* ── Play button ─────────────────────────────────────────── */
.jj-video-card__play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    transition: opacity 0.3s ease, transform 0.25s ease, background 0.25s ease;
}
.jj-video-card__play-btn svg {
    fill: #333;
    margin-left: 3px;
}
.jj-video-card:hover .jj-video-card__play-btn {
    transform: translate(-50%, -50%) scale(1.08);
    background: #fff;
}

/* ── No thumbnail ────────────────────────────────────────── */
.jj-video-card__no-thumb {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #c8b89a 0%, #a0876d 100%);
}

/* ── Content area ────────────────────────────────────────── */
.jj-video-card__content {
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Meta ─────────────────────────────────────────────────── */
.jj-video-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.4;
}
.jj-video-card__meta .jj-sep {
    font-size: 10px;
    opacity: 0.7;
}

/* ── Title ────────────────────────────────────────────────── */
.jj-video-card__title-link {
    text-decoration: none;
}
.jj-video-card__title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0 0 10px;
    line-height: 1.35;
    transition: color 0.2s ease;
}
.jj-video-card:hover .jj-video-card__title {
    color: #8B4513;
}

/* ── Excerpt ─────────────────────────────────────────────── */
.jj-video-card__excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 14px;
}

/* ── Tags ─────────────────────────────────────────────────── */
.jj-video-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}
.jj-video-card__tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    background: #f3f3f3;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 4px 12px;
    text-decoration: none;
    line-height: 1.5;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.jj-video-card__tag:hover {
    background: #8B4513;
    border-color: #8B4513;
    color: #fff;
}

/* ── No posts ────────────────────────────────────────────── */
.jj-video-grid__no-posts {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 40px 0;
    font-size: 15px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.jj-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    margin-top: 40px;
    padding: 0 12px;
    position: relative;
    min-height: 40px;
}

/* Number buttons (page 1, 2, 3...) */
.jj-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    user-select: none;
    margin: 0 3px;
}

.jj-pagination__btn:hover:not(.is-active):not(.is-disabled) {
    background: #e0e0e0;
    color: #333;
    border-color: #ccc;
    transform: translateY(-1px);
}

.jj-pagination__btn.is-active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    cursor: default;
    pointer-events: none;
}

.jj-pagination__btn.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Prev/Next buttons */
.jj-pagination__prev,
.jj-pagination__next {
    flex: 0 0 auto;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    background-color: #2563eb;
    color: #ffffff;
    border: 1px solid #2563eb;
    border-radius: 4px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.jj-pagination__prev:hover:not(.is-disabled),
.jj-pagination__next:hover:not(.is-disabled) {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

.jj-pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 40px;
    color: #999;
    font-size: 14px;
    user-select: none;
}

/* ============================================================
   Responsive defaults
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    .jj-video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .jj-video-card {
        max-width: 100%;
    }
    .jj-video-card__thumbnail {
        height: 200px;
    }
    .jj-pagination {
        padding: 0 8px;
        gap: 0;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .jj-video-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .jj-video-card {
        max-width: 100%;
        min-width: 0;
    }
    .jj-video-card__thumbnail {
        height: 180px;
    }
    .jj-pagination {
        padding: 0 4px;
        gap: 0;
        justify-content: center;
        flex-wrap: wrap;
    }
    .jj-pagination__btn {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 12px;
        margin: 0 2px;
    }
    .jj-pagination__prev,
    .jj-pagination__next {
        padding: 4px 10px;
        font-size: 12px;
        min-width: 36px;
        height: 36px;
    }
}
