/* Background Animation Interference Fix Styles */

/* 1. ENHANCED DARK THEME SUPPORT - Made more visible */
.dark #network-bg {
    opacity: 0.4 !important;
    filter: blur(1px);
    backdrop-filter: blur(8px);
}

.dark #network-canvas {
    filter: blur(0.5px) opacity(0.35);
    mix-blend-mode: screen;
}

/* Enhanced dark mode background overlay - Reduced for better animation visibility */
.dark::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: -5;
    pointer-events: none;
}

/* 2. CONTENT READABILITY ENHANCEMENTS */
.content-readable {
    position: relative;
    z-index: 10;
    backdrop-filter: blur(6px);
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.dark .content-readable {
    background-color: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Enhanced text contrast zones */
.text-focus-zone {
    position: relative;
    z-index: 15;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(255, 255, 255, 0.85) 100%);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.dark .text-focus-zone {
    background: linear-gradient(135deg, 
        rgba(17, 24, 39, 0.98) 0%, 
        rgba(31, 41, 55, 0.95) 100%);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 2. SMART BACKGROUND DIMMING */
.background-dimmed {
    position: relative;
}

.background-dimmed::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.background-dimmed.active::before {
    opacity: 1;
}

.dark .background-dimmed::before {
    background: rgba(0, 0, 0, 0.7);
}

/* 3. SCROLL-BASED BACKGROUND CONTROL - DISABLED */
/* .scroll-dimming {
    transition: opacity 0.2s ease;
}

.scroll-dimming.scrolling {
    opacity: 0.3 !important;
} */

/* 4. CONTENT-AWARE ZONES */
.hero-section,
.contact-section,
.about-section,
.services-section {
    position: relative;
    z-index: 10;
}

.hero-section .hero-content,
.contact-section .contact-form,
.about-section .about-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark .hero-section .hero-content,
.dark .contact-section .contact-form,
.dark .about-section .about-content {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}

/* 5. IMPROVED CARD READABILITY */
.card,
.testimonial,
.service-card {
    position: relative;
    z-index: 12;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.dark .card,
.dark .testimonial,
.dark .service-card {
    background: rgba(17, 24, 39, 0.98) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.card:hover,
.testimonial:hover,
.service-card:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.dark .card:hover,
.dark .testimonial:hover,
.dark .service-card:hover {
    background: rgba(17, 24, 39, 0.99) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 6. NAVIGATION READABILITY */
.navbar,
.header {
    position: relative;
    z-index: 50;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .navbar,
.dark .header {
    background: rgba(17, 24, 39, 0.98) !important;
    backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* 7. FORM READABILITY ENHANCEMENTS */
.form-container,
.contact-form,
form {
    position: relative;
    z-index: 15;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark .form-container,
.dark .contact-form,
.dark form {
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}

.form-container input,
.form-container textarea,
.form-container select,
.contact-form input,
.contact-form textarea,
.contact-form select {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .form-container input,
.dark .form-container textarea,
.dark .form-container select,
.dark .contact-form input,
.dark .contact-form textarea,
.dark .contact-form select {
    background: rgba(31, 41, 55, 0.95) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
}

/* 8. BUTTON ENHANCEMENTS */
.btn,
button {
    position: relative;
    z-index: 20;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

/* 9. MOBILE OPTIMIZATIONS */
@media (max-width: 768px) {
    .content-readable,
    .text-focus-zone,
    .hero-content,
    .contact-form,
    .about-content {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
    }
      .dark .content-readable,
    .dark .text-focus-zone,
    .dark .hero-content,
    .dark .contact-form,
    .dark .about-content {
        background: rgba(17, 24, 39, 0.99);
        backdrop-filter: blur(16px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    }
}

/* 10. REDUCED MOTION SUPPORT */
@media (prefers-reduced-motion: reduce) {
    .content-readable,
    .text-focus-zone,
    .card,
    .testimonial,
    .service-card {
        transition: none;
    }
    
    .card:hover,
    .testimonial:hover,
    .service-card:hover {
        transform: none;
    }
}

/* 11. HIGH CONTRAST MODE SUPPORT */
@media (prefers-contrast: high) {
    .content-readable,
    .text-focus-zone,
    .hero-content,
    .contact-form,
    .about-content {
        background: rgba(255, 255, 255, 0.98);
        border: 2px solid rgba(0, 0, 0, 0.2);
    }
    
    .dark .content-readable,
    .dark .text-focus-zone,
    .dark .hero-content,
    .dark .contact-form,
    .dark .about-content {
        background: rgba(0, 0, 0, 0.98);
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
}

/* 12. FOCUS MANAGEMENT */
*:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    z-index: 100;
    position: relative;
}

/* 13. ACCESSIBILITY IMPROVEMENTS */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 14. PERFORMANCE OPTIMIZATIONS */
.background-optimized {
    will-change: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 15. CONTENT PRIORITY ZONES */
.priority-content {
    position: relative;
    z-index: 25;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 2rem;
    border: 2px solid rgba(59, 130, 246, 0.2);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.1);
}

.dark .priority-content {
    background: rgba(17, 24, 39, 0.95);
    border: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.2);
}

/* 16. ADVANCED DARK THEME BACKGROUND CONTROL */
.dark {
    /* Global dark theme background overlay for better content separation */
    position: relative;
}

.dark body {
    background-attachment: fixed;
    background-blend-mode: multiply;
}

/* Enhanced network background control in dark mode - Made more visible */
.dark #network-bg {
    opacity: 0.4 !important;
    filter: blur(1px) contrast(0.8);
    mix-blend-mode: screen;
    background-blend-mode: lighten;
}

.dark #network-canvas {
    filter: blur(0.5px) opacity(0.35) grayscale(0%);
    mix-blend-mode: screen;
}

/* Scrolling state in dark mode - DISABLED */
/* .dark .scroll-dimming.scrolling {
    opacity: 0.05 !important;
}

.dark .scroll-dimming.scrolling #network-canvas {
    filter: blur(4px) opacity(0.03);
} */

/* Enhanced dark mode background adjustments */
.dark #network-bg.ultra-dim {
    opacity: 0.02 !important;
    filter: blur(6px) grayscale(80%) contrast(0.3);
}

.dark #network-canvas.ultra-dim {
    filter: blur(5px) opacity(0.01) grayscale(90%);
}

/* Content focus mode for dark theme */
.dark.content-focus-mode #network-bg {
    opacity: 0.01 !important;
    filter: blur(8px) grayscale(90%) contrast(0.2);
    backdrop-filter: none;
}

.dark.content-focus-mode #network-canvas {
    filter: blur(6px) opacity(0.005) grayscale(100%);
}

/* Dark mode scrolling enhancements */
.dark.dark-mode-minimal-animation #network-bg {
    opacity: 0.005 !important;
    filter: blur(10px) grayscale(100%) contrast(0.1);
}

.dark.dark-mode-minimal-animation #network-canvas {
    filter: blur(8px) opacity(0.002) grayscale(100%);
}

/* Dark theme mobile optimizations */
@media (max-width: 768px) {
    .dark #network-bg {
        opacity: 0.1 !important;
        filter: blur(6px) grayscale(60%);
    }
    
    .dark #network-canvas {
        filter: blur(5px) opacity(0.05) grayscale(70%);
    }
    
    .dark .content-readable,
    .dark .text-focus-zone,
    .dark .hero-content,
    .dark .contact-form,
    .dark .about-content {
        background: rgba(17, 24, 39, 0.98);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

@media (max-width: 480px) {
    .dark #network-bg {
        opacity: 0.4 !important;
        filter: blur(1px);
    }
    
    .dark #network-canvas {
        filter: blur(0.5px) opacity(0.35);
    }
}

/* 22. DARK MODE PERFORMANCE OPTIMIZATION */
.dark .background-optimized {
    will-change: opacity, filter;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce GPU usage in dark mode */
.dark #network-canvas {
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
}

/* 23. ACCESSIBILITY IMPROVEMENTS FOR DARK MODE */
@media (prefers-contrast: high) {
    .dark .content-readable,
    .dark .text-focus-zone,
    .dark .hero-content,
    .dark .contact-form,
    .dark .about-content {
        background: rgba(0, 0, 0, 0.99);
        border: 3px solid rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(30px);
    }
    
    .dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6 {
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.9);
        background: rgba(0, 0, 0, 0.8);
        padding: 0.5rem;
        border-radius: 4px;
    }
}

/* 24. DARK MODE UTILITY CLASSES */
.dark-mode-content-shield {
    position: relative;
    background: rgba(17, 24, 39, 0.98) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1.5rem;
    z-index: 20;
}

.dark-mode-text-enhance {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(8px);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.dark-mode-minimal-bg {
    background: rgba(0, 0, 0, 0.95) !important;
    backdrop-filter: blur(30px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}
