@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap');

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Performance Optimizations */
html {
    scroll-behavior: smooth;
}

/* Liquid Glass Body Styles */
body {
    font-family: 'Poppins', sans-serif;
    background: radial-gradient(ellipse at 30% 20%, #1a1a2e 0%, #16213e 50%, #0a0a0a 100%);
    color: #fff;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    /* Use transform for better performance */
    animation: liquidFlow 20s ease-in-out infinite;
    /* Hardware acceleration */
    transform: translateZ(0);
    will-change: auto;
}

/* Optimized background animation */
@keyframes liquidFlow {
    0%, 100% {
        background: radial-gradient(ellipse at 30% 20%, #1a1a2e 0%, #16213e 50%, #0a0a0a 100%);
    }
    33% {
        background: radial-gradient(ellipse at 70% 30%, #1a1a2e 0%, #16213e 50%, #0a0a0a 100%);
    }
    66% {
        background: radial-gradient(ellipse at 50% 80%, #1a1a2e 0%, #16213e 50%, #0a0a0a 100%);
    }
}

/* Reduced complexity for liquid overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.08) 0%, transparent 40%);
    z-index: -1;
    /* Smoother, more performant animation */
    animation: liquidFloat 25s linear infinite;
    pointer-events: none;
}

@keyframes liquidFloat {
    0% { 
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    25% { 
        transform: translate(-15px, 8px) scale(1.02);
        opacity: 0.8;
    }
    50% { 
        transform: translate(8px, -12px) scale(1);
        opacity: 0.5;
    }
    75% { 
        transform: translate(12px, 4px) scale(1.01);
        opacity: 0.7;
    }
    100% { 
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.4, 1);
    position: relative;
}

a:hover {
    color: #ff6b6b;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.6);
    transform: translateY(-1px);
}

/* Optimized Liquid Glass Container */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 25px;
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.4, 1);
    /* Performance optimizations */
    transform: translateZ(0);
    will-change: transform, box-shadow;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transition: left 0.8s ease;
    z-index: 1;
}

.container:hover::before {
    left: 100%;
}

.container:hover {
    transform: translateY(-4px) scale(1.005);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Optimized Video Player */
.video-player {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    position: relative;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.4, 1);
    /* Prevent layout shifts */
    aspect-ratio: 16 / 9;
    min-height: 300px;
}

.video-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.08), 
        transparent);
    transition: left 0.6s ease;
    z-index: 2;
}

.video-player:hover::before {
    left: 100%;
}

.video-player:hover {
    transform: translateY(-2px) scale(1.008);
    box-shadow: 
        0 15px 35px rgba(255, 107, 107, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.video-player video {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    object-fit: cover;
    transition: all 0.3s ease;
    filter: brightness(0.98) contrast(1.02);
    /* Hardware acceleration */
    transform: translateZ(0);
}

.video-player:hover video {
    filter: brightness(1.02) contrast(1.05);
}

/* Optimized Video Details */
.video-details {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.video-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 107, 107, 0.4), 
        transparent);
}

.video-details:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 30px rgba(255, 107, 107, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.video-details h3 {
    font-size: clamp(24px, 4vw, 36px); /* Better responsive scaling */
    font-weight: 700;
    margin-top: 0;
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
    font-family: 'Orbitron', sans-serif;
    animation: liquidGlow 4s ease-in-out infinite;
    position: relative;
    padding-bottom: 12px;
    line-height: 1.2;
    /* Performance optimization */
    will-change: transform;
}

@keyframes liquidGlow {
    0%, 100% { 
        text-shadow: 
            0 0 15px rgba(255, 107, 107, 0.5),
            0 0 30px rgba(255, 107, 107, 0.3);
    }
    50% { 
        text-shadow: 
            0 0 25px rgba(255, 107, 107, 0.7),
            0 0 50px rgba(255, 107, 107, 0.4);
    }
}

.video-details h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, #ff6b6b, transparent);
    border-radius: 1px;
    animation: liquidLine 4s ease-in-out infinite;
}

@keyframes liquidLine {
    0%, 100% { 
        width: 80px;
        opacity: 0.6;
    }
    50% { 
        width: 150px;
        opacity: 1;
    }
}

.user-info, .upload-date {
    color: #ccc;
    font-size: clamp(14px, 2vw, 16px);
    margin: 10px 0;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.25s ease;
    line-height: 1.4;
}

.user-info:hover, .upload-date:hover {
    color: #fff;
    border-bottom: 1px solid rgba(255, 107, 107, 0.2);
    transform: translateX(3px);
}

.views {
    font-size: clamp(14px, 2vw, 18px);
    color: #ff6b6b;
    font-weight: 600;
    text-shadow: 0 0 12px rgba(255, 107, 107, 0.4);
    padding: 8px 16px;
    background: rgba(255, 107, 107, 0.08);
    border-radius: 12px;
    display: inline-block;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    animation: pulseView 6s ease-in-out infinite;
}

@keyframes pulseView {
    0%, 100% { 
        background: rgba(255, 107, 107, 0.08);
        transform: scale(1);
    }
    50% { 
        background: rgba(255, 107, 107, 0.15);
        transform: scale(1.03);
    }
}

.views:hover {
    transform: scale(1.05);
    background: rgba(255, 107, 107, 0.2);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.3);
}

/* Optimized Ad Notification */
.ad-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 15px 30px;
    border-radius: 25px;
    color: #fff;
    font-size: clamp(14px, 3vw, 18px);
    display: none;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    animation: liquidSlideUp 0.5s cubic-bezier(0.2, 0.8, 0.4, 1);
    z-index: 1000;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
}

@keyframes liquidSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ad-notification:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 
        0 12px 30px rgba(255, 107, 107, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Enhanced Particle Animation with better performance */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
    /* Reduce paint operations */
    pointer-events: none;
}

/* Optimized Responsive Scaling */
@media (max-width: 1200px) {
    .container {
        width: 92%;
        padding: 25px;
    }
    
    .video-player {
        aspect-ratio: 16 / 9;
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
        margin: 20px auto;
        backdrop-filter: blur(25px);
    }

    .video-details {
        padding: 20px;
    }

    .video-details h3::after {
        width: 60px;
    }
    
    @keyframes liquidLine {
        0%, 100% { width: 60px; }
        50% { width: 100px; }
    }

    .ad-notification {
        padding: 12px 20px;
        bottom: 15px;
        font-size: 14px;
    }

    .video-player {
        margin-bottom: 20px;
        min-height: 200px;
    }
    
    /* Reduce animations on mobile for better performance */
    @media (prefers-reduced-motion: reduce) {
        body::before,
        .video-details h3,
        .views {
            animation: none;
        }
    }
}

@media (max-width: 480px) {
    .container {
        width: 98%;
        padding: 15px;
        margin: 15px auto;
        border-radius: 15px;
    }
    
    .video-details {
        padding: 15px;
        border-radius: 15px;
    }
    
    .video-player {
        border-radius: 15px;
        min-height: 180px;
    }
    
    .video-player video {
        border-radius: 15px;
    }
    
    .user-info, .upload-date, .views {
        font-size: 13px;
    }
}

/* High-DPI screen optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .container,
    .video-details,
    .video-player {
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
    }
}

/* Reduced motion support for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body::before,
    .container::before,
    .video-player::before {
        animation: none !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .container:hover,
    .video-player:hover,
    .video-details:hover,
    .ad-notification:hover {
        transform: none;
    }
    
    /* Increase tap targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
}