/* ═══════════════════════════════════════════════════════════
 * MOBILE UI OPTIMIZATION - JavZone
 * Clean, Fast, Professional Mobile Experience
 * ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    
    /* ═══ HEADER OPTIMIZATION ═══ */
    .header {
        padding: 10px 12px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.3) !important;
    }
    
    .header-content {
        flex-wrap: nowrap !important;
        gap: 10px !important;
    }
    
    .logo img {
        height: 28px !important;
    }
    
    .logo span {
        font-size: 16px !important;
    }
    
    .admin-link {
        font-size: 12px !important;
        padding: 6px 12px !important;
    }
    
    /* ═══ SEARCH BAR ═══ */
    .search-container {
        padding: 12px 15px !important;
        max-width: 100% !important;
    }
    
    .search-form {
        width: 100% !important;
    }
    
    .search-input {
        font-size: 14px !important;
        padding: 10px 14px !important;
        border-radius: 8px !important;
    }
    
    .search-btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
        min-width: 60px !important;
    }
    
    /* ═══ HERO SECTION - COMPACT ═══ */
    .hero-section-compact {
        padding: 15px !important;
        margin-bottom: 12px !important;
    }
    
    .site-brief {
        flex-direction: column !important;
        gap: 8px !important;
        text-align: center !important;
    }
    
    .site-name-small {
        font-size: 20px !important;
        line-height: 1.2 !important;
    }
    
    .site-tagline {
        font-size: 12px !important;
    }
    
    .hero-stats {
        justify-content: center !important;
        gap: 6px !important; /* REDUCED: More compact */
        flex-wrap: wrap !important;
        max-width: 100% !important;
    }
    
    .hero-stats span {
        padding: 4px 8px !important; /* REDUCED: More compact */
        font-size: 10px !important; /* REDUCED: Less visual weight */
        border-radius: 4px !important;
        white-space: nowrap !important;
    }
    
    /* Hide less important stats on very small screens */
    @media (max-width: 360px) {
        .hero-stats span:nth-child(n+3) {
            display: none !important;
        }
    }
    
    /* ═══ TRENDING MARQUEE ═══ */
    .trending-marquee {
        padding: 8px 0 !important;
        font-size: 12px !important;
    }
    
    /* ═══ NAVIGATION - HORIZONTAL SCROLL ═══ */
    .nav {
        background: #1a1a1a !important;
        padding: 10px 0 !important;
        margin-bottom: 15px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
    }
    
    .nav-list {
        display: flex !important;
        gap: 8px !important;
        padding: 0 15px !important;
        min-width: min-content !important;
    }
    
    .nav-item {
        flex-shrink: 0 !important;
    }
    
    .nav-link {
        display: block !important;
        padding: 8px 16px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        border-radius: 20px !important;
        transition: all 0.2s ease !important;
    }
    
    .nav-link.active {
        background: linear-gradient(45deg, #ff6b35, #f7931e) !important;
        color: #fff !important;
    }
    
    /* Hide scrollbar but keep functionality */
    .nav::-webkit-scrollbar {
        height: 0 !important;
        display: none !important;
    }
    
    /* ═══ HERO CAROUSEL - MOBILE OPTIMIZED ═══ */
    .hero-carousel-section {
        margin-bottom: 20px !important;
    }
    
    .hero-carousel {
        max-height: 200px !important; /* REDUCED: More content visible */
        border-radius: 12px !important;
        overflow: hidden !important;
    }
    
    .hero-slide {
        height: 200px !important; /* REDUCED: Better space efficiency */
    }
    
    .hero-background img {
        object-position: center 20% !important;
    }
    
    .hero-content {
        padding: 15px !important;
        bottom: 0 !important;
    }
    
    .hero-category {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    
    .hero-title {
        font-size: 16px !important;
        line-height: 1.3 !important;
        margin: 8px 0 !important;
        max-height: 2.6em !important;
        -webkit-line-clamp: 2 !important;
    }
    
    .hero-description {
        display: none !important; /* Hide on mobile to save space */
    }
    
    .hero-actions {
        margin-top: 10px !important;
        gap: 8px !important;
    }
    
    .hero-btn-primary,
    .hero-btn-secondary {
        padding: 8px 16px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
    }
    
    .hero-dots {
        bottom: 10px !important;
        gap: 6px !important;
    }
    
    .hero-dot {
        width: 6px !important;
        height: 6px !important;
    }
    
    /* ═══ MAIN LAYOUT ═══ */
    .main-layout {
        padding: 0 !important;
    }
    
    .main-content {
        padding: 0 12px 20px !important;
    }
    
    /* ═══ VIDEO GRID - 2 COLUMNS - FIXED OVERLAP! ═══ */
    .video-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important; /* INCREASED: More space between items */
        padding: 0 8px !important; /* ADDED: Side padding */
        margin-bottom: 30px !important; /* ADDED: Bottom margin */
    }
    
    .video-item {
        background: #1a1a1a !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
        margin-bottom: 16px !important; /* ADDED: Prevent overlap */
        min-height: 280px !important; /* ADDED: Consistent height */
        position: relative !important; /* ADDED: Proper positioning */
    }
    
    .video-item:active {
        transform: scale(0.95) !important; /* IMPROVED: More noticeable feedback */
        opacity: 0.9 !important; /* ADDED: Visual feedback */
        box-shadow: 0 4px 12px rgba(255,107,53,0.4) !important; /* ADDED: Highlight */
    }
    
    .video-item:hover {
        box-shadow: 0 4px 16px rgba(255,107,53,0.3) !important; /* ADDED: Desktop hover */
    }
    
    .video-thumbnail {
        position: relative !important;
        width: 100% !important;
        aspect-ratio: 16/9 !important;
        overflow: hidden !important;
        background: #0a0a0a !important;
    }
    
    .video-thumbnail img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .video-play-overlay {
        display: none !important; /* Hide to reduce clutter */
    }
    
    .video-duration {
        position: absolute !important;
        bottom: 6px !important;
        right: 6px !important;
        background: rgba(0,0,0,0.85) !important;
        color: #fff !important;
        padding: 3px 6px !important;
        border-radius: 4px !important;
        font-size: 10px !important;
        font-weight: 700 !important;
    }
    
    .video-info {
        padding: 12px !important; /* INCREASED: More padding */
        min-height: 100px !important; /* ADDED: Consistent height */
        position: relative !important; /* ADDED: Prevent overlap */
        z-index: 2 !important; /* ADDED: Ensure text is on top */
        background: #1a1a1a !important; /* ADDED: Solid background */
    }
    
    .video-title {
        font-size: 13px !important; /* IMPROVED: More readable */
        line-height: 1.4 !important; /* IMPROVED: Better spacing */
        margin-bottom: 4px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important; /* IMPROVED: More context */
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-height: 54px !important; /* ADJUSTED: For 3 lines */
        color: #fff !important;
        font-weight: 500 !important; /* IMPROVED: Stronger hierarchy */
    }
    
    .video-meta {
        font-size: 10px !important;
        color: #888 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .video-category {
        color: #ff6b35 !important;
        font-weight: 600 !important;
    }
    
    .video-date {
        color: #666 !important;
    }
    
    /* ═══ PAGINATION ═══ */
    .pagination {
        padding: 20px 0 !important;
        gap: 8px !important; /* IMPROVED: Better spacing */
    }
    
    .page-link,
    .page-current {
        padding: 12px 16px !important; /* IMPROVED: iOS 44x44px tap target */
        font-size: 14px !important; /* IMPROVED: More readable */
        min-width: 44px !important; /* IMPROVED: Larger tap target */
        min-height: 44px !important; /* ADDED: iOS guidelines */
        border-radius: 8px !important;
        display: flex !important; /* ADDED: Center content */
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
    }
    
    .page-link:active {
        transform: scale(0.95) !important; /* ADDED: Touch feedback */
        background: rgba(255,107,53,0.2) !important;
    }
    
    .pagination-info {
        font-size: 11px !important;
    }
    
    /* ═══ SIDEBAR - HIDE ON MOBILE ═══ */
    .sidebar {
        display: none !important;
    }
    
    /* ═══ ADS - MOBILE OPTIMIZED ═══ */
    .ad-container {
        margin: 15px auto !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .ad-mobile-300x250,
    .hilltop-mobile-inject {
        max-width: min(300px, calc(100vw - 24px)) !important;
        margin: 0 auto !important;
    }
    
    /* ═══ FOOTER ═══ */
    .footer {
        padding: 20px 15px !important;
        margin-top: 30px !important;
    }
    
    .footer-links {
        flex-wrap: wrap !important;
        gap: 16px !important; /* IMPROVED: Better tap spacing */
        font-size: 13px !important; /* IMPROVED: More readable */
        justify-content: center !important;
    }
    
    .footer-links a {
        padding: 8px 4px !important; /* ADDED: Larger tap area */
        min-width: 60px !important; /* ADDED: Prevent cramping */
        text-align: center !important;
    }
    
    .footer-text {
        font-size: 11px !important;
        line-height: 1.6 !important; /* IMPROVED: Better readability */
        margin-top: 12px !important;
    }
    
    /* ═══ CATEGORY CAROUSEL - HORIZONTAL SCROLL ═══ */
    .category-carousel-section {
        margin-bottom: 20px !important;
    }
    
    .category-carousel-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    
    .category-carousel-container::-webkit-scrollbar {
        display: none !important;
    }
    
    .category-carousel {
        display: flex !important;
        gap: 12px !important;
        padding: 8px 0 !important;
    }
    
    .category-video-item {
        flex: 0 0 140px !important;
        width: 140px !important;
    }
    
    .category-video-thumbnail {
        height: 80px !important;
    }
    
    /* ═══ PERFORMANCE OPTIMIZATIONS ═══ */
    * {
        -webkit-tap-highlight-color: transparent !important;
    }
    
    img {
        -webkit-user-drag: none !important;
        user-select: none !important;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth !important;
    }
    
    /* Reduce motion for better performance */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* ═══ SMALL PHONES (≤375px) ═══ */
@media (max-width: 375px) {
    .site-name-small {
        font-size: 18px !important;
    }
    
    .video-grid {
        gap: 8px !important;
    }
    
    .video-title {
        font-size: 11px !important;
    }
    
    .video-meta {
        font-size: 9px !important;
    }
    
    .nav-link {
        padding: 8px 14px !important;
        font-size: 12px !important;
    }
}

/* ═══ LANDSCAPE MODE ═══ */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-carousel {
        max-height: 200px !important;
    }
    
    .hero-slide {
        height: 200px !important;
    }
    
    .hero-section-compact {
        padding: 10px 15px !important;
    }
}

