
/* EcoPulse - Custom Styles */
/* Author: Hackathon 2025 */

/* CSS Variables for Theme */
:root {
    --eco-blue: #0ea5e9;
    --eco-green: #10b981;
    --eco-orange: #f97316;
    --eco-red: #ef4444;
    --eco-purple: #a855f7;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
}

/* Page-specific themes */
body:has(#air-3d-scene) {
    background: linear-gradient(to bottom, #1a0a0a, #2a1010) !important;
}

body:has(#water-3d-scene) {
    background: linear-gradient(to bottom, #001a33, #002244) !important;
}

body:has(#light-3d-scene) {
    background: linear-gradient(to bottom, #1a0f00, #2a1a00) !important;
}

body:has(#noise-3d-scene) {
    background: linear-gradient(to bottom, #1a0a2a, #2a1040) !important;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-900);
    color: white;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Utility Classes */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation Styles */
nav {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.nav-link {
    position: relative;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--eco-blue), var(--eco-green));
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Hero Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--eco-blue), var(--eco-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(14, 165, 233, 0.5);
    filter: drop-shadow(0 0 20px rgba(14, 165, 233, 0.8));
}

/* Card Styles */
.card {
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

/* Shimmer effect on card hover */
.card::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.5s;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--eco-blue);
    box-shadow: 
        0 20px 40px rgba(14, 165, 233, 0.2),
        0 0 0 1px rgba(14, 165, 233, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--eco-blue), var(--eco-green));
    color: white;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* 3D Scene Container */
.scene-container {
    position: relative;
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    min-height: 400px;
}

.scene-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--eco-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* Chart Container */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* Stats Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-item {
    animation: countUp 0.6s ease-out;
}

/* Range Slider Styles - Enhanced for Mobile Touch */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    border-radius: 6px;
    outline: none;
    transition: opacity 0.2s;
    /* Ensure proper touch handling on mobile devices */
    touch-action: none;
    /* Prevent text selection during drag on mobile */
    -webkit-user-select: none;
    user-select: none;
    background: linear-gradient(to right, var(--eco-blue) 0%, var(--gray-600) 0%);
    background-size: 100% 100%;
}

input[type="range"]:hover {
    opacity: 0.9;
}

/* Enhanced touch target size for mobile - Apple HIG recommends minimum 44x44px */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--eco-blue);
    cursor: pointer;
    /* Add white border for better visibility */
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(14, 165, 233, 0.5);
    /* Enable hardware acceleration for smooth dragging */
    transform: translateZ(0);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input[type="range"]::-moz-range-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--eco-blue);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(14, 165, 233, 0.5);
    transform: translateZ(0);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Active state for better touch feedback */
input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.1) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(14, 165, 233, 0.8);
}

input[type="range"]:active::-moz-range-thumb {
    transform: scale(1.1) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(14, 165, 233, 0.8);
}

/* Track styling for WebKit browsers */
input[type="range"]::-webkit-slider-runnable-track {
    height: 12px;
    border-radius: 6px;
    background: var(--gray-700);
}

input[type="range"]::-moz-range-track {
    height: 12px;
    border-radius: 6px;
    background: var(--gray-700);
}

/* Select Dropdown */
select {
    background-color: var(--gray-700);
    border: 1px solid var(--gray-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

select:hover {
    border-color: var(--eco-blue);
}

select:focus {
    border-color: var(--eco-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

/* Modal Styles */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

/* Tooltip */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    padding: 0.5rem 1rem;
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 0.875rem;
}

.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* Scroll Reveal Animation */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Pulse Animation for Important Elements */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Accessibility - Focus Styles */
*:focus {
    outline: 2px solid var(--eco-blue);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--eco-blue);
    outline-offset: 4px;
}

/* Skip to Content Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--eco-blue);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Print Styles */
@media print {
    nav,
    button,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .scene-container {
        min-height: 300px;
    }
    
    .card {
        padding: 1rem;
    }
    
    /* Increase slider padding on mobile for easier interaction */
    input[type="range"] {
        /* Add vertical padding to increase touch area */
        padding: 16px 0;
        margin: 8px 0;
    }
    
    /* Make slider labels more prominent on mobile */
    input[type="range"] + label,
    label[for*="slider"] {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        display: block;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
    
    /* Further increase touch targets on small phones */
    input[type="range"]::-webkit-slider-thumb {
        width: 48px;
        height: 48px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 48px;
        height: 48px;
    }
    
    /* Ensure minimum spacing between interactive elements */
    .control-group {
        margin-bottom: 1.5rem;
    }
}

/* Dark Mode Support (already dark by default) */
@media (prefers-color-scheme: light) {
    /* Users can override with light mode if needed */
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }
    
    button,
    .btn {
        border: 2px solid currentColor;
    }
}

/* WebGL Fallback Styles */
.webgl-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(16, 185, 129, 0.1));
    border-radius: 1rem;
}

.webgl-fallback svg {
    max-width: 100%;
    height: auto;
}

/* Particle Background Effect */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--gray-900);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-700);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--eco-blue);
}

/* Presentation Mode Styles */
.presentation-slide {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.slide-indicator {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.slide-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slide-dot.active {
    background: var(--eco-blue);
    transform: scale(1.3);
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--eco-red);
}

.badge-warning {
    background: rgba(249, 115, 22, 0.2);
    color: var(--eco-orange);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--eco-green);
}

.badge-info {
    background: rgba(14, 165, 233, 0.2);
    color: var(--eco-blue);
}

/* Grid Layout Utilities */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Flex Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 {
    gap: 1rem;
}

.gap-8 {
    gap: 2rem;
}

/* Spacing Utilities */
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--gray-800) 25%, var(--gray-700) 50%, var(--gray-800) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Page Transition Effects */
.page-transition-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.98);
    }
}

/* Glow effects for interactive elements */
.glow-on-hover {
    position: relative;
    transition: all 0.3s ease;
}

.glow-on-hover:hover {
    filter: drop-shadow(0 0 20px currentColor);
}

/* Ripple effect for buttons */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Floating animation for decorative elements */
@keyframes float-gentle {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

.float-animation {
    animation: float-gentle 6s ease-in-out infinite;
}

/* Gradient border animation */
.gradient-border {
    position: relative;
    background: var(--gray-800);
    border-radius: 1rem;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 1rem;
    padding: 2px;
    background: linear-gradient(45deg, var(--eco-blue), var(--eco-green), var(--eco-orange), var(--eco-purple));
    background-size: 300% 300%;
    animation: gradient-rotate 4s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
}

@keyframes gradient-rotate {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}
