/* ========================================================================
   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 340px;
    gap: 1rem;
    align-items: start;
    background: #1a2332;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}

.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: #1a2332;
}

.video-sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.video-sidebar-header i {
    color: var(--main-color);
}

.video-sidebar-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
}

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

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

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

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

/* Playlist Item */
.playlist-item {
    display: flex;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
}

.playlist-item:hover {
    background: rgba(29, 157, 218, 0.1);
}

.playlist-item.active {
    background: rgba(29, 157, 218, 0.15);
    border-left: 3px solid var(--main-color);
}

.playlist-item-index {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
    padding-top: 2px;
}

.playlist-item.active .playlist-item-index {
    color: var(--main-color);
}

.playlist-item-thumb {
    position: relative;
    width: 100px;
    min-width: 100px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.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(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

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

.playlist-item-play i {
    color: #fff;
    font-size: 14px;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.4));
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
}

.playlist-item-title {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.55;
    direction: rtl !important;
    text-align: right !important;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.playlist-item.active .playlist-item-title,
.playlist-item:hover .playlist-item-title {
    color: #38bdf8;
}


/* ═══════════════════════════════════════
   VIDEO MODAL
   ═══════════════════════════════════════ */
.video-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: modalFadeIn 0.3s ease;
}

.video-modal-overlay.active {
    display: flex;
}

.video-modal-content {
    width: 100%;
    max-width: 960px;
}

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

.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
   ═══════════════════════════════════════ */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    background: #fff;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-tab:hover {
    border-color: var(--main-color);
    color: var(--main-color);
    background: rgba(29, 157, 218, 0.05);
}

.filter-tab.active {
    background: linear-gradient(135deg, var(--main-color), #1580B5);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(29, 157, 218, 0.3);
}

.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;
}

/* ═══════════════════════════════════════
   MASONRY GALLERY
   ═══════════════════════════════════════ */
.masonry-gallery {
    columns: 4;
    column-gap: 12px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.4s ease;
}

/* Hidden state for staggered load-more reveal */
.masonry-item-hidden {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
}

.masonry-item-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.masonry-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.masonry-item img {
    width: 100%;
    display: block;
    transition: transform 0.5s ease;
}

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

.masonry-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(29, 157, 218, 0.85));
    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: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.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 {
        columns: 3;
    }
}

@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 {
        columns: 2;
        column-gap: 8px;
    }

    .masonry-item {
        margin-bottom: 8px;
    }

    .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 {
        columns: 2;
        column-gap: 6px;
    }

    .masonry-item {
        margin-bottom: 6px;
        border-radius: 6px;
    }

    .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;
    }
}