/* NILM Analytics - Main Stylesheet */
/* This file imports all CSS components in the correct order */

/* === VENDOR STYLES === */
/* Third-party CSS should be imported first */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* === CORE STYLES === */
/* Design tokens and variables */
@import 'variables.css';

/* Base styles, resets, and typography */
@import 'base.css';

/* Reusable component styles */
@import 'components.css';

/* === PAGE-SPECIFIC STYLES === */
/* Page-specific styles are imported as needed by templates */
/* @import 'pages/index.css'; */
/* @import 'pages/login.css'; */
/* @import 'pages/onboarding.css'; */
/* @import 'pages/dashboard.css'; */

/* === UTILITY CLASSES === */
/* Additional utility classes for common patterns */

/* Text utilities */
.text-gradient {
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Background utilities */
.bg-gradient {
    background: var(--gradient-brand);
}

.bg-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
}

/* Animation utilities */
.animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* === RESPONSIVE UTILITIES === */
/* Additional responsive utilities */

.hidden-mobile {
    display: block;
}

@media (max-width: 640px) {
    .hidden-mobile {
        display: none;
    }
}

.visible-mobile {
    display: none;
}

@media (max-width: 640px) {
    .visible-mobile {
        display: block;
    }
}

/* === ACCESSIBILITY UTILITIES === */
/* Focus management and screen reader utilities */

.focus-trap {
    position: relative;
}

.focus-trap:focus-within {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* === PRINT UTILITIES === */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    .print-break-before {
        page-break-before: always;
    }
    
    .print-break-after {
        page-break-after: always;
    }
    
    .print-break-inside-avoid {
        page-break-inside: avoid;
    }
}

/* === DARK MODE UTILITIES === */
/* Dark mode specific utilities */
[data-theme="dark"] .dark-mode-hidden {
    display: none;
}

[data-theme="dark"] .dark-mode-visible {
    display: block;
}

.light-mode-hidden {
    display: block;
}

[data-theme="dark"] .light-mode-hidden {
    display: none;
}

/* === PERFORMANCE OPTIMIZATIONS === */
/* GPU acceleration for animations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Smooth scrolling */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* === DEBUG UTILITIES === */
/* Development-only utilities */
.debug-outline * {
    outline: 1px solid red;
}

.debug-grid {
    background-image: 
        linear-gradient(rgba(255, 0, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* === LEGACY SUPPORT === */
/* Support for older browsers */
.legacy-support {
    /* Fallbacks for older browsers */
    background: #ffffff;
    background: var(--bg-primary);
}

/* === CUSTOM PROPERTIES FALLBACKS === */
/* Fallback values for CSS custom properties */
.fallback-colors {
    color: #1e293b; /* fallback for --text-primary */
    background: #ffffff; /* fallback for --bg-primary */
    border: 1px solid #e2e8f0; /* fallback for --border-primary */
}

/* === COMPONENT OVERRIDES === */
/* Override third-party component styles to match our theme */

/* Chart.js overrides */
.chart-container canvas {
    max-width: 100%;
    height: auto;
}

/* Font Awesome overrides */
.fa, .fas, .far, .fal, .fab {
    font-family: "Font Awesome 6 Free" !important;
}

/* === THEME TRANSITIONS === */
/* Smooth transitions when switching themes */
* {
    transition: background-color var(--transition-normal),
                border-color var(--transition-normal),
                color var(--transition-normal);
}

/* === LOADING STATES === */
/* Global loading state styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.loading-content {
    background: var(--bg-card);
    padding: var(--space-8);
    border-radius: var(--border-radius-lg);
    text-align: center;
    box-shadow: var(--shadow-2xl);
}

/* === ERROR STATES === */
/* Global error state styles */
.error-boundary {
    padding: var(--space-8);
    text-align: center;
    background: var(--bg-card);
    border: var(--border-width) solid var(--accent-error);
    border-radius: var(--border-radius-lg);
    margin: var(--space-4);
}

.error-title {
    color: var(--accent-error);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

/* === SUCCESS STATES === */
/* Global success state styles */
.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--accent-success);
    color: var(--accent-success);
    padding: var(--space-4);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-4);
}

/* === WARNING STATES === */
/* Global warning state styles */
.warning-message {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--accent-warning);
    color: var(--accent-warning);
    padding: var(--space-4);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-4);
}

/* === INFO STATES === */
/* Global info state styles */
.info-message {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: var(--space-4);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-4);
}
