/* CSS Fixes and Improvements */

/* Fix for webkit gradient compatibility */
.nav-brand h2,
.hero-content h1,
section h2::after,
.page-header h1 {
    background: -webkit-linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Fix for flexbox gaps in older browsers */
.hero-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-stats > * {
    margin: 0 30px 20px 30px;
}

@media (max-width: 768px) {
    .hero-stats > * {
        margin: 0 0 20px 0;
    }
}

/* Fix for grid gaps in older browsers */
.features-grid > *,
.actions-grid > *,
.stats-grid > * {
    margin-bottom: 25px;
}

.features-grid > *:last-child,
.actions-grid > *:last-child,
.stats-grid > *:last-child {
    margin-bottom: 0;
}

/* Fix for backdrop-filter fallback */
.navbar {
    background: rgba(26, 32, 44, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(20px)) {
    .navbar {
        background: rgba(26, 32, 44, 0.98);
    }
}

/* Fix for transform3d hardware acceleration */
.feature-card,
.action-card,
.stat-card {
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* Fix for scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Fix for input autofill styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--card-bg) inset;
    -webkit-text-fill-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}

/* Fix for button active states */
button:active,
.btn:active {
    transform: translateY(1px);
}

/* Fix for table overflow on mobile */
.leaderboard-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.leaderboard-table {
    min-width: 600px;
}

@media (max-width: 768px) {
    .leaderboard-table {
        min-width: 400px;
    }
}

@media (max-width: 480px) {
    .leaderboard-table {
        min-width: 300px;
    }
}

/* Fix for loading spinner in Safari */
@-webkit-keyframes spin {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); }
}

.spinner,
.spinner-small {
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
}

/* Fix for form validation styles */
input:invalid {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.1);
}

input:valid {
    border-color: var(--success-color);
}

/* Fix for high contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
        --text-muted: #cccccc;
    }
}

/* Fix for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Fix for dark mode preference */
@media (prefers-color-scheme: light) {
    /* Keep dark theme as default for this project */
}

/* Fix for print styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* Fix for focus-visible support */
@supports selector(:focus-visible) {
    *:focus {
        outline: none;
    }
    
    *:focus-visible {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
}