/* Custom CSS for Edge Market Insights */

/* CSS Variables for consistent theming */
:root {
    --color-deep-navy: #0B1E38;
    --color-signal-blue: #3D8BF2;
    --color-slate-gray: #5A5A5A;
    --color-highlight-lime: #C3E458;
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: var(--color-deep-navy);
        --color-text: #ffffff;
    }
}

/* Smooth scrolling for all elements */
html {
    scroll-behavior: smooth;
}

/* Focus styles for better accessibility */
*:focus {
    outline: 2px solid var(--color-signal-blue);
    outline-offset: 2px;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.animation-delay-200 {
    animation-delay: 0.2s;
}

.animation-delay-400 {
    animation-delay: 0.4s;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Header shadow on scroll */
.header-scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Dark mode header shadow */
@media (prefers-color-scheme: dark) {
    .header-scrolled {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    }
}

/* Form validation styles */
.form-field-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-field-success {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--color-signal-blue);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

/* Dark mode scrollbar */
@media (prefers-color-scheme: dark) {
    ::-webkit-scrollbar-track {
        background: #374151;
    }
}

/* Skip to content link styling */
.sr-only:not(:focus):not(:active) {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-signal-blue {
        background-color: #0000ff;
    }
    
    .text-signal-blue {
        color: #0000ff;
    }
    
    .border-signal-blue {
        border-color: #0000ff;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* Loading state for forms */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Custom utilities for better spacing */
.space-y-safe > * + * {
    margin-top: 1rem;
}

/* Ensure proper line height for readability */
body {
    line-height: 1.6;
}

/* Better button focus states */
button:focus,
a:focus {
    outline: 2px solid var(--color-signal-blue);
    outline-offset: 2px;
}

/* Form field focus improvements */
input:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 3px rgba(61, 139, 242, 0.1);
}

/* Cookie banner animation */
.cookie-banner-show {
    transform: translateY(0);
}

/* Intersection observer reveal animation */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Custom checkbox styling for better accessibility */
input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(61, 139, 242, 0.3);
}

/* Ensure sufficient color contrast */
.text-slate-gray {
    color: #4a5568;
}

@media (prefers-color-scheme: dark) {
    .text-slate-gray {
        color: #a0aec0;
    }
}

/* Mobile menu improvements */
#mobile-menu {
    transition: all 0.3s ease-in-out;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu.show {
    max-height: 300px;
}

/* Form validation message styling */
.form-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.form-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

/* Dark mode form messages */
@media (prefers-color-scheme: dark) {
    .form-success {
        background-color: #1a2f1a;
        color: #a8d8a8;
        border-color: #2d5f2d;
    }
    
    .form-error {
        background-color: #2f1a1a;
        color: #d8a8a8;
        border-color: #5f2d2d;
    }
}
