/*
Theme Name: UltimaTube Swiper
Theme URI: https://www.wp-script.com
Author: WP-Script Swiper Fork
Author URI: https://www.wp-script.com
Description: Highly optimized, mobile-first vertical video swiping theme using Swiper.js.
Version: 1.0.1
License: GNU General Public License v2 or later
Text Domain: wpst-swiper
*/

/* CSS Reset and Body Setup */
html, body, #page, .site-wrapper {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #000;
    color: #fff;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* --------------------------------------------------------------
# Split Screen Layout Framework
--------------------------------------------------------------*/
.main-app-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.left-sidebar {
    width: 280px;
    height: 100%;
    border-right: 1px solid #1f1f1f;
    background-color: #080808;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-sizing: border-box;
    padding: 20px 10px;
    overflow-y: auto;
}

.main-content-area {
    flex-grow: 1;
    height: 100%;
    position: relative;
    background-color: #010101;
    overflow: hidden;
}

/* --------------------------------------------------------------
# Sidebar Navigation Menu Items
--------------------------------------------------------------*/
.sidebar-logo {
    padding: 10px 15px 25px 15px;
}

.sidebar-logo a {
    color: #fe2c55; /* TikTok Brand Color */
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo i {
    font-size: 24px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 15px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav li a i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: #fff;
}

.sidebar-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav li.active a {
    color: #fe2c55;
}

.sidebar-nav li.active a i {
    color: #fe2c55;
}

.sidebar-divider {
    height: 1px;
    background-color: #1f1f1f;
    margin: 20px 15px;
}

.sidebar-section-title {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0 15px 10px 15px;
    letter-spacing: 0.8px;
}

.categories-list li a i {
    color: rgba(255, 255, 255, 0.5);
}

/* --------------------------------------------------------------
# Swiper & Centered Video Card Sizing
--------------------------------------------------------------*/
.mobile-video-swiper {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.swiper-slide {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Desktop Video Card Container */
.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 430px; /* Standard vertical phone wrapper size */
    height: 86%;     /* Allow space above and below the card */
    max-height: 720px;
    border-radius: 12px;
    border: 1px solid #222;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible; /* Let action buttons overflow on the right */
    background-color: #111;
}

.swiper-video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 11px;
    background-color: #000;
}

/* --------------------------------------------------------------
# Floating Action Controls Stack (TikTok Desktop Style)
--------------------------------------------------------------*/
.action-buttons-stack {
    position: absolute;
    right: -70px;
    bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 100;
    pointer-events: auto; /* Active pointer events for overlays */
}

.action-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #2f2f2f;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s, color 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.action-btn:hover {
    background-color: #3f3f3f;
    transform: scale(1.05);
}

.action-btn:active {
    transform: scale(0.95);
}

.like-btn.liked {
    color: #fe2c55;
    background-color: rgba(254, 44, 85, 0.1);
    border: 1px solid rgba(254, 44, 85, 0.3);
}

.like-btn.liked:hover {
    background-color: rgba(254, 44, 85, 0.2);
}

.share-btn.copied {
    color: #25d366; /* Green check */
}

.action-count {
    font-size: 12px;
    font-weight: 500;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* Unmute overlay trigger */
.unmute-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.unmute-btn {
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(5px);
    transition: background-color 0.2s;
}

.unmute-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Video info metadata overlay inside card */
.video-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px 20px 25px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 60%, rgba(0,0,0,0) 100%);
    box-sizing: border-box;
    z-index: 5;
    pointer-events: none;
    border-bottom-left-radius: 11px;
    border-bottom-right-radius: 11px;
}

.video-meta h1 {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------
# Archive Video Grid styling
--------------------------------------------------------------*/
.archive-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 30px;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

.archive-container h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 30px;
    border-left: 4px solid #fe2c55;
    padding-left: 15px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

@media (max-width: 1280px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.grid-item {
    background-color: #0f0f0f;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #1a1a1a;
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-color: #fe2c55;
}

.grid-item a {
    color: #fff;
    text-decoration: none;
}

.grid-thumb {
    position: relative;
    width: 100%;
    padding-top: 133.33%; /* 3:4 portrait ratio for vertical lists */
    background-color: #1a1a1a;
}

.grid-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-meta {
    padding: 10px 12px;
}

.grid-meta h3 {
    font-size: 13px;
    margin: 0;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: rgba(255, 255, 255, 0.9);
}

/* Empty feedback block */
.no-videos-found {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
}

/* --------------------------------------------------------------
# Responsiveness & Mobile Overrides
--------------------------------------------------------------*/
@media (max-width: 900px) {
    .left-sidebar {
        display: none; /* Hide sidebar completely on mobile and narrow viewports */
    }

    .video-wrapper {
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .swiper-video-player {
        border-radius: 0;
    }

    .action-buttons-stack {
        right: 15px; /* Float inside the video card on mobile views */
        bottom: 80px;
    }
    
    .video-meta {
        border-radius: 0;
        padding-right: 80px; /* Reserve space so tags do not overlap action buttons */
    }
}

/* --------------------------------------------------------------
# Hover Video Player inside Grid Thumbnails (Desktop)
--------------------------------------------------------------*/
.hover-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    background-color: #000;
}

.hover-video.playing {
    opacity: 1;
}

/* --------------------------------------------------------------
# Custom Scrollbars (Sidebar and Grid Area)
--------------------------------------------------------------*/
.left-sidebar::-webkit-scrollbar,
.archive-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.left-sidebar::-webkit-scrollbar-track,
.archive-container::-webkit-scrollbar-track {
    background: #1f1f1f; /* dark grey background */
    border-radius: 4px;
}

.left-sidebar::-webkit-scrollbar-thumb,
.archive-container::-webkit-scrollbar-thumb {
    background: #fe2c55; /* scroller color */
    border-radius: 4px;
}

.left-sidebar::-webkit-scrollbar-thumb:hover,
.archive-container::-webkit-scrollbar-thumb:hover {
    background: #e0264b;
}

/* Firefox compatibility */
.left-sidebar,
.archive-container {
    scrollbar-width: thin;
    scrollbar-color: #fe2c55 #1f1f1f;
}

/* --------------------------------------------------------------
# Hide Default Numerical Pagination (If injected by WP or plugins)
--------------------------------------------------------------*/
.archive-container .pagination,
.archive-container .nav-links,
.archive-container .page-numbers,
.archive-container .wp-pagenavi,
.archive-container .navigation,
.archive-container .posts-navigation,
nav.pagination {
    display: none !important;
}

/* --------------------------------------------------------------
# Hide Desktop Actions & Share Popups on Mobile Viewports
--------------------------------------------------------------*/
@media (max-width: 900px) {
    .desktop-video-title,
    .desktop-actions-sidebar,
    .desktop-action-btn,
    .desktop-video-progress-container,
    .desktop-swiper-nav,
    .desktop-share-modal,
    .share-action-btn,
    .video-share-popup {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}
