/* Critical CSS - Above the fold styles */

/* Base styles */
html {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 50%, #faf5ff 100%);
    color: #1f2937;
    overflow-x: hidden;
}

/* Dark mode */
.dark body {
    background: linear-gradient(135deg, #111827 0%, #1f2937 50%, #581c87 100%);
    color: #f9fafb;
}

/* Skip links for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    font-size: 14px;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200px 100%;
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* Critical glass effect */
.glass-critical {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark .glass-critical {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Critical layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 16rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1001;
}

.app-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 16rem;
    height: 5rem;
    z-index: 1002;
}

.app-main {
    margin-left: 16rem;
    margin-top: 5rem;
    flex: 1;
    padding: 1.5rem;
}

/* Mobile critical styles */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .app-header {
        left: 0;
    }
    
    .app-main {
        margin-left: 0;
        margin-top: 4.5rem;
        padding: 1rem;
    }
}

/* Focus styles for accessibility - Remove blue borders */
*:focus {
    outline: none;
}

.focus-visible:focus {
    outline: none;
}

/* Only show focus for keyboard navigation */
*:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Remove default browser focus styles */
button:focus,
input:focus,
textarea:focus,
select:focus,
a:focus {
    outline: none;
    box-shadow: none;
}

/* Remove blue highlight on mobile */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection where needed */
input,
textarea,
[contenteditable],
.selectable {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-critical {
        background: rgba(255, 255, 255, 0.9);
        border: 2px solid #000;
    }
    
    .dark .glass-critical {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid #fff;
    }
}

/* 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;
    }
}

/* Modal animations */
@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modal-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
}

.animate-modal-in {
    animation: modal-in 0.2s ease-out;
}

.animate-modal-out {
    animation: modal-out 0.2s ease-in;
}

/* Screen reader only content */
.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;
}

/* Print styles */
@media print {
    .app-sidebar,
    .app-header,
    .no-print {
        display: none !important;
    }
    
    .app-main {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}