/**
 * 2M Platform - Professional Media Gallery & Course Posters Slideshow
 * Sleek Cinema Showcase with Ambient Blur, Thumbnails Strip & Lightbox
 */

.media-slideshow-section {
    padding: 4.5rem 0 5rem;
    position: relative;
    background: var(--bg-page, #f8fafc);
    overflow: hidden;
}

/* Container */
.gallery-showcase-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* Viewport / Frame */
.gallery-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 560px;
    min-height: 280px;
    border-radius: 20px;
    overflow: hidden;
    background: #080911;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 215, 0, 0.25);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.gallery-viewport:hover {
    border-color: rgba(255, 215, 0, 0.45);
    box-shadow: 0 25px 60px rgba(107, 70, 193, 0.22), 0 0 0 1px rgba(255, 215, 0, 0.3);
}

/* Individual Slide */
.gallery-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
    z-index: 1;
    pointer-events: none;
}

.gallery-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
    pointer-events: auto;
}

/* Ambient Blurred Background to blend any aspect ratio seamlessly */
.gallery-ambient-bg {
    position: absolute;
    inset: -25px;
    width: calc(100% + 50px);
    height: calc(100% + 50px);
    object-fit: cover;
    filter: blur(32px) brightness(0.4) saturate(1.3);
    opacity: 0.8;
    transform: scale(1.1);
    pointer-events: none;
    z-index: 1;
    transition: transform 6s cubic-bezier(0.25, 1, 0.5, 1);
}

.gallery-slide.active .gallery-ambient-bg {
    transform: scale(1.18);
}

/* Main Poster Image */
.gallery-poster-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
    padding: 0;
}

.gallery-poster {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    transition: transform 6s cubic-bezier(0.25, 1, 0.5, 1);
}

.gallery-slide.active .gallery-poster {
    transform: scale(1.015);
}

/* Top Progress Bar */
.gallery-progress-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    z-index: 15;
    overflow: hidden;
}

.gallery-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FFD700, #A855F7, #38BDF8);
    transition: width 0.08s linear;
}

/* Top Utility Bar (Tags, Counter, Zoom, Play/Pause) */
.gallery-top-bar {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.gallery-badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.gallery-category-pill {
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #FCD34D;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.gallery-counter-pill {
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 50px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    font-variant-numeric: tabular-nums;
}

.gallery-counter-pill strong {
    color: #FFD700;
    font-size: 0.95rem;
    font-weight: 800;
}

.gallery-tools-group {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.gallery-tool-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    padding: 0;
}

.gallery-tool-btn:hover {
    background: #6B46C1;
    border-color: #A855F7;
    color: #FFFFFF;
    transform: scale(1.08);
}

/* Bottom Action Bar (Non-intrusive floating pills) */
.gallery-bottom-bar {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    gap: 12px;
}

.gallery-slide-title-chip {
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #FFFFFF;
    font-size: 0.92rem;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 50px;
    pointer-events: auto;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-slide-title-chip i {
    color: #FFD700;
}

.gallery-cta-action {
    pointer-events: auto;
    flex-shrink: 0;
}

.gallery-cta-btn {
    background: linear-gradient(135deg, #6B46C1 0%, #8B5CF6 100%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 8px 20px;
    border-radius: 50px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 20px rgba(107, 70, 193, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-cta-btn:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #A855F7 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(107, 70, 193, 0.6);
    color: #FFFFFF;
}

/* Side Navigation Arrows */
.gallery-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.95);
    color: #1E1B4B;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 12;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    font-size: 1.1rem;
    padding: 0;
}

.gallery-nav-arrow:hover {
    background: #6B46C1;
    color: #FFFFFF;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 12px 28px rgba(107, 70, 193, 0.45);
    border-color: #8B5CF6;
}

/* RTL Arrow Positioning (Default Arabic) */
.gallery-nav-prev {
    right: 18px;
    left: auto;
}

.gallery-nav-next {
    left: 18px;
    right: auto;
}

/* LTR Arrow Positioning (English) */
html[dir="ltr"] .gallery-nav-prev,
body.ltr .gallery-nav-prev,
[lang="en"] .gallery-nav-prev {
    left: 18px;
    right: auto;
}

html[dir="ltr"] .gallery-nav-next,
body.ltr .gallery-nav-next,
[lang="en"] .gallery-nav-next {
    right: 18px;
    left: auto;
}

/* Thumbnails Strip */
.gallery-thumbnails-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-top: 18px;
    width: 100%;
}

.gallery-thumb-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-card, #ffffff);
    border: 2px solid rgba(107, 70, 193, 0.08);
    border-radius: 14px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: start;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.06));
    opacity: 0.65;
    position: relative;
    outline: none;
}

.gallery-thumb-item:hover {
    opacity: 0.95;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: rgba(107, 70, 193, 0.3);
}

.gallery-thumb-item.active {
    opacity: 1;
    border-color: #6B46C1;
    box-shadow: 0 10px 24px rgba(107, 70, 193, 0.22);
    transform: translateY(-4px);
    background: var(--bg-card, #ffffff);
}

.gallery-thumb-preview {
    position: relative;
    width: 100%;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
}

.gallery-thumb-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-thumb-item:hover .gallery-thumb-preview img,
.gallery-thumb-item.active .gallery-thumb-preview img {
    transform: scale(1.06);
}

.gallery-thumb-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 4px;
}

.gallery-thumb-index {
    font-size: 0.75rem;
    font-weight: 800;
    color: #6B46C1;
    background: rgba(107, 70, 193, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.gallery-thumb-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Lightbox Modal */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.gallery-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 15, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.gallery-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: lightboxPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightboxPop {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-lightbox-close {
    position: absolute;
    top: -48px;
    left: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

html[dir="ltr"] .gallery-lightbox-close,
body.ltr .gallery-lightbox-close,
[lang="en"] .gallery-lightbox-close {
    left: auto;
    right: 0;
}

.gallery-lightbox-close:hover {
    background: #EF4444;
    border-color: #EF4444;
    transform: rotate(90deg);
}

.gallery-lightbox-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #000000;
}

.gallery-lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.gallery-lightbox-caption {
    width: 100%;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.95);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.25s ease;
}

.gallery-lightbox-nav:hover {
    background: #6B46C1;
    border-color: #8B5CF6;
    transform: translateY(-50%) scale(1.1);
}

.gallery-lightbox-nav.prev {
    right: -65px;
}

.gallery-lightbox-nav.next {
    left: -65px;
}

html[dir="ltr"] .gallery-lightbox-nav.prev,
body.ltr .gallery-lightbox-nav.prev,
[lang="en"] .gallery-lightbox-nav.prev {
    left: -65px;
    right: auto;
}

html[dir="ltr"] .gallery-lightbox-nav.next,
body.ltr .gallery-lightbox-nav.next,
[lang="en"] .gallery-lightbox-nav.next {
    right: -65px;
    left: auto;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .gallery-viewport {
        max-height: 480px;
    }

    .gallery-thumbnails-strip {
        gap: 10px;
    }

    .gallery-thumb-preview {
        height: 60px;
    }

    .gallery-thumb-title {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .media-slideshow-section {
        padding: 3rem 0 3.5rem;
    }

    .gallery-viewport {
        max-height: 360px;
        border-radius: 16px;
    }

    .gallery-nav-arrow {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .gallery-nav-prev { right: 10px; }
    .gallery-nav-next { left: 10px; }

    html[dir="ltr"] .gallery-nav-prev,
    body.ltr .gallery-nav-prev,
    [lang="en"] .gallery-nav-prev {
        left: 10px;
        right: auto;
    }

    html[dir="ltr"] .gallery-nav-next,
    body.ltr .gallery-nav-next,
    [lang="en"] .gallery-nav-next {
        right: 10px;
        left: auto;
    }

    .gallery-top-bar {
        top: 10px;
        left: 10px;
        right: 10px;
    }

    .gallery-category-pill {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .gallery-counter-pill {
        font-size: 0.75rem;
        padding: 4px 9px;
    }

    .gallery-tool-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .gallery-bottom-bar {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }

    .gallery-slide-title-chip {
        font-size: 0.8rem;
        padding: 6px 12px;
        max-width: 60%;
    }

    .gallery-cta-btn {
        font-size: 0.78rem;
        padding: 6px 14px;
    }

    /* Horizontal scroll on mobile thumbnails for clean swipeable bar */
    .gallery-thumbnails-strip {
        display: flex;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 10px;
    }

    .gallery-thumb-item {
        flex: 0 0 140px;
        scroll-snap-align: start;
    }

    .gallery-thumb-preview {
        height: 55px;
    }

    .gallery-lightbox-nav.prev { right: 8px; }
    .gallery-lightbox-nav.next { left: 8px; }
    html[dir="ltr"] .gallery-lightbox-nav.prev,
    body.ltr .gallery-lightbox-nav.prev,
    [lang="en"] .gallery-lightbox-nav.prev {
        left: 8px;
        right: auto;
    }
    html[dir="ltr"] .gallery-lightbox-nav.next,
    body.ltr .gallery-lightbox-nav.next,
    [lang="en"] .gallery-lightbox-nav.next {
        right: 8px;
        left: auto;
    }
}

@media (max-width: 480px) {
    .gallery-viewport {
        max-height: 250px;
    }

    .gallery-slide-title-chip {
        display: none; /* Keep clean on small mobile, banner text is fully visible */
    }

    .gallery-bottom-bar {
        justify-content: flex-end;
    }

    .gallery-cta-btn {
        width: auto;
    }
}
