/* YouTube Hub Pro Public Styles */

:root {
    --yhp-primary: #ff0000;
    --yhp-bg: #ffffff;
    --yhp-card-bg: #f9f9f9;
    --yhp-text: #333333;
    --yhp-meta: #777777;
    --yhp-radius: 12px;
    --yhp-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --yhp-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Mode Detect */
@media (prefers-color-scheme: dark) {
    :root {
        --yhp-bg: #121212;
        --yhp-card-bg: #1e1e1e;
        --yhp-text: #f0f0f0;
        --yhp-meta: #aaaaaa;
        --yhp-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }
}

.yhp-videos-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 20px 0;
}

/* -------- FILTER TABS -------- */
.yhp-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

.yhp-tab-btn {
    background: var(--yhp-card-bg);
    color: var(--yhp-text);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--yhp-transition);
}

.yhp-tab-btn:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.yhp-tab-btn.active {
    background: var(--yhp-text);
    color: var(--yhp-bg);
}

@media (prefers-color-scheme: dark) {
    .yhp-tab-btn {
        border-color: rgba(255, 255, 255, 0.05);
    }
}

/* -------- LAYOUT: GRID -------- */
.yhp-grid-container {
    display: grid;
    gap: 25px;
    padding: 10px;
    /* Prevents shadow clipping */
}

/* Desktop */
.yhp-grid-desk-1 {
    grid-template-columns: 1fr;
}

.yhp-grid-desk-2 {
    grid-template-columns: repeat(2, 1fr);
}

.yhp-grid-desk-3 {
    grid-template-columns: repeat(3, 1fr);
}

.yhp-grid-desk-4 {
    grid-template-columns: repeat(4, 1fr);
}

.yhp-grid-desk-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Tablet */
@media (max-width: 1024px) {
    .yhp-grid-tab-1 {
        grid-template-columns: 1fr;
    }

    .yhp-grid-tab-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .yhp-grid-tab-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile */
@media (max-width: 600px) {
    .yhp-grid-mob-1 {
        grid-template-columns: 1fr;
    }

    .yhp-grid-mob-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* -------- LAYOUT: CAROUSEL -------- */
.yhp-carousel-container {
    padding: 10px 5px 50px 5px;
    /* Side padding + bottom for nav */
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Before Swiper inits, hide overflow and show items inline so they don't stack vertically */
.yhp-carousel-container:not(.swiper-initialized) .swiper-wrapper {
    display: flex;
    gap: 20px;
    overflow: hidden;
}

.yhp-carousel-container:not(.swiper-initialized) .swiper-slide {
    flex: 0 0 calc(25% - 15px);
    min-width: 250px;
}

@media (max-width: 1024px) {
    .yhp-carousel-container:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc(50% - 10px);
    }
}

@media (max-width: 600px) {
    .yhp-carousel-container:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 100%;
    }
}

.yhp-layout-carousel .yhp-video-item {
    height: auto;
    margin: 5px 0;
    /* Vertical breathing room for shadows */
}

.swiper-button-next,
.swiper-button-prev {
    color: var(--yhp-text);
    background: var(--yhp-bg);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: var(--yhp-transition);
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: scale(1.05);
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 16px;
    font-weight: 800;
}


/* -------- CARD STYLES -------- */
.yhp-video-item {
    background: var(--yhp-card-bg);
    border-radius: var(--yhp-radius);
    overflow: hidden;
    transition: var(--yhp-transition);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Style 1: Default SaaS */
.yhp-card-style-1 .yhp-video-item {
    box-shadow: var(--yhp-shadow);
}

.yhp-card-style-1 .yhp-video-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* Style 2: Flat Border */
.yhp-card-style-2 .yhp-video-item {
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.yhp-card-style-2 .yhp-video-item:hover {
    border-color: var(--yhp-primary);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    .yhp-card-style-2 .yhp-video-item {
        border-color: rgba(255, 255, 255, 0.08);
    }
}

/* Style 3: Minimal (No bg, large title) */
.yhp-card-style-3 .yhp-video-item {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.yhp-card-style-3 .yhp-thumbnail-wrap {
    border-radius: var(--yhp-radius);
}

.yhp-card-style-3 .yhp-video-info {
    padding: 15px 5px;
}

.yhp-card-style-3 .yhp-video-title {
    font-size: 20px;
    margin-bottom: 8px;
}

/* Generic Card internals */
.yhp-thumbnail-wrap {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #000;
}

.yhp-thumbnail-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.yhp-video-item:hover .yhp-thumbnail-wrap img {
    transform: scale(1.05);
}

.yhp-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    padding: 10px;
    opacity: 0.8;
    transition: var(--yhp-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.yhp-video-item:hover .yhp-play-icon {
    background: var(--yhp-primary);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.yhp-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.yhp-video-info {
    padding: 16px 18px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.yhp-video-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.4;
    color: var(--yhp-text);
    cursor: pointer;
    transition: color 0.2s;
}

.yhp-video-title:hover {
    color: var(--yhp-primary);
}

.yhp-video-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--yhp-meta);
    margin-bottom: 10px;
}

.yhp-video-desc {
    font-size: 14px;
    color: var(--yhp-text);
    opacity: 0.8;
    line-height: 1.6;
    margin-top: auto;
}

/* -------- LOAD MORE -------- */
.yhp-load-more-wrap {
    text-align: center;
    margin-top: 30px;
    width: 100%;
}

.yhp-load-more-btn {
    background: var(--yhp-text);
    color: var(--yhp-bg);
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--yhp-transition);
}

.yhp-load-more-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.yhp-load-more-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* -------- LIGHTBOX (Redesigned) -------- */
.yhp-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.yhp-lightbox-overlay.yhp-hidden {
    opacity: 0;
    pointer-events: none;
}

.yhp-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.yhp-lightbox-video-wrap,
.yhp-lightbox-video-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* Close Button — Premium Pill Style */
.yhp-lightbox-close {
    position: absolute;
    top: -52px;
    right: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--yhp-transition);
    border-radius: 30px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.yhp-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.yhp-lightbox-close svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* No results */
.yhp-no-results {
    text-align: center;
    color: var(--yhp-meta);
    font-size: 16px;
    padding: 40px 0;
}

/* -------- RTL / Arabic Support -------- */
[dir="rtl"] .yhp-video-meta,
[dir="rtl"] .yhp-filter-tabs {
    direction: rtl;
}

[dir="rtl"] .yhp-duration {
    right: auto;
    left: 8px;
}

[dir="rtl"] .yhp-lightbox-close {
    right: auto;
    left: 0;
}

[dir="rtl"] .yhp-video-info {
    text-align: right;
}

[dir="rtl"] .yhp-video-title {
    text-align: right;
}

[dir="rtl"] .swiper-button-next,
[dir="rtl"] .swiper-button-prev {
    transform: scaleX(-1);
}