/*
 * La Stanza - AI Orchestration Platform
 * Custom Styles
 */

/* ============================================
   DYNAMIC BACKGROUND SYSTEM
   ============================================ */
#dynamic-bg {
    z-index: 0;
}

#bg-image-layer {
    will-change: transform;
}

#bg-image {
    filter: brightness(0.7) saturate(1.2);
    transition: filter 0.5s ease;
}

/* Scanlines effect */
.bg-scanlines {
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.1) 2px,
            rgba(0, 0, 0, 0.1) 4px);
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100px;
    }
}

/* Radial vignette */
.bg-radial-vignette {
    background: radial-gradient(ellipse at center,
            transparent 0%,
            transparent 40%,
            rgba(10, 14, 23, 0.4) 70%,
            rgba(10, 14, 23, 0.8) 100%);
}

/* Glow spots animation */
.glow-spot {
    animation: glow-pulse 4s ease-in-out infinite;
}

.glow-spot[data-delay="0.5"] {
    animation-delay: 0.5s;
}

.glow-spot[data-delay="1"] {
    animation-delay: 1s;
}

.glow-spot[data-delay="1.5"] {
    animation-delay: 1.5s;
}

@keyframes glow-pulse {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* Slow pulse for main glow */
.animate-pulse-slow {
    animation: pulse-slow 6s ease-in-out infinite;
}

@keyframes pulse-slow {

    0%,
    100% {
        opacity: 0.1;
        transform: translate(-50%, -33%) scale(1);
    }

    50% {
        opacity: 0.25;
        transform: translate(-50%, -33%) scale(1.1);
    }
}

/* Energy lines effect */
.energy-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
    animation: energy-flow 3s ease-in-out infinite;
}

@keyframes energy-flow {
    0% {
        transform: translateX(-100%) scaleX(0.5);
        opacity: 0;
    }

    50% {
        opacity: 1;
        transform: translateX(0) scaleX(1);
    }

    100% {
        transform: translateX(100%) scaleX(0.5);
        opacity: 0;
    }
}

/* Floating particles CSS fallback */
.floating-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--neon-cyan);
    border-radius: 50%;
    animation: float-particle 10s ease-in-out infinite;
    opacity: 0.5;
}

@keyframes float-particle {

    0%,
    100% {
        transform: translateY(0) translateX(0);
    }

    25% {
        transform: translateY(-20px) translateX(10px);
    }

    50% {
        transform: translateY(-10px) translateX(-10px);
    }

    75% {
        transform: translateY(-30px) translateX(5px);
    }
}

/* ============================================
   CSS VARIABLES & ROOT STYLES
   ============================================ */
:root {
    --void: #0a0e17;
    --void-light: #0f1521;
    --void-lighter: #151c2c;
    --neon-cyan: #00d4ff;
    --neon-pink: #ff4d8d;
    --neon-purple: #7b68ee;
    --neon-green: #00ff88;

    --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
    --glow-pink: 0 0 20px rgba(255, 77, 141, 0.3);
    --glow-purple: 0 0 20px rgba(123, 104, 238, 0.3);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::selection {
    background: var(--neon-cyan);
    color: var(--void);
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--void);
}

::-webkit-scrollbar-thumb {
    background: var(--void-lighter);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.gradient-text {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: var(--void);
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-cyan);
}

/* ============================================
   NAVIGATION
   ============================================ */
#navbar {
    background: transparent;
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                backdrop-filter 0.3s ease,
                box-shadow 0.3s ease;
}

#navbar.scrolled {
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Navbar hidden state - slides up when scrolling down */
#navbar.nav-hidden {
    transform: translateY(-100%);
}

/* Navbar visible state - slides down when scrolling up */
#navbar.nav-visible {
    transform: translateY(0);
}

/* Glow effect when navbar appears */
#navbar.scrolled.nav-visible {
    animation: navGlow 0.5s ease-out;
}

@keyframes navGlow {
    0% {
        box-shadow: 0 4px 30px rgba(0, 212, 255, 0.3);
    }
    100% {
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    }
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--neon-cyan);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* ============================================
   HERO SECTION
   ============================================ */
#hero {
    min-height: 100vh;
    position: relative;
}

.hero-title {
    position: relative;
    display: inline-block;
}

.hero-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
}

/* ============================================
   CARDS & CONTAINERS
   ============================================ */
.application-card {
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.application-card:hover {
    transform: translateY(-10px);
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

/* ============================================
   COMPARISON TABLE
   ============================================ */
.comparison-row {
    position: relative;
}

.comparison-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--neon-cyan);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.comparison-row:hover::before {
    transform: scaleY(1);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 212, 255, 0.6);
    }
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation Classes */
.animate-fadeInUp {
    animation: fadeInUp 0.8s ease forwards;
}

.animate-fadeIn {
    animation: fadeIn 0.6s ease forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.6s ease forwards;
}

.animate-slideInLeft {
    animation: slideInLeft 0.8s ease forwards;
}

.animate-slideInRight {
    animation: slideInRight 0.8s ease forwards;
}

/* ============================================
   THREE.JS CANVAS
   ============================================ */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#canvas-container canvas {
    width: 100%;
    height: 100%;
}

/* ============================================
   FORM STYLES
   ============================================ */
input:focus,
textarea:focus {
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

input:-webkit-autofill,
textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--void) inset !important;
    -webkit-text-fill-color: white !important;
}

#form-status.success {
    background: rgba(0, 255, 136, 0.1);
    color: var(--neon-green);
    border: 1px solid var(--neon-green);
}

#form-status.error {
    background: rgba(255, 107, 53, 0.1);
    color: var(--neon-pink);
    border: 1px solid var(--neon-pink);
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
    position: relative;
}

.chart-container canvas {
    max-height: 300px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 3.5rem;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    section {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

    .comparison-row {
        font-size: 0.875rem;
    }
}

@media (max-width: 640px) {

    /* Stack comparison table on mobile */
    .comparison-row {
        display: flex;
        flex-direction: column;
    }

    .comparison-row>div {
        border-left: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .comparison-row>div:first-child {
        border-top: none;
    }
}

/* ============================================
   GSAP ANIMATION INITIAL STATES
   ============================================ */
.gsap-hidden {
    opacity: 0;
    visibility: hidden;
}

/* ============================================
   PARTICLE EFFECTS
   ============================================ */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--neon-cyan);
    border-radius: 50%;
    pointer-events: none;
}

/* ============================================
   GLOW EFFECTS
   ============================================ */
.glow-cyan {
    box-shadow: var(--glow-cyan);
}

.glow-pink {
    box-shadow: var(--glow-pink);
}

.glow-purple {
    box-shadow: var(--glow-purple);
}

/* Text glow on hover */
.text-glow-cyan:hover {
    text-shadow: 0 0 10px var(--neon-cyan);
}

.text-glow-pink:hover {
    text-shadow: 0 0 10px var(--neon-pink);
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   NOISE TEXTURE OVERLAY
   ============================================ */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ============================================
   METRIC COUNTERS
   ============================================ */
.counter {
    font-variant-numeric: tabular-nums;
}

/* ============================================
   IMAGE PLACEHOLDERS
   ============================================ */
.image-placeholder {
    background: linear-gradient(135deg, var(--void-lighter), var(--void-light));
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    #canvas-container,
    .noise-overlay {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}

.typewriter-cursor {
    font-weight: 100;
    animation: blink 0.7s infinite;
}

.typewriter-cursor.blinking-pause {
    animation: blink 0.4s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* ============================================
   VIDEO PLAYER CONTROLS
   ============================================ */
.video-container {
    position: relative;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.25rem;
    background: linear-gradient(to top, rgba(10, 14, 23, 0.9), transparent);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-container:hover .video-controls {
    opacity: 1;
}

.video-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.video-btn:hover {
    background: var(--neon-cyan);
    border-color: var(--neon-cyan);
    color: var(--void);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.video-btn.active {
    background: var(--neon-pink);
    border-color: var(--neon-pink);
    color: white;
}

.video-progress {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.video-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    width: 0%;
    pointer-events: none;
}

.video-progress:hover {
    height: 6px;
    margin-top: -1px;
}

.video-progress:active {
    cursor: grabbing;
}

/* ============================================
   DYNAMIC IMAGE EFFECTS
   ============================================ */
.dynamic-image-container {
    position: relative;
    overflow: hidden;
}

.dynamic-image {
    transition: transform 0.5s ease, filter 0.5s ease;
}

.dynamic-image-container:hover .dynamic-image {
    transform: scale(1.05);
}

/* Glow overlay on hover */
.dynamic-image-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
                rgba(0, 212, 255, 0.3) 0%,
                transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.dynamic-image-container:hover::before {
    opacity: 1;
}

/* Scan line effect */
.dynamic-image-container::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
                transparent 0%,
                rgba(0, 212, 255, 0.1) 50%,
                transparent 100%);
    z-index: 2;
    pointer-events: none;
}

.dynamic-image-container:hover::after {
    animation: scan-line 2s linear infinite;
}

@keyframes scan-line {
    0% {
        top: -100%;
    }
    100% {
        top: 100%;
    }
}

/* Corner accents */
.image-corner-accent {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid var(--neon-cyan);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 3;
}

.image-corner-accent.top-left {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

.image-corner-accent.top-right {
    top: 10px;
    right: 10px;
    border-left: none;
    border-bottom: none;
}

.image-corner-accent.bottom-left {
    bottom: 10px;
    left: 10px;
    border-right: none;
    border-top: none;
}

.image-corner-accent.bottom-right {
    bottom: 10px;
    right: 10px;
    border-left: none;
    border-top: none;
}

.dynamic-image-container:hover .image-corner-accent {
    opacity: 1;
}

.dynamic-image-container:hover .image-corner-accent.top-left {
    top: 15px;
    left: 15px;
}

.dynamic-image-container:hover .image-corner-accent.top-right {
    top: 15px;
    right: 15px;
}

.dynamic-image-container:hover .image-corner-accent.bottom-left {
    bottom: 15px;
    left: 15px;
}

.dynamic-image-container:hover .image-corner-accent.bottom-right {
    bottom: 15px;
    right: 15px;
}

/* Green variant for dynamic images */
.dynamic-image-green::before {
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
                rgba(0, 255, 136, 0.3) 0%,
                transparent 50%);
}

.dynamic-image-green::after {
    background: linear-gradient(to bottom,
                transparent 0%,
                rgba(0, 255, 136, 0.1) 50%,
                transparent 100%);
}

.dynamic-image-green .image-corner-accent {
    border-color: var(--neon-green);
}

/* ============================================
   ANIMATED DIVIDER
   ============================================ */
.animated-divider {
    position: relative;
}

.animate-divider-glow {
    animation: divider-glow 3s ease-in-out infinite;
}

@keyframes divider-glow {
    0%, 100% {
        opacity: 0.2;
        transform: scaleY(0.8);
    }
    50% {
        opacity: 0.8;
        transform: scaleY(1);
    }
}