/* ==========================================================================
   NSSF Video Viewer & Listing - Modern UI Matching PreviewPDF
   Provides:
   1. Universal video playlist card & wrapper styling (Desktop, Tablet, Mobile)
   2. Desktop sidebar listing (.nssf-video-list-wrapper) matching PreviewPDF
   3. Mobile & Tablet (< 1200px) Filter Bar & Bottom Sheet Drawer
   4. Renovated Modern Card Styling for category listing (.app-card)
   Does not override unrelated styles.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Universal Video List Wrapper (Desktop Sidebar Playlist)
   Matches PreviewPDF's .nssf-doc-list-wrapper
   -------------------------------------------------------------------------- */
.nssf-video-list-wrapper {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    margin-top: 15px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    font-family: 'Kantumruy', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.nssf-video-list-header {
    background: #1e3a8a;
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 2px solid #1e3a8a;
}

.nssf-video-list-title {
    font-size: 15.5px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.2px;
    font-family: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nssf-video-list-title svg {
    flex-shrink: 0;
    stroke: currentColor;
}

.nssf-video-list-count {
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
    font-family: inherit;
    flex-shrink: 0;
}

.nssf-video-list-body {
    padding: 14px;
    max-height: 580px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

/* Custom sleek scrollbar */
.nssf-video-list-body::-webkit-scrollbar {
    width: 6px;
}

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

.nssf-video-list-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.nssf-video-list-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --------------------------------------------------------------------------
   2. Video Cards (Used in Desktop Sidebar & Mobile Bottom Sheet)
   Matches PreviewPDF's .nssf-doc-card with 16:9 Video Presentation
   -------------------------------------------------------------------------- */
.nssf-video-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    width: 100% !important;
    padding: 10px 12px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    text-align: left !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease !important;
    cursor: pointer;
    text-decoration: none !important;
    box-sizing: border-box !important;
    user-select: none;
    font-family: inherit;
}

.nssf-video-card:hover {
    border-color: #93c5fd !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12) !important;
    transform: translateY(-1px);
}

.nssf-video-card:active {
    transform: scale(0.985);
}

.nssf-video-card.is-active {
    background: #eff6ff !important;
    border-color: #2563eb !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15) !important;
}

.nssf-video-thumb-wrapper {
    position: relative !important;
    flex-shrink: 0 !important;
    width: 96px !important;
    height: 54px !important;
    aspect-ratio: 16 / 9 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    margin-right: 12px !important;
    background: #0f172a !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

.nssf-video-thumb-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.nssf-video-play-badge {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.28) !important;
    color: #ffffff !important;
    transition: background 0.18s ease !important;
}

.nssf-video-card:hover .nssf-video-play-badge {
    background: rgba(37, 99, 235, 0.45) !important;
}

.nssf-video-play-badge svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)) !important;
}

.nssf-video-active-badge {
    position: absolute !important;
    top: 4px !important;
    left: 4px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    font-size: 9.5px !important;
    font-weight: 600 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    line-height: 1.2 !important;
    font-family: inherit;
    z-index: 2 !important;
}

.nssf-video-content {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.nssf-video-title {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    line-height: 1.6 !important;
    margin: 0 0 4px 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: break-word !important;
    letter-spacing: 0.15px !important;
    font-family: inherit;
}

.nssf-video-card.is-active .nssf-video-title {
    color: #2563eb !important;
    font-weight: 700 !important;
}

.nssf-video-meta {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    font-size: 11.5px !important;
    color: #64748b !important;
    margin-top: auto !important;
}

.nssf-video-date {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.nssf-video-card-badge {
    background: #2563eb !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    padding: 1px 7px !important;
    border-radius: 10px !important;
    letter-spacing: 0.2px !important;
}

/* --------------------------------------------------------------------------
   3. Desktop Guard (Screens > 1200px)
   -------------------------------------------------------------------------- */
@media only screen and (min-width: 1201px) {

    .nssf-video-mobile-filter-bar,
    .nssf-video-mobile-fab-wrapper,
    .nssf-video-bottom-sheet {
        display: none !important;
    }

    .nssf-desktop-video-col {
        display: block !important;
    }
}

/* --------------------------------------------------------------------------
   4. Mobile & Tablet Specific Styles (Screens <= 1200px or touch tablets)
   -------------------------------------------------------------------------- */
@media only screen and (max-width: 1200px),
only screen and (hover: none) and (pointer: coarse) and (max-width: 1366px) {

    /* Hide desktop video playlist column on mobile & tablet */
    .nssf-desktop-video-col {
        display: none !important;
    }

    /* Filter Bar above Video player */
    .nssf-video-mobile-filter-bar {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        margin-top: 6px !important;
        margin-bottom: 10px !important;
        padding: 8px 14px !important;
        background: #ffffff !important;
        border-radius: 12px !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    }

    .nssf-video-mobile-filter-info {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        color: #1e293b !important;
        font-weight: 600 !important;
        font-size: 13px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .nssf-video-mobile-filter-info svg {
        color: #0f4c81 !important;
        flex-shrink: 0 !important;
    }

    .nssf-video-mobile-doc-count {
        color: #64748b !important;
        font-size: 12.5px !important;
        font-weight: 500 !important;
    }

    .nssf-video-mobile-filter-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 6px 14px !important;
        background: #09346d !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 20px !important;
        font-size: 12.5px !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        box-shadow: 0 2px 8px rgba(9, 52, 109, 0.25) !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        font-family: inherit !important;
    }

    .nssf-video-mobile-filter-btn:active {
        transform: scale(0.96) !important;
    }

    .nssf-video-mobile-filter-badge {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 18px !important;
        height: 18px !important;
        padding: 0 5px !important;
        border-radius: 9px !important;
        background: rgba(255, 255, 255, 0.25) !important;
        color: #ffffff !important;
        font-size: 11px !important;
        font-weight: 700 !important;
    }

    /* Floating Action Button (FAB) */
    .nssf-video-mobile-fab-wrapper {
        position: fixed !important;
        right: 16px !important;
        bottom: 74px !important;
        z-index: 1050 !important;
        pointer-events: auto !important;
        display: block !important;
    }

    .nssf-video-mobile-fab {
        display: inline-flex !important;
        align-items: center !important;
        gap: 7px !important;
        padding: 9px 16px !important;
        border-radius: 24px !important;
        background: linear-gradient(135deg, #09346d 0%, #1e5ba4 100%) !important;
        color: #ffffff !important;
        border: 2px solid rgba(255, 255, 255, 0.85) !important;
        box-shadow: 0 6px 18px rgba(9, 52, 109, 0.38), 0 2px 6px rgba(0, 0, 0, 0.15) !important;
        cursor: pointer !important;
        font-family: inherit !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease !important;
    }

    .nssf-video-mobile-fab:active {
        transform: scale(0.93) !important;
    }

    .nssf-video-mobile-fab-badge {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 19px !important;
        height: 19px !important;
        padding: 0 5px !important;
        border-radius: 10px !important;
        background: #ef4444 !important;
        color: #ffffff !important;
        font-size: 11px !important;
        font-weight: 700 !important;
    }

    /* Interactive Bottom Sheet Modal */
    .nssf-video-bottom-sheet {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 82vh !important;
        background: #ffffff !important;
        border-radius: 22px 22px 0 0 !important;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        z-index: 1402 !important;
        animation: nssfVideoSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
        padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)) !important;
        margin: 0 !important;
    }

    @keyframes nssfVideoSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0.6;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .nssf-video-bs-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 6px 18px !important;
        background: #09346d !important;
        color: #ffffff !important;
        border-radius: 22px 22px 0 0 !important;
        position: relative !important;
        flex-shrink: 0 !important;
        width: 100% !important;
    }

    .nssf-video-bs-title-group {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex: 1 !important;
        overflow: hidden !important;
    }

    .nssf-video-bs-title {
        font-size: 15px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.4 !important;
        color: #ffffff !important;
    }

    .nssf-video-bs-count {
        display: inline-flex !important;
        align-items: center !important;
        padding: 2px 8px !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.22) !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        color: #ffffff !important;
    }

    .nssf-video-bs-close {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 50% !important;
        border: none !important;
        background: rgba(255, 255, 255, 0.18) !important;
        color: #ffffff !important;
        cursor: pointer !important;
        transition: background 0.15s ease !important;
        margin-left: 8px !important;
        flex-shrink: 0 !important;
    }

    .nssf-video-bs-close:active {
        background: rgba(255, 255, 255, 0.35) !important;
    }

    .nssf-video-bs-body {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 12px 14px 20px 14px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        background: #f8fafc !important;
    }
}

/* --------------------------------------------------------------------------
   5. Tablet & iPad Specific Enhancements (768px to 1200px)
   -------------------------------------------------------------------------- */
@media only screen and (min-width: 768px) and (max-width: 1200px) {
    .nssf-video-mobile-filter-bar {
        padding: 10px 18px !important;
        margin-top: 8px !important;
        margin-bottom: 12px !important;
    }

    .nssf-video-mobile-filter-info {
        font-size: 14px !important;
    }

    .nssf-video-mobile-filter-btn {
        padding: 8px 18px !important;
        font-size: 13.5px !important;
    }

    .nssf-video-mobile-fab-wrapper {
        right: 24px !important;
        bottom: 84px !important;
    }

    .nssf-video-mobile-fab {
        padding: 11px 20px !important;
        font-size: 14px !important;
    }

    .nssf-video-bottom-sheet {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 22px 22px 0 0 !important;
        margin: 0 !important;
    }

    .nssf-video-bs-header {
        padding: 16px 24px !important;
    }

    .nssf-video-bs-title {
        font-size: 16px !important;
    }

    .nssf-video-bs-body {
        padding: 16px 24px 24px 24px !important;
    }

    .nssf-video-thumb-wrapper {
        width: 110px !important;
        height: 62px !important;
    }
}

/* --------------------------------------------------------------------------
   6. Modern Renovated Style for .app-card on Desktop & Tablet
   Aligns Category Listing Cards (DocumentList, SecondSubMenu, MasterMenu)
   with the clean, elevated aesthetic of PreviewPDF cards
   -------------------------------------------------------------------------- */
@media screen and (min-width: 768px) {
    .app-card {
        background: #ffffff !important;
        border-radius: 12px !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
        transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease !important;
        box-sizing: border-box !important;
    }

    .app-card:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08) !important;
        border-color: #93c5fd !important;
    }
}