/* ========================================================================
   MEDIA PAGE STYLES
   ======================================================================== */

/* ── Section Layout ── */
.media-section {
    padding: 5rem 0;
}

.media-videos-section {
    background: #ffffff;
}

.media-gallery-section {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid rgba(15, 36, 70, 0.05);
}

/* ═══════════════════════════════════════
   VIDEO LAYOUT (Player + Sidebar)
   ═══════════════════════════════════════ */
.video-layout {
    display: grid;
    grid-template-columns: 1fr 370px;
    gap: 0;
    align-items: stretch;
    background: #0d1726;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-main {
    position: relative;
}

.video-hero {
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.video-hero-thumb {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.video-hero-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.video-hero-thumb:hover img {
    transform: scale(1.03);
}

.video-hero-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    z-index: 2;
}

.video-hero-thumb:hover .video-hero-play {
    transform: translate(-50%, -50%) scale(1.15);
}

.video-hero-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2.5rem 1.5rem 1.25rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    z-index: 2;
}

.video-hero-info h3 {
    color: #ffffff;
    font-size: 1.18rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    direction: rtl !important;
    text-align: right !important;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif !important;
    line-height: 1.6;
}

/* Embedded player in hero */
.video-hero-player {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
}

.video-hero-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.video-hero-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    background: linear-gradient(135deg, #0d1829, #15263d);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.video-hero-title-bar h3 {
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
    line-height: 1.6;
    direction: rtl !important;
    text-align: right !important;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif !important;
}

.video-hero-close {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.video-hero-close:hover {
    background: rgba(239, 68, 68, 0.8);
    border-color: #ef4444;
    transform: scale(1.08);
}

/* ═══════════════════════════════════════
   VIDEO SIDEBAR (Vertical Playlist)
   ═══════════════════════════════════════ */
.video-sidebar {
    display: flex;
    flex-direction: column;
    height: 0;
    min-height: 100%;
    background: #111c2e;
    border-inline-start: 1px solid rgba(255, 255, 255, 0.07);
}

.video-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    background: rgba(13, 23, 38, 0.75);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.video-sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 700;
}

.video-sidebar-title i,
.video-sidebar-header>i {
    color: var(--accent-color, #1d9fda);
    font-size: 0.95rem;
}

.video-sidebar-count {
    margin-inline-start: auto;
    font-size: 0.72rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.2rem 0.65rem;
    border-radius: 50px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-sidebar-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 157, 218, 0.35) transparent;
}

.video-sidebar-list::-webkit-scrollbar {
    width: 5px;
}

.video-sidebar-list::-webkit-scrollbar-thumb {
    background: rgba(29, 157, 218, 0.3);
    border-radius: 4px;
}

.video-sidebar-list::-webkit-scrollbar-thumb:hover {
    background: rgba(29, 157, 218, 0.5);
}

.video-sidebar-list::-webkit-scrollbar-track {
    background: transparent;
}

/* Playlist Item */
.playlist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-inline-start: 3px solid transparent;
    position: relative;
    user-select: none;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-inline-start-color: rgba(29, 157, 218, 0.4);
}

.playlist-item.active {
    background: linear-gradient(90deg, rgba(29, 159, 218, 0.16) 0%, rgba(29, 159, 218, 0.03) 100%);
    border-inline-start-color: var(--accent-color, #1d9fda);
}

[dir="rtl"] .playlist-item.active {
    background: linear-gradient(270deg, rgba(29, 159, 218, 0.16) 0%, rgba(29, 159, 218, 0.03) 100%);
}

.playlist-item-index {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.playlist-item:hover .playlist-item-index {
    color: #cbd5e1;
}

.playlist-item.active .playlist-item-index {
    color: var(--accent-color, #1d9fda);
}

.playlist-item-thumb {
    position: relative;
    width: 104px;
    min-width: 104px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.playlist-item-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.playlist-item:hover .playlist-item-thumb img {
    transform: scale(1.05);
}

.playlist-item-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 20, 35, 0.45);
    backdrop-filter: blur(1.5px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.playlist-item:hover .playlist-item-play,
.playlist-item.active .playlist-item-play {
    opacity: 1;
}

.playlist-item-play i {
    color: #ffffff;
    font-size: 11px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-color, #1d9fda);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    justify-content: center;
}

.playlist-item-title {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.8125rem;
    /* 13px - compact, crisp, readable */
    font-weight: 600;
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    transition: color 0.2s ease;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif !important;
}

.playlist-item:hover .playlist-item-title {
    color: #ffffff;
}

.playlist-item.active .playlist-item-title {
    color: #38bdf8;
    font-weight: 700;
}

.playlist-item-meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.7rem;
    color: #94a3b8;
    line-height: 1.2;
}

.playlist-item-channel {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #94a3b8;
    font-size: 0.68rem;
}

.playlist-item-channel i {
    color: #ef4444;
    font-size: 0.72rem;
}

.playlist-item-playing {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-color, #1d9fda);
    font-weight: 700;
    font-size: 0.66rem;
    margin-inline-start: auto;
    background: rgba(29, 159, 218, 0.15);
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
}

.playlist-item-playing i {
    font-size: 0.6rem;
}

/* ═══════════════════════════════════════
   VIDEO MODAL (LIGHTBOX)
   ═══════════════════════════════════════ */
.video-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 1.5rem;
}

.video-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-modal-overlay.active .video-modal-content {
    transform: scale(1);
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.video-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-modal-player {
    position: relative;
    padding-bottom: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-modal-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.video-modal-title {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    direction: rtl !important;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif !important;
    line-height: 1.6;
    margin-top: 1rem;
    padding: 0 1rem;
}

/* ═══════════════════════════════════════
   GALLERY FILTERS (UNIFIED CAPSULE PILLS)
   ═══════════════════════════════════════ */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border: 1px solid rgba(15, 36, 70, 0.08);
    border-radius: 50px;
    background: #ffffff;
    color: var(--main-color, #0f2446);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(15, 36, 70, 0.04);
}

.filter-tab:hover {
    border-color: rgba(29, 159, 218, 0.4);
    color: #1d9fda;
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 36, 70, 0.08);
}

.filter-tab.active {
    background: linear-gradient(135deg, #0f2446 0%, #1d9fda 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(29, 159, 218, 0.35);
    transform: translateY(-2px);
}

.filter-tab i {
    font-size: 0.8rem;
}

.gallery-counter {
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* ═══════════════════════════════════════
   PHOTO GALLERY (SMOOTH RESPONSIVE GRID)
   ═══════════════════════════════════════ */
.masonry-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 280px;
}

.masonry-item {
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    border: 1px solid rgba(15, 36, 70, 0.08);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: linear-gradient(110deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.8s ease-in-out infinite;
    box-shadow: 0 4px 16px rgba(15, 36, 70, 0.04);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.35s ease;
}

.masonry-item.loaded {
    animation: none;
    background: #e2e8f0;
}

.masonry-item-enter {
    animation: galleryItemCascade 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes galleryItemCascade {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 35px rgba(15, 36, 70, 0.14);
    border-color: rgba(29, 159, 218, 0.4);
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.5s ease;
}

.masonry-item img.img-loaded {
    opacity: 1;
}

.masonry-item:hover img {
    transform: scale(1.06);
}

.masonry-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(15, 36, 70, 0.88));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.masonry-item:hover .masonry-item-overlay {
    opacity: 1;
}

.masonry-item-label {
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif !important;
}

.masonry-item-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.masonry-item:hover .masonry-item-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Skeleton loading */
.masonry-skeleton {
    break-inside: avoid;
    margin-bottom: 12px;
    border-radius: 10px;
    background: linear-gradient(110deg, #e2e8f0 30%, #f1f5f9 50%, #e2e8f0 70%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Load More */
.load-more-wrapper {
    text-align: center;
    margin-top: 2.5rem;
    padding-bottom: 1rem;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2.5rem;
    background: linear-gradient(135deg, var(--main-color), var(--accent-color));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s, opacity 0.25s;
    box-shadow: 0 4px 16px rgba(29, 157, 218, 0.25);
}

.load-more-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(29, 157, 218, 0.35);
}

.load-more-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.gallery-loading {
    text-align: center;
    padding: 2rem;
}

.gallery-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--main-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════ */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 25, 0.96);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: lightboxZoomIn 0.35s ease;
}

@keyframes lightboxZoomIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

.lightbox-category {
    background: rgba(29, 157, 218, 0.2);
    color: var(--main-color);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.75rem;
    border: 1px solid rgba(29, 157, 218, 0.3);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(29, 157, 218, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 1.5rem;
}

.lightbox-next {
    right: 1.5rem;
}

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 1200px) {
    .masonry-gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

@media (max-width: 992px) {
    .section-title {
        font-size: 1.8rem;
    }

    .video-layout {
        grid-template-columns: 1fr;
    }

    .video-sidebar {
        min-height: auto;
        height: auto;
        max-height: 350px;
    }

    .video-hero-info h3 {
        font-size: 1.1rem;
    }
}

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

    .masonry-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .masonry-item {
        border-radius: 10px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .gallery-filters {
        gap: 0.35rem;
        padding: 0 0.5rem;
    }

    .filter-tab {
        padding: 0.45rem 0.8rem;
        font-size: 0.75rem;
    }

    .video-layout {
        border-radius: 12px;
    }

    .video-sidebar {
        max-height: 300px;
    }

    .playlist-item-thumb {
        width: 80px;
        min-width: 80px;
    }

    .video-modal-overlay {
        padding: 1rem;
    }

    .video-modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .masonry-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .masonry-item {
        border-radius: 8px;
    }

    .filter-tab {
        padding: 0.4rem 0.65rem;
        font-size: 0.7rem;
    }

    .filter-tab i {
        display: none;
    }

    .video-hero-info h3 {
        font-size: 0.9rem;
    }

    .lightbox-info {
        flex-direction: column;
        gap: 0.3rem;
    }
}