/* ============================================================
   JNR YouTube Media Block — Premium Modern Frontend Styles
   ============================================================ */

/* ---------- Block wrapper ---------- */
.jnr-yblock {
    position: relative;
    width: 100%;
    padding: 4px 0 16px;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Swiper ---------- */
.jnr-yblock-swiper {
    padding: 12px 10px 24px !important;
    overflow: visible !important;
}

/* ---------- Card Base ---------- */
.jnr-ycard {
    cursor: pointer;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.14), 0 3px 8px rgba(0, 0, 0, 0.08);
    transition: transform .35s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow .35s ease, border-color .3s ease;
    position: relative;
    background: #0f1117;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.jnr-ycard:hover {
    transform: translateY(-8px) scale(1.025);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* Aspect ratio handling for Shorts vs Video */
.jnr-ycard-img {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
}
.jnr-ycard.is-shorts .jnr-ycard-img {
    padding-bottom: 165%; /* 9:16 vertical Shorts layout */
}
.jnr-ycard.is-video .jnr-ycard-img {
    padding-bottom: 65%; /* Landscape Video layout */
}
.jnr-ycard:not(.is-shorts):not(.is-video) .jnr-ycard-img {
    padding-bottom: 165%;
}

.jnr-ycard-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.jnr-ycard:hover .jnr-ycard-img img {
    transform: scale(1.08);
}

/* Glassmorphic Gradient overlay at bottom & top */
.jnr-ycard-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.45) 0%,
        rgba(0, 0, 0, 0) 25%,
        rgba(0, 0, 0, 0.3) 55%,
        rgba(10, 12, 18, 0.95) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* ---------- Top Bar Badges ---------- */
.jnr-ycard-top-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 3;
    pointer-events: none;
}

/* Shorts badge */
.jnr-ycard-type-badge {
    background: linear-gradient(135deg, #ff0033 0%, #cc0000 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(255, 0, 51, 0.4);
}
.jnr-ycard-type-badge svg {
    display: block;
}

/* Category badge */
.jnr-ycard-cat-badge {
    background: rgba(15, 17, 23, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Episode number badge */
.jnr-ycard-badge {
    background: linear-gradient(135deg, #ff0033 0%, #b30000 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(255, 0, 51, 0.4);
}

/* Site logo overlay */
.jnr-ycard-logo-overlay {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 3px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    margin-right: auto;
}
.jnr-ycard-logo-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

/* Duration badge — bottom left */
.jnr-ycard-duration {
    position: absolute;
    bottom: 60px;
    left: 12px;
    background: rgba(10, 12, 18, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 3;
    font-family: monospace;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Play button — centered with pulse effect */
.jnr-ycard-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff0033 0%, #cc0000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 22px rgba(255, 0, 51, 0.55);
    z-index: 3;
    transition: transform .35s cubic-bezier(.175,.885,.32,1.275), box-shadow .35s ease;
}
.jnr-ycard-play-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 0, 51, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.jnr-ycard:hover .jnr-ycard-play {
    transform: translate(-50%, -50%) scale(1.16);
    box-shadow: 0 8px 30px rgba(255, 0, 51, 0.8);
}
.jnr-ycard:hover .jnr-ycard-play-pulse {
    opacity: 1;
    animation: jnrPlayPulse 1.8s infinite ease-out;
}
@keyframes jnrPlayPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}
.jnr-ycard-play svg {
    margin-right: -2px; /* optical centering */
}

/* Title overlay at bottom */
.jnr-ycard-title-wrap {
    position: absolute;
    bottom: 10px;
    left: 12px;
    right: 12px;
    z-index: 2;
    text-align: right;
}
.jnr-ycard-title {
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.45;
    margin: 0;
    padding: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.2px;
    font-family: inherit;
}

/* ---------- Swiper nav arrows ---------- */
.jnr-yblock-prev,
.jnr-yblock-next {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16) !important;
    color: #ff0033 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    transition: all .3s cubic-bezier(.175,.885,.32,1.275) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
}
.jnr-yblock-prev:hover,
.jnr-yblock-next:hover {
    background: linear-gradient(135deg, #ff0033 0%, #cc0000 100%) !important;
    color: #ffffff !important;
    transform: translateY(-50%) scale(1.12) !important;
    box-shadow: 0 8px 25px rgba(255, 0, 51, 0.5) !important;
}
.jnr-yblock-prev::after,
.jnr-yblock-next::after {
    font-size: 14px !important;
    font-weight: 900 !important;
}
.jnr-yblock-prev {
    right: -12px !important;
    left: auto !important;
}
.jnr-yblock-next {
    left: -12px !important;
    right: auto !important;
}

/* ---------- More button ---------- */
.jnr-yblock-more-wrap {
    padding: 8px 10px 0;
    text-align: center;
}
.jnr-yblock-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff0033 0%, #cc0000 100%);
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    transition: all .3s ease;
    box-shadow: 0 4px 15px rgba(255, 0, 51, 0.35);
}
.jnr-yblock-more-btn:hover {
    background: linear-gradient(135deg, #e6002e 0%, #b30000 100%);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255, 0, 51, 0.5);
}

/* ============================================================
   POPUP OVERLAY
   ============================================================ */
.jnr-ypopup-overlay {
    display: none;       /* Hidden by default — JS adds .jnr-active to show */
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}
/* Step 1: make it flex (show in DOM flow) */
.jnr-ypopup-overlay.jnr-active {
    display: flex;
    pointer-events: all;
}
/* Step 2: fade in (triggered one frame after .jnr-active) */
.jnr-ypopup-overlay.jnr-visible {
    opacity: 1;
}

/* Modal with Premium Glassmorphism */
.jnr-ypopup-modal {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    display: flex;
    flex-direction: row;
    width: 90%;
    max-width: 860px;
    max-height: 90vh;
    overflow: visible; /* crucial for floating outer elements */
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,.3);
    transform: scale(.92);
    transition: transform .3s ease;
    direction: rtl;
}
.jnr-ypopup-overlay.jnr-visible .jnr-ypopup-modal {
    transform: scale(1);
}

/* Close button - top right of modal card */
.jnr-ypopup-close {
    position: absolute;
    top: -12px;
    right: -12px;
    left: auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #E50E0E;
    color: #fff;
    border: none;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(229,14,14,.35);
    transition: background .2s, transform .2s;
}
.jnr-ypopup-close:hover { background: #b30000; transform: scale(1.1); }

/* Left side: Floating Screen Player */
.jnr-ypopup-player-side {
    flex: 0 0 auto;
    width: 310px;
    padding: 24px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease;
}
.jnr-ypopup-overlay.jnr-is-video .jnr-ypopup-player-side {
    width: 560px;
    max-width: 55%;
}
.jnr-ypopup-player-wrap {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 177.77%; /* 9:16 ratio default for shorts */
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,.22);
    background: #000;
}
.jnr-ypopup-overlay.jnr-is-video .jnr-ypopup-player-wrap {
    padding-bottom: 56.25%; /* 16:9 ratio for regular videos */
}
.jnr-ypopup-player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Right side: Info and Content */
.jnr-ypopup-info-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px 24px;
    background: transparent;
    overflow-y: auto;
    max-height: 550px;
}

/* Logo */
.jnr-ypopup-logo {
    margin-bottom: 12px;
    text-align: right;
}
.jnr-ypopup-logo img {
    max-height: 42px;
    width: auto;
    object-fit: contain;
}
.jnr-ypopup-site-name {
    font-size: 22px;
    font-weight: 900;
    color: #E50E0E;
    font-family: 'Tahoma', Arial, sans-serif;
}

/* Solid red divider under logo */
.jnr-ypopup-divider {
    height: 2px;
    background: #E50E0E;
    width: 100%;
    margin-bottom: 16px;
}

/* Category label with red thick bar on right side */
.jnr-ypopup-category-label {
    font-size: 13.5px;
    font-weight: 800;
    color: #000;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    border-right: 4px solid #E50E0E;
    padding-right: 8px;
    font-family: 'Tahoma', Arial, sans-serif;
}

/* Title */
.jnr-ypopup-title {
    font-size: 19px;
    font-weight: 800;
    color: #000;
    margin: 0 0 12px;
    line-height: 1.4;
    font-family: 'Tahoma', Arial, sans-serif;
}

/* Description */
.jnr-ypopup-desc {
    font-size: 14px;
    color: #444;
    line-height: 1.7;
    margin: 0 0 20px;
    font-family: 'Tahoma', Arial, sans-serif;
    flex: 1;
}

/* Share button */
.jnr-ypopup-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #E50E0E;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    align-self: flex-start;
    transition: background .2s;
    margin-bottom: 16px;
    font-family: 'Tahoma', Arial, sans-serif;
}
.jnr-ypopup-share-btn:hover { background: #b30000; color: #fff; text-decoration: none; }

/* Social icons row */
.jnr-ypopup-social {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.jnr-ypopup-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid #ccc;
    color: #444;
    transition: border-color .2s, color .2s, background .2s;
    text-decoration: none;
}
.jnr-ypopup-social a:hover { border-color: #E50E0E; color: #E50E0E; }
.jnr-social-x:hover  { color: #000 !important; border-color: #000 !important; }
.jnr-social-fb:hover { color: #1877f2 !important; border-color: #1877f2 !important; }
.jnr-social-wa:hover { color: #25d366 !important; border-color: #25d366 !important; }

/* Up/Down floating side navigation */
.jnr-ypopup-nav {
    position: absolute;
    right: -18px; /* overlaps the right edge of modal */
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}
.jnr-ypopup-nav-up,
.jnr-ypopup-nav-down {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #E50E0E;
    color: #ffffff;
    border: 2px solid #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 16px rgba(229, 14, 14, 0.4);
    padding: 0;
}
.jnr-ypopup-nav-up svg,
.jnr-ypopup-nav-down svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
    transition: transform .2s ease;
}
.jnr-ypopup-nav-up:hover,
.jnr-ypopup-nav-down:hover {
    background: #b30000;
    transform: scale(1.12);
    box-shadow: 0 8px 20px rgba(179, 0, 0, 0.5);
}
.jnr-ypopup-nav-up:disabled,
.jnr-ypopup-nav-down:disabled {
    background: #cbd5e1;
    border-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}
.jnr-ypopup-nav-up:disabled svg,
.jnr-ypopup-nav-down:disabled svg {
    stroke: #94a3b8;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .jnr-ypopup-modal {
        flex-direction: column;
        max-height: 95vh;
        overflow-y: auto;
    }
    .jnr-ypopup-player-side {
        width: 100%;
        padding: 16px 16px 8px;
    }
    .jnr-ypopup-player-wrap {
        padding-bottom: 56.25%; /* horizontal 16:9 layout for landscape viewing on small screens */
        max-width: 100%;
    }
    .jnr-ypopup-info-side {
        padding: 16px;
        max-height: none;
    }
    .jnr-ypopup-close {
        top: 8px;
        left: 8px;
        right: auto; /* Top-left on mobile to prevent overlay overlaps */
    }
    .jnr-ypopup-nav {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        flex-direction: row;
        justify-content: center;
        margin: 12px 0;
    }
    .jnr-yblock-swiper { padding: 8px 36px 16px !important; }
}
@media (max-width: 600px) {
    .jnr-ycard-title { font-size: 11.5px; }
    .jnr-ycard-play { width: 38px; height: 38px; }
    .jnr-ypopup-modal { width: 94%; }
}
