/* ========================================
   PROFESSIONAL SCOPEKIT DESIGN SYSTEM
   ======================================== */

/* CSS Custom Properties for Consistent Design */
:root {
    /* Brand Colors */
    --brand-primary: #020486;
    --brand-primary-hover: #1a1a9e;
    --brand-primary-light: #f0f2ff;
    --brand-secondary: #4f46e5;
    --brand-accent: #6366f1;
    
    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fecaca;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Neutral Palette */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Typography */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --text-inverse: #ffffff;
    
    /* Surfaces */
    --surface-primary: #ffffff;
    --surface-secondary: var(--gray-50);
    --surface-tertiary: var(--gray-100);
    --surface-overlay: rgba(0, 0, 0, 0.5);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    --gradient-surface: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-200) 100%);
    --gradient-hero: linear-gradient(135deg, var(--gray-50) 0%, #e2e8f0 100%);
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;
    
    /* Spacing Scale */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Typography Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 3.75rem;
}

/* Base Typography & Layout */
html {
    font-size: 16px;
    line-height: 1.6;
    scroll-behavior: smooth; /* Enable native smooth scrolling */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--surface-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent layout shifts during font load */
    font-display: swap;
}

/* Smooth scrolling for all browsers */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Scroll to Top Button */
.scroll-to-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    background: var(--gradient-primary);
    color: white;
    border: none;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transform: translateY(0);
}

.scroll-to-top-btn:hover {
    background: linear-gradient(135deg, var(--brand-primary-hover) 0%, var(--brand-secondary) 100%);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.scroll-to-top-btn:active {
    transform: translateY(-2px);
}

/* Mobile adjustments for scroll to top button */
@media (max-width: 768px) {
    .scroll-to-top-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 3rem;
        height: 3rem;
        font-size: 1.125rem;
    }
}

/* Scroll Down Indicator */
.scroll-indicator {
    margin-top: 3rem;
    text-align: center;
}

.scroll-down-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    padding: 1rem;
    border-radius: var(--radius-lg);
}

.scroll-down-link:hover {
    color: var(--brand-primary);
    text-decoration: none;
    transform: translateY(-2px);
}

.scroll-down-text {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scroll-down-arrow {
    font-size: 1.5rem;
    animation: bounceDown 2s infinite;
}

.scroll-down-link:hover .scroll-down-arrow {
    animation-duration: 0.5s;
}

@keyframes bounceDown {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Hide scroll indicator on mobile to save space */
@media (max-width: 768px) {
    .scroll-indicator {
        margin-top: 2rem;
    }
    
    .scroll-down-text {
        font-size: 0.8125rem;
    }
    
    .scroll-down-arrow {
        font-size: 1.25rem;
    }
}

/* Navigation scroll spy styles */
.scroll-nav a.active {
    color: var(--brand-primary) !important;
    font-weight: 600;
}

.scroll-nav a.active::after {
    width: 100% !important;
}

/* Smooth section transitions */
section {
    scroll-margin-top: 100px; /* Account for fixed navbar */
}

/* Prevent flicker during initial load */
.section-hero {
    min-height: 600px; /* Ensure consistent height */
}

/* Enhanced Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--gray-200);
    transition: all var(--transition-normal);
    /* Prevent backdrop-filter flicker on unsupported browsers */
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    padding: 1rem 0;
}

@supports not (backdrop-filter: blur(20px)) {
    .navbar {
        background: rgba(255, 255, 255, 1) !important;
    }
}

/* Professional Brand Styling */
.navbar-brand {
    font-weight: 700;
    color: var(--brand-primary) !important;
    transition: all var(--transition-normal);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    position: relative;
}

.navbar-brand:hover {
    transform: scale(1.02);
    text-decoration: none;
}

.navbar-brand::after {
    content: '';
    position: absolute;
    inset: -8px;
    background: radial-gradient(circle at center, rgba(2, 4, 134, 0.05) 0%, transparent 70%);
    border-radius: var(--radius-2xl);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.navbar-brand:hover::after {
    opacity: 1;
}

.brand-logo-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    /*background: var(--gradient-primary);*/
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.brand-logo-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    /*background: var(--gradient-primary);*/
    border-radius: var(--radius-xl);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.brand-logo-container::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: transform var(--transition-slow);
}

.navbar-brand:hover .brand-logo-container::before {
    opacity: 0.3;
}

.navbar-brand:hover .brand-logo-container::after {
    transform: rotate(45deg) translate(25%, 25%);
}

.brand-logo {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1)) brightness(1.1);
    transition: all var(--transition-normal);
    border-radius: var(--radius-md);
    position: relative;
    z-index: 2;
}

.navbar-brand:hover .brand-logo {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15)) brightness(1.2);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 0.125rem;
    transition: all var(--transition-normal);
    position: relative;
}

/* Fallback for browsers that don't support background-clip: text */
@supports not (-webkit-background-clip: text) {
    .brand-name {
        color: var(--brand-primary);
        -webkit-text-fill-color: unset;
    }
}

/* Fix for beta badge text inside brand-name - override text clipping */
.brand-name .beta-badge,
.brand-name .beta-badge-debug {
    /* Reset text clipping properties that might be inherited */
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: white !important;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
}

.brand-name .beta-badge-debug {
    -webkit-text-fill-color: white !important;
    background: #ff0000 !important;
    color: white !important;
}

.navbar-brand:hover .brand-name::after {
    width: 100%;
}

.brand-tagline {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    transition: all var(--transition-normal);
    position: relative;
}

.navbar-brand:hover .brand-tagline {
    color: var(--brand-primary);
    opacity: 1;
    transform: translateX(2px);
}

.beta-badge {
    display: inline-block;
    font-size: 0.6875rem; /* Increased from 0.5rem for better legibility */
    font-weight: 800; /* Increased from 700 for sharper appearance */
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.25rem 0.5rem; /* Increased padding for better proportions */
    border-radius: var(--radius-full);
    margin-left: 0.5rem;
    /* Remove text-shadow that causes blurriness */
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.4); /* Enhanced shadow for depth */
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    top: -2px;
    /* Add crisp text rendering */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Ensure no sub-pixel rendering issues */
    transform: translateZ(0);
    /* Force visibility with important declarations */
    color: white !important;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    /* Ensure proper text display */
    overflow: visible;
    white-space: nowrap;
    /* Ensure minimum dimensions */
    min-width: 2.5rem;
    min-height: 1.5rem;
    text-align: center;
    line-height: 1.2;
    /* Prevent text being hidden by other elements */
    z-index: 10;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1) translateZ(0); 
    }
    50% { 
        transform: scale(1.05) translateZ(0); 
    }
}

/* Alternative beta badge styles for even better legibility */
.beta-badge-alt {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    background: #ffffff;
    color: #d97706;
    padding: 0.25rem 0.5rem;
    border: 2px solid #f59e0b;
    border-radius: var(--radius-md); /* Slightly less rounded for better text clarity */
    margin-left: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    top: -2px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
    transition: all var(--transition-fast);
}

.beta-badge-alt:hover {
    background: #f59e0b;
    color: white;
}

/* Minimalist beta badge */
.beta-badge-minimal {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #d97706;
    padding: 0.125rem 0.375rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-sm);
    margin-left: 0.5rem;
    position: relative;
    top: -1px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Debug version of beta badge - use this class temporarily to test visibility */
.beta-badge-debug {
    display: inline-block !important;
    font-size: 1rem !important; /* Large size for debugging */
    font-weight: 900 !important;
    background: #ff0000 !important; /* Bright red for visibility */
    color: #ffffff !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.25rem !important;
    margin-left: 0.5rem !important;
    border: 2px solid #000000 !important; /* Black border for extra visibility */
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5) !important;
    position: relative !important;
    z-index: 9999 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
}

/* Enhanced Buttons */
.btn {
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
    padding: 0.75rem 2rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--brand-primary-hover) 0%, var(--brand-secondary) 100%);
    color: var(--text-inverse);
}

.btn-outline-primary {
    border: 2px solid var(--brand-primary);
    color: var(--brand-primary);
    background: transparent;
    padding: 0.75rem 2rem;
}

.btn-outline-primary:hover {
    background: var(--brand-primary);
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: var(--text-lg);
    border-radius: var(--radius-xl);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
}

/* Enhanced Cards */
.card {
    background: var(--surface-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    overflow: hidden;
    /* Prevent flickering during transitions */
    transform: translateZ(0);
    will-change: transform;
}

.card:hover:not(.no-card-hover) {
    transform: translateY(-4px) translateZ(0);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.card-header {
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-lg);
    font-weight: 600;
}

.card-body {
    padding: var(--space-xl);
}

/* Form Controls */
.form-control, .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    font-size: var(--text-base);
    transition: all var(--transition-fast);
    background: var(--surface-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(2, 4, 134, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

/* Enhanced Alerts */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
}

/* Professional Sections */
.section-hero {
    background: var(--gradient-hero);
    padding: var(--space-4xl) 0;
    position: relative;
    overflow: hidden;
    min-height: 600px; /* Ensure consistent height */
    /* Prevent background flicker */
    background-attachment: fixed;
}

.section-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(2, 4, 134, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(79, 70, 229, 0.08) 0%, transparent 50%);
    pointer-events: none;
    /* Ensure smooth rendering */
    transform: translateZ(0);
    will-change: transform;
}

/* Optimize sections for better performance */
.section-benefits,
.section-padding,
.section-padding-sm {
    /* Force hardware acceleration to prevent flicker */
    transform: translateZ(0);
    will-change: transform;
}

.section-content {
    position: relative;
    z-index: 1;
}

/* Feature Highlights */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
    padding: var(--space-2xl) 0;
}

.feature-item {
    background: var(--surface-primary);
    padding: var(--space-2xl);
    border-radius: var(--radius-2xl);
    text-align: center;
    transition: all var(--transition-normal);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
    /* Prevent flickering during animations */
    transform: translateZ(0);
    will-change: transform;
}

.feature-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.feature-item:hover::before {
    transform: scaleX(1);
}

.feature-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    font-size: 3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-lg);
    transition: transform var(--transition-normal);
}

.feature-item:hover .feature-icon {
    transform: scale(1.1);
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

.display-1 { font-size: var(--text-6xl); font-weight: 800; }
.display-2 { font-size: var(--text-5xl); font-weight: 800; }

.lead {
    font-size: var(--text-xl);
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Enhanced Footer */
footer {
    background: var(--surface-primary);
    border-top: 1px solid var(--gray-200);
    padding: var(--space-xl) 0;
    margin-top: auto;
}

.footer-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    /*background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);*/
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.footer-logo {
    width: 20px;
    height: 20px;
    filter: brightness(1.2);
    border-radius: var(--radius-sm);
}

.footer-text {
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Footer Mobile Responsiveness */
@media (max-width: 768px) {
    footer {
        padding: var(--space-lg) 0;
    }
    
    .footer-text {
        font-size: 0.8125rem;
    }
    
    .footer-logo-container {
        width: 28px;
        height: 28px;
        margin-right: 0.75rem !important;
    }
    
    .footer-logo {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 576px) {
    footer {
        padding: var(--space-md) 0;
        text-align: center;
    }
    
    .footer-text {
        font-size: 0.75rem;
        line-height: 1.3;
    }
    
    .footer-text br.d-lg-none {
        display: inline !important;
    }
    
    /* Stack footer links vertically on very small screens */
    .d-flex.gap-3.flex-wrap {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: center !important;
    }
    
    .d-flex.gap-3.flex-wrap a {
        font-size: 0.8125rem;
        padding: 0.25rem 0;
    }
}

/* Utility Classes */
.text-gradient {
    color: var(--brand-primary); /* Fallback color */
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Ensure smooth rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Login Partial Styling */
.navbar-nav .nav-item .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: var(--text-secondary) !important;
    text-decoration: none;
    border-radius: var(--radius-md);
    margin: 0 0.25rem;
    transition: all var(--transition-fast);
    position: relative;
    min-height: 2.5rem; /* Ensure consistent height */
}

.navbar-nav .nav-item .nav-link:hover {
    color: var(--brand-primary) !important;
    background: rgba(2, 4, 134, 0.05);
    text-decoration: none;
}

.navbar-nav .nav-item .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background: var(--gradient-primary);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
    border-radius: 1px;
}

.navbar-nav .nav-item .nav-link:hover::after {
    width: calc(100% - 2rem);
}

.navbar-nav .nav-item .nav-link i {
    font-size: 0.875rem;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.navbar-nav .nav-item .nav-link:hover i {
    opacity: 1;
}

/* Specific styling for logout button to match nav-links */
.navbar-nav .nav-item form .btn-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: var(--text-secondary) !important;
    text-decoration: none;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    margin: 0 0.25rem;
    transition: all var(--transition-fast);
    position: relative;
    min-height: 2.5rem; /* Match nav-link height */
    font-size: inherit;
    line-height: inherit;
    cursor: pointer;
}

.navbar-nav .nav-item form .btn-link:hover {
    color: var(--brand-primary) !important;
    background: rgba(2, 4, 134, 0.05);
    text-decoration: none;
}

.navbar-nav .nav-item form .btn-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background: var(--gradient-primary);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
    border-radius: 1px;
}

.navbar-nav .nav-item form .btn-link:hover::after {
    width: calc(100% - 2rem);
}

.navbar-nav .nav-item form .btn-link i {
    font-size: 0.875rem;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.navbar-nav .nav-item form .btn-link:hover i {
    opacity: 1;
}

/* Animation Classes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fix flicker by setting initial states and controlling animation timing */
.animate-fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: none; /* Prevent any premature transitions */
}

.animate-fade-in {
    opacity: 0;
    transition: none; /* Prevent any premature transitions */
}

.animate-slide-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: none; /* Prevent any premature transitions */
}

/* Only start animations when ready */
.animations-ready .animate-fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

.animations-ready .animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.animations-ready .animate-slide-in-right {
    animation: slideInRight 0.8s ease forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --text-5xl: 2.5rem;
        --text-4xl: 2rem;
        --text-3xl: 1.75rem;
        --space-4xl: 3rem;
        --space-3xl: 2rem;
    }
    
    .btn-lg {
        padding: 0.875rem 2rem;
        font-size: var(--text-base);
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .section-hero {
        padding: var(--space-3xl) 0;
    }
    
    /* Mobile navbar brand adjustments */
    .navbar {
        padding: 0.75rem 0;
    }
    
    .brand-logo-container {
        width: 48px;
        height: 48px;
    }
    
    .brand-logo {
        width: 32px;
        height: 32px;
    }
    
    .brand-name {
        font-size: 1.25rem;
    }
    
    .brand-tagline {
        font-size: 0.6875rem;
    }
    
    .navbar-brand {
        gap: 0.75rem;
    }
}

/* High DPI display optimizations and mobile responsiveness */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .beta-badge {
        /* Slightly larger on high-DPI displays for better legibility */
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Mobile responsiveness for beta badge */
@media (max-width: 768px) {
    .beta-badge {
        font-size: 0.625rem !important; /* Increased from 0.4375rem for better mobile legibility */
        padding: 0.2rem 0.4rem !important; /* Improved mobile padding */
        margin-left: 0.4rem !important;
        /* Ensure crisp rendering on mobile */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print Styles */
@media print {
    .navbar, footer, .btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --brand-primary: #000080;
        --text-secondary: #000000;
        --gray-200: #999999;
    }
}

/* 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;
    }
    
    html {
        scroll-behavior: auto !important;
    }
}

/* Focus Visible Support */
.btn:focus-visible,
.form-control:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid var(--brand-primary);
    outline-offset: 2px;
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary) !important;
    transition: all var(--transition-fast);
    position: relative;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin: 0 0.25rem;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background: var(--gradient-primary);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
    border-radius: 1px;
}

.nav-link:hover {
    color: var(--brand-primary) !important;
    background: rgba(2, 4, 134, 0.05);
}

.nav-link:hover::after {
    width: calc(100% - 2rem);
}

.nav-link i {
    font-size: 0.875rem;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.nav-link:hover i {
    opacity: 1;
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .beta-badge {
        /* Slightly larger on high-DPI displays for better legibility */
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Additional fallback styles to ensure badge visibility */
.beta-badge {
    /* Ensure badge is always visible */
    min-width: 2.5rem;
    text-align: center;
    line-height: 1;
    /* Force text color in case of inheritance issues */
    color: white !important;
    /* Ensure background is always visible */
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

/* New mobile responsive adjustments */
@media (max-width: 576px) {
    .card-body {
        padding: var(--space-lg);
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .feature-item {
        padding: var(--space-xl);
    }
    
    /* Mobile navbar adjustments */
    .navbar-nav .nav-item .nav-link,
    .navbar-nav .nav-item form .btn-link {
        padding: 0.5rem 0.75rem;
        margin: 0.125rem;
        min-height: 2rem;
    }
    
    .navbar-nav .nav-item .nav-link i,
    .navbar-nav .nav-item form .btn-link i {
        font-size: 0.8125rem;
    }
}

/* Floating Navigation */
.floating-nav {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    z-index: 999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    padding: 0.75rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    border: 1px solid rgba(2, 4, 134, 0.1);
}

.floating-nav.visible {
    opacity: 1;
    visibility: visible;
}

.floating-nav-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.floating-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.floating-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--gradient-primary);
    transition: width var(--transition-fast);
    border-radius: var(--radius-lg);
}

.floating-nav-item:hover,
.floating-nav-item.active {
    color: var(--brand-primary);
    background: rgba(2, 4, 134, 0.05);
    transform: translateX(-4px);
}

.floating-nav-item:hover::before,
.floating-nav-item.active::before {
    width: 3px;
}

.floating-nav-item i {
    font-size: 1rem;
    min-width: 1rem;
    position: relative;
    z-index: 2;
}

.floating-nav-item span {
    position: relative;
    z-index: 2;
}

/* Mobile floating nav */
@media (max-width: 1024px) {
    .floating-nav {
        right: 1rem;
        padding: 0.5rem;
    }
    
    .floating-nav-item {
        padding: 0.5rem;
        justify-content: center;
    }
    
    .floating-nav-item span {
        display: none; /* Hide text on mobile, show only icons */
    }
    
    .floating-nav-item i {
        font-size: 1.125rem;
    }
}

@media (max-width: 768px) {
    .floating-nav {
        display: none; /* Hide on small mobile devices */
    }
}