/* ==========================================================================
   1. GLOBAL RESET & CORE LAYOUT (TRUE BLACK BACKGROUND)
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

html, body {
    width: 100% !important;
    min-height: 100vh;
    background-color: #000000 !important; /* Pure Black Background */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-display: swap;
    color: #f1f5f9;
    overflow-x: hidden;
}

body {
    /* CRITICAL: Top padding accounts for fixed header height preventing overlap */
    padding-top: 70px !important;
    padding-bottom: 2px;
    padding-left: 2px;
    padding-right: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Base Main Wrappers */
section.article,
section.articles,
.main,
.content,
.container,
.site-main {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   2. FIXED HEADER & NAVIGATION (BOXED LAYOUT)
   ========================================================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background-color: transparent;
    padding: 0px 0;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.header-container {
    display: flex;
    flex-wrap: wrap; 
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 18px;
    background-color: #2e1054;
    border: 1px solid #421a75;
    border-radius: 0px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #ffffff;
    flex-shrink: 0; 
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: #3f1970;
    border: 1px solid #52238d;
    border-radius: 6px;
    padding: 8px 12px;
    flex: 1;
    max-width: 320px; 
    min-width: 0; 
}

.search-box input {
    background: transparent;
    border: none;
    color: #ffffff;
    outline: none;
    width: 100%;
    font-size: 14px;
}

.search-box input::placeholder {
    color: #aa86e3;
}

.search-box button {
    background: transparent;
    border: none;
    color: #cbb2f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    width: 100%;
}

.nav-links a {
    text-decoration: none;
    background-color: #000000;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #282828;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: #ffffff;
    color: #000000;
    border-color: #ffffff;
}

/* ==========================================================================
   3. HOMEPAGE VIDEO GRID (.video-grid) - PERFORMANCE OPTIMIZED
   ========================================================================== */
.video-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    clear: both !important;
    margin-bottom: 24px !important;
    box-sizing: border-box !important;
    /* Deferred Rendering for fast paints */
    content-visibility: auto;
    contain-intrinsic-size: 1000px;
}

.item {
    background-color: #2e1054;
    border: 1px solid #421a75;
    border-radius: 0px;
    overflow: hidden;
    width: 100% !important;
    min-width: 0 !important;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.item:hover {
    transform: translateY(-4px);
    border-color: #7b2cbf;
}

.item-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.image_container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Strictly reserve layout space to banish CLS */
    background-color: #120624;
    overflow: hidden;
}

.image_container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    backface-visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.item:hover .image_container img {
    transform: scale(1.04);
    opacity: 0.85;
}

.quality {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(29, 9, 56, 0.85);
    border: 1px solid #7b2cbf;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
}

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 38px;
    height: 38px;
    background-color: rgba(46, 16, 84, 0.85);
    border: 1px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 2;
}

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

.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
    padding: 12px 8px 6px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    z-index: 2;
}

.likes,
.views {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #e2d2f9;
}

.likes svg,
.views svg {
    color: #ffaa00;
}

.item-content {
    padding: 10px 12px;
    background-color: #2e1054;
    flex-grow: 1;
}

.item_title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   4. PAGINATION STYLING
   ========================================================================== */
.pagination {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 0px !important;
    margin-bottom: 0px !important;
    padding: 16px !important;
    background-color: #2e1054 !important;
    border: 1px solid #421a75 !important;
    border-radius: 0px !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box !important;
}

.pagination a, 
.pagination span,
.pagination button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background-color: #1d0938;
    border: 1px solid #421a75;
    color: #e2d2f9;
    font-size: 13px;
    font-weight: 600;
    border-radius: 0px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pagination a:hover {
    background-color: #3f1970;
    color: #ffffff;
}

.pagination .active,
.pagination span.current,
.pagination button:disabled {
    background-color: #52238d;
    color: #ffffff;
    border-color: #7b2cbf;
    opacity: 1;
}

/* ==========================================================================
   5. SINGLE VIDEO PLAYER PAGE LAYOUT (.video-layout-container)
   ========================================================================== */
.video-page-header {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto 0px auto !important;
}

.video-page-header .ish1 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.responsive-iframe {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.responsive-iframe iframe,
.responsive-iframe .loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: sans-serif;
}

/* Information & Tag Box Fixes */
.info-card {
    background-color: #2e1054;
    border: 1px solid #421a75;
    border-radius: 0px;
    padding: 12px 14px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    width: 100%;
}

.info-title {
    font-weight: 700;
    font-size: 14px;
    color: #e2d2f9;
    white-space: nowrap;
    flex-shrink: 0;
}

.tags-carousel-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.info-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    white-space: nowrap;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}

.info-scroll::-webkit-scrollbar {
    display: none;
}

.info-btn {
    background-color: #3f1970;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    text-decoration: none;
    border: 1px solid #52238d;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    display: inline-block;
}

.info-btn:hover {
    background-color: #7b2cbf;
    border-color: #a259ff;
}

/* Tag Carousel Scroll Arrow Buttons */
.tag-scroll-btn,
.tags-carousel-wrapper button,
.info-row button {
    background-color: #1d0938 !important;
    border: 1px solid #421a75 !important;
    color: #ffffff !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0 !important;
    z-index: 5;
}

.db-description {
    font-size: 13px;
    font-weight: 400;
    color: #cbb2f6;
    line-height: 1.5;
}

/* Sidebar Related Videos Card */
.video-sidebar {
    width: 100% !important;
}

.sidebar-list-container {
    background-color: #2e1054;
    border: 1px solid #421a75;
    border-radius: 0px;
    overflow: hidden;
}

.sidebar-list-header {
    background-color: #0000ff;
    padding: 12px 12px;
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
    border-bottom: 1px solid #421a75;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
}

.sidebar-item {
    padding: 12px 16px;
    border-bottom: 1px solid #3f1970;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: background-color 0.2s ease;
}

.sidebar-item:last-child {
    border-bottom: none;
}

.sidebar-item:hover {
    background-color: #3f1970;
}

.item-title {
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.item-date {
    color: #aa86e3;
    font-size: 11px;
    padding-left: 22px;
}

/* ==========================================================================
   6. CATEGORY GRIDS
   ========================================================================== */
main {
    padding: 10px;
}

.categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    content-visibility: auto;
}

.categories a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    text-decoration: none;
    text-align: center;
    color: #e5e5e5;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    background: #181818;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    will-change: transform;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.categories a:hover {
    background: #e50914;
    color: #fff;
    transform: translateY(-2px);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
}

.categories a:active {
    transform: scale(0.97);
}

/* ==========================================================================
   7. TITLE HEADING STYLES (.ish1)
   ========================================================================== */
.ish1 {
    color: #ffffff;
    background-color: #2e1054; 
    padding: 10px 5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ish1::-webkit-scrollbar {
    display: none; 
}

/* ==========================================================================
   8. FOOTER STYLES (MATCHES SITE THEME)
   ========================================================================== */
.site-footer {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0px auto 10px auto !important;
    box-sizing: border-box !important;
}

.footer-container {
    background: linear-gradient(180deg, #18092e 0%, #120624 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 0px;
    padding: 16px 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.footer-text {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
}

.footer-text strong {
    color: #ffffff;
    font-weight: 700;
}

.footer-text .divider {
    color: #8b5cf6;
    margin: 0 6px;
}

/* ==========================================================================
   9. RESPONSIVE BREAKPOINTS & MOBILE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .video-layout-container {
        grid-template-columns: 1fr !important;
    }
    .categories {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ish1 {
        font-size: 16px;
        padding: 8px 12px;
        border-radius: 10px;
    }
    .list_title,
    .list_item {
        font-size: 13px;
    }
    .loading {
        font-size: 15px;
    }
}

@media (max-width: 640px) {
    body {
        padding-top: 100px !important;
    }

    .header-container {
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
    }

    .logo {
        flex-shrink: 0;
    }

    .search-box {
        max-width: 170px;
        margin-left: auto;
        padding: 6px 10px;
    }

    .search-box input {
        font-size: 12px;
    }

    .nav-links {
        margin-top: 2px !important;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .video-grid {
        grid-template-columns: repeat(1, 1fr) !important;
        gap: 10px !important;
    }

    .video-layout-container,
    .video-main-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    .responsive-iframe {
        width: 100% !important;
        aspect-ratio: 16 / 9;
        border-left: none;
        border-right: none;
    }

    .info-card {
        padding: 10px 8px;
    }

    .tags-carousel-wrapper {
        width: 100%;
        max-width: 100%;
    }

    main {
        padding: 8px;
    }

    .categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .categories a {
        min-height: 44px;
        font-size: 12px;
        border-radius: 6px;
    }

    .footer-container {
        padding: 12px 14px;
    }

    .footer-text {
        font-size: 11px;
    }
}