/* UI Improvements - More Tasteful Design */

/* Import better fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* CSS Variables for glow control */
:root {
    --glow-amount: 0; /* Default: no glow */
    --primary-color: #8a2be2;
    --secondary-color: #00ff41;
    --text-size-base: 14px; /* Reduced from 16px */
    --heading-scale: 1.2; /* Reduced from 1.5 */
}

/* Override base font */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: var(--text-size-base) !important;
    font-weight: 400;
    letter-spacing: -0.011em;
    overflow-x: hidden !important; /* Prevent horizontal scroll */
}

/* Global overflow prevention */
* {
    box-sizing: border-box !important;
}

html {
    overflow-x: hidden !important;
}

/* Improved typography - smaller, cleaner */
h1 {
    font-size: calc(var(--text-size-base) * 2.5) !important; /* 35px */
    font-weight: 600 !important;
    letter-spacing: -0.035em !important;
    line-height: 1.2 !important;
    color: var(--primary-color) !important;
    text-shadow: none !important;
    margin-bottom: 1.5rem !important;
}

h2 {
    font-size: calc(var(--text-size-base) * 1.8) !important; /* 25.2px */
    font-weight: 600 !important;
    letter-spacing: -0.025em !important;
    line-height: 1.3 !important;
    color: var(--primary-color) !important;
    text-shadow: none !important;
    background: linear-gradient(135deg, 
        rgba(var(--primary-color-rgb), 0.05), 
        rgba(var(--secondary-color-rgb), 0.02)) !important;
    border: 1px solid rgba(var(--primary-color-rgb), 0.2) !important;
    border-radius: 8px !important;
    padding: 12px 20px !important;
    backdrop-filter: blur(4px) !important;
    box-shadow: 0 0 calc(var(--glow-amount) * 20px) rgba(var(--primary-color-rgb), 0.3) !important;
    margin-bottom: 1.2rem !important;
}

h3 {
    font-size: calc(var(--text-size-base) * 1.4) !important; /* 19.6px */
    font-weight: 500 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.4 !important;
    color: var(--secondary-color) !important;
    text-shadow: none !important;
    margin-bottom: 1rem !important;
}

h4, h5, h6 {
    font-family: 'Inter', sans-serif !important;
    font-weight: 500 !important;
    text-shadow: none !important;
}

p, li, td, span {
    font-size: var(--text-size-base) !important;
    line-height: 1.6 !important;
}

/* Code/monospace text */
code, pre, .monospace {
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace !important;
    font-size: calc(var(--text-size-base) * 0.9) !important;
}

/* Remove all glows by default */
.glass-container,
.glass-bg,
.glass-morphism,
.neon-red,
.neon-blue,
.neon-green,
.neon-purple,
.neon-yellow,
.neon-cyan {
    text-shadow: none !important;
    box-shadow: 0 0 calc(var(--glow-amount) * 15px) currentColor !important;
}

/* Clean button styles with theme gradients */
.btn,
button,
[role="button"] {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: calc(var(--text-size-base) * 0.9) !important;
    font-weight: 500 !important;
    letter-spacing: -0.01em !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 0 calc(var(--glow-amount) * 10px) rgba(var(--primary-color-rgb), 0.4) !important;
}

.btn:hover,
button:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 
                0 0 calc(var(--glow-amount) * 15px) rgba(var(--primary-color-rgb), 0.6) !important;
}

/* Control panel buttons - minimal style */
.control-button {
    background: rgba(var(--primary-color-rgb), 0.1) !important;
    border: 1px solid rgba(var(--primary-color-rgb), 0.3) !important;
    backdrop-filter: blur(4px) !important;
}

/* Remove emoji glows */
.emoji-glow {
    filter: none !important;
    text-shadow: none !important;
}

/* Navigation improvements */
nav a {
    font-size: calc(var(--text-size-base) * 0.95) !important;
    font-weight: 500 !important;
    letter-spacing: -0.01em !important;
}

/* Convert RGB for use in rgba() */
:root {
    --primary-color-rgb: 138, 43, 226;
    --secondary-color-rgb: 0, 255, 65;
}

/* Fix video player responsiveness - completely override existing styles */
.video-container {
    position: relative !important;
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    height: 0 !important;
    overflow: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
}

.video-container iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Video section max width constraints */
#videos .max-w-6xl {
    max-width: min(95vw, 72rem) !important;
    margin: 0 auto !important;
}

#video-playlist {
    max-width: 100% !important;
    overflow-x: hidden !important;
    width: 100% !important;
    word-wrap: break-word !important;
}

.playlist-item {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Videos section specific fixes */
#videos {
    padding-left: 8px !important;
    padding-right: 8px !important;
    overflow-x: hidden !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
}

.video-section {
    padding-left: 8px !important;
    padding-right: 8px !important;
    overflow-x: hidden !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
}

/* New video container classes */
.video-outer-container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

.video-main-container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

#videos .max-w-7xl {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Force all video section children to respect viewport */
#videos * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Tailwind overrides for video section */
#videos .w-full {
    width: 100% !important;
    max-width: 100% !important;
}

#videos .px-4 {
    padding-left: 8px !important;
    padding-right: 8px !important;
}

#videos .gap-6 {
    gap: 0.5rem !important;
}

/* Force iframe to respect container */
#videos iframe {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Override the max-w-[85vw] completely for mobile */
#videos .max-w-\[85vw\] {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Override original video-playlist CSS */
.video-playlist {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Override playlist item styles completely */
.playlist-item {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.playlist-item .flex {
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
}

.playlist-item h5,
.playlist-item p {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
}

/* Mobile responsive improvements */
@media (max-width: 1024px) {
    /* Adjust grid for tablets */
    #videos .max-w-6xl {
        max-width: 95vw !important;
        padding: 0 10px !important;
    }
    
    .video-main-container {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        max-width: 95% !important;
        padding: 0 10px !important;
    }
    
    .video-outer-container {
        max-width: 95% !important;
        padding: 0 10px !important;
    }
    
    #videos .lg\\:col-span-2,
    #videos .lg\\:col-span-1 {
        grid-column: span 1 !important;
    }
}

@media (max-width: 768px) {
    /* Force mobile layout */
    #videos,
    .video-section {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
    
    #videos .max-w-6xl {
        max-width: 95vw !important;
        padding: 0 2.5vw !important;
    }
    
    .video-outer-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 4px !important;
    }
    
    .video-main-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    
    #videos .glass-container {
        padding: 8px !important;
        margin: 0 !important;
        border-radius: 8px !important;
    }
}

@media (max-width: 640px) {
    /* Even smaller text on mobile */
    :root {
        --text-size-base: 13px;
    }
    
    h1 {
        font-size: calc(var(--text-size-base) * 2) !important;
    }
    
    h2 {
        font-size: calc(var(--text-size-base) * 1.5) !important;
        padding: 10px 16px !important;
    }
    
    /* Aggressive mobile video fixes */
    #videos,
    .video-section {
        padding: 16px 2px !important;
    }
    
    .video-outer-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 2px !important;
    }
    
    .video-main-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        grid-template-columns: 1fr !important;
        gap: 0.25rem !important;
    }
    
    #videos .glass-container {
        padding: 6px !important;
        margin: 0 !important;
        border-radius: 6px !important;
    }
    
    .video-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #video-playlist {
        max-height: 200px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    
    .playlist-item {
        padding: 6px !important;
        font-size: 11px !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    
    /* Buttons mobile sizing */
    .cyber-button {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
    
    /* Grid system mobile override */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 0.25rem !important;
    }
}

@media (max-width: 480px) {
    /* Extra small devices - most aggressive fixes */
    :root {
        --text-size-base: 12px;
    }
    
    #videos,
    .video-section {
        padding: 12px 1px !important;
    }
    
    .video-outer-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 1px !important;
    }
    
    .video-main-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        grid-template-columns: 1fr !important;
        gap: 0.125rem !important;
    }
    
    #videos .glass-container {
        padding: 4px !important;
        margin: 0 !important;
        border-radius: 4px !important;
    }
    
    .video-container {
        padding-bottom: 56.25% !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    
    .playlist-item {
        padding: 4px !important;
        font-size: 10px !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    
    h3 {
        font-size: calc(var(--text-size-base) * 1.2) !important;
    }
    
    /* Force no horizontal overflow */
    #videos, #videos * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* DEBUG: Add temporary borders to see container boundaries */
    .video-section {
        border: 2px solid red !important;
    }
    
    .video-outer-container {
        border: 2px solid blue !important;
    }
    
    .video-main-container {
        border: 2px solid green !important;
    }
    
    .video-container {
        border: 2px solid yellow !important;
    }
}

/* Admin glow control display */
.glow-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.glow-control input[type="range"] {
    width: 200px;
}

.glow-control-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    min-width: 3ch;
}

/* Remove ALL text shadows and glows unless glow-amount is set */
* {
    text-shadow: none !important;
}

/* Only apply glow when variable is greater than 0 */
.with-glow {
    text-shadow: 0 0 calc(var(--glow-amount) * 10px) currentColor !important;
}

/* Cleaner glass effects */
.glass-container {
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(8px) saturate(1.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Tasteful hover states */
a:not(.btn):hover {
    color: var(--secondary-color) !important;
    text-decoration: none !important;
}

/* Clean form inputs */
input:not([type="submit"]):not([type="button"]),
textarea,
select {
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
    padding: 8px 12px !important;
    font-size: var(--text-size-base) !important;
    transition: border-color 0.2s ease !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color) !important;
    outline: none !important;
}

/* Clean scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-color-rgb), 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-color-rgb), 0.7);
}