/* Cross-Browser Compatibility CSS for IWT Platform v10636 */
/* Ensures consistent rendering across Brave, Edge, Firefox, Safari, and Chrome */
/* Enhanced with comprehensive iPad support and deployment-ready optimizations */
/* Updated: January 8, 2025 - Added enhanced browser compatibility comments */

/*
 * BROWSER COMPATIBILITY NOTES:
 * ===========================
 * 
 * ✅ CHROME (Latest): Full support for all features including backdrop-filter, CSS Grid, Flexbox
 * ✅ BRAVE (Latest): Chromium-based, same compatibility as Chrome with privacy enhancements
 * ✅ EDGE (Latest): Chromium-based since 2020, excellent modern CSS support
 * ⚠️  FIREFOX (Latest): Good support, uses -moz- prefixes for some properties
 * ⚠️  SAFARI (Latest): Good support but requires -webkit- prefixes, different background-attachment behavior on iOS
 * 
 * KEY COMPATIBILITY DECISIONS:
 * - Using prefixed properties for maximum compatibility
 * - Fallback backgrounds for browsers without backdrop-filter support
 * - GPU acceleration through transform3d for smooth animations
 * - Responsive design with mobile-first approach
 * - High contrast and reduced motion media query support for accessibility
 */

/* ==== BROWSER RESETS AND NORMALIZATION ==== */

/* CSS Reset for all browsers */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

/* ==== FONT RENDERING FIXES ==== */

/* Consistent font rendering across all browsers */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif !important;
    
    /* Safari font smoothing */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Edge/IE text rendering */
    text-rendering: optimizeLegibility;
    
    /* Firefox font smoothing */
    font-smooth: always;
    -webkit-text-stroke: 0.01em transparent;
}

/* ==== BACKGROUND ATTACHMENT FIXES ==== */

/* Fixed background for all browsers */
html {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(26, 26, 46, 0.85) 50%, rgba(22, 33, 62, 0.85) 100%) !important;
    
    /* Safari iOS background-attachment:fixed fallback */
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Minimum height for mobile browsers */
    min-height: 100vh;
    min-height: -webkit-fill-available; /* Safari mobile */
}

/* Mobile Safari viewport fix */
@supports (-webkit-touch-callout: none) {
    html {
        min-height: -webkit-fill-available;
    }
    
    body {
        min-height: -webkit-fill-available;
    }
}

/* ==== FLEXBOX COMPATIBILITY ==== */

/* Flexbox prefixes for older browsers */
.d-flex, .navbar-nav, .modal-dialog {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
}

.justify-content-between {
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -moz-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

.align-items-center {
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.flex-column {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

/* ==== BACKDROP-FILTER FALLBACKS ==== */

/* Backdrop filter with fallbacks */
.navbar, .modal-content {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    -moz-backdrop-filter: blur(20px);
    -ms-backdrop-filter: blur(20px);
    
    /* Fallback for browsers that don't support backdrop-filter */
    background: rgba(0, 0, 0, 0.9) !important;
}

/* Firefox fallback for backdrop-filter */
@-moz-document url-prefix() {
    .navbar, .modal-content {
        background: rgba(0, 0, 0, 0.95) !important;
    }
}

/* ==== TRANSFORM AND ANIMATION PREFIXES ==== */

/* Transform prefixes for all browsers */
.btn-primary-custom:hover,
.nav-pulse-blob:hover {
    -webkit-transform: translateY(-2px) scale(1.05);
    -moz-transform: translateY(-2px) scale(1.05);
    -ms-transform: translateY(-2px) scale(1.05);
    -o-transform: translateY(-2px) scale(1.05);
    transform: translateY(-2px) scale(1.05);
}

/* Animation prefixes */
@-webkit-keyframes liquidMorph {
    0%, 100% { border-radius: 50px 30px 60px 40px; }
    25% { border-radius: 30px 60px 40px 50px; }
    50% { border-radius: 60px 40px 30px 60px; }
    75% { border-radius: 40px 50px 60px 30px; }
}

@-moz-keyframes liquidMorph {
    0%, 100% { border-radius: 50px 30px 60px 40px; }
    25% { border-radius: 30px 60px 40px 50px; }
    50% { border-radius: 60px 40px 30px 60px; }
    75% { border-radius: 40px 50px 60px 30px; }
}

@keyframes liquidMorph {
    0%, 100% { border-radius: 50px 30px 60px 40px; }
    25% { border-radius: 30px 60px 40px 50px; }
    50% { border-radius: 60px 40px 30px 60px; }
    75% { border-radius: 40px 50px 60px 30px; }
}

/* ==== GRADIENT COMPATIBILITY ==== */

/* Linear gradient prefixes */
.btn-primary-custom {
    background: -webkit-linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    background: -moz-linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    background: -ms-linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    background: -o-linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
}

.nav-pulse-blob {
    background: -webkit-linear-gradient(135deg, rgba(0, 255, 255, 0.8) 0%, rgba(0, 128, 255, 0.6) 50%, rgba(128, 0, 255, 0.4) 100%);
    background: -moz-linear-gradient(135deg, rgba(0, 255, 255, 0.8) 0%, rgba(0, 128, 255, 0.6) 50%, rgba(128, 0, 255, 0.4) 100%);
    background: -ms-linear-gradient(135deg, rgba(0, 255, 255, 0.8) 0%, rgba(0, 128, 255, 0.6) 50%, rgba(128, 0, 255, 0.4) 100%);
    background: -o-linear-gradient(135deg, rgba(0, 255, 255, 0.8) 0%, rgba(0, 128, 255, 0.6) 50%, rgba(128, 0, 255, 0.4) 100%);
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.8) 0%, rgba(0, 128, 255, 0.6) 50%, rgba(128, 0, 255, 0.4) 100%);
}

/* ==== TRANSITION COMPATIBILITY ==== */

/* Transition prefixes */
.nav-link, .btn-primary-custom, .nav-pulse-blob {
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

/* ==== BUTTON AND INPUT FIXES ==== */

/* Cross-browser button styling */
button, .btn, input[type="button"], input[type="submit"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    outline: none;
    cursor: pointer;
}

/* Input field styling for all browsers */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    padding: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    
    /* Remove default styling in Safari */
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
}

/* Placeholder styling for all browsers */
input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
    opacity: 1; /* Firefox */
}

input::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.6);
}

input::-moz-placeholder {
    color: rgba(255, 255, 255, 0.6);
    opacity: 1;
}

input:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.6);
}

input:-moz-placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* ==== MODAL FIXES ==== */

/* Bootstrap modal compatibility */
.modal-content {
    background: rgba(26, 26, 46, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    
    /* Remove default box-shadow in Firefox */
    -moz-box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    -webkit-box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

/* Modal backdrop for all browsers */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

/* ==== SCROLL BEHAVIOR FIXES ==== */

/* Smooth scrolling for all browsers */
html {
    scroll-behavior: smooth;
    -webkit-scroll-behavior: smooth;
    -moz-scroll-behavior: smooth;
    -ms-scroll-behavior: smooth;
}

/* Scrollbar styling for WebKit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ==== POSITION FIXED FIXES ==== */

/* Fixed position compatibility */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    
    /* Ensure fixed positioning works in all browsers */
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
}

/* ==== TYPOGRAPHY FIXES ==== */

/* Consistent text rendering */
h1, h2, h3, h4, h5, h6, p, span, div {
    color: #ffffff;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==== MEDIA QUERY COMPATIBILITY ==== */

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Safari-specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .navbar {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    .nav-pulse-blob {
        background: rgba(0, 255, 255, 0.6) !important;
    }
}

/* Edge-specific fixes */
@supports (-ms-ime-align: auto) {
    .modal-content {
        background: rgba(26, 26, 46, 0.98) !important;
    }
}

/* ==== PRINT STYLES ==== */

@media print {
    .navbar, .modal, .nav-pulse-blob {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* ==== LOGO POSITIONING NO LONGER NEEDED ==== */

/* 
 * LOGO POSITIONING SOLUTION:
 * ==========================
 * Logo is now embedded directly in the background image (hero_background_with_logo.jpg)
 * This eliminates all cross-browser positioning issues completely
 * The composite image approach ensures consistent display across all browsers
 */

/* ==== ADDITIONAL BROWSER-SPECIFIC FIXES ==== */

/* iPad and Tablet Specific Fixes */
@media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait),
       screen and (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    
    /* iPad specific navbar adjustments */
    .navbar {
        padding: 1rem 0;
        border-radius: 15px;
    }
    
    .nav-link {
        font-size: 1rem !important;
        padding: 0.75rem 1.25rem !important;
    }
    
    .navbar-brand {
        font-size: 1.75rem !important;
    }
    
    /* Better button sizing for touch */
    .btn-primary-custom, .nav-link {
        min-height: 44px; /* Apple's recommended touch target */
        min-width: 44px;
    }
    
    /* Modal improvements for iPad */
    .modal-dialog {
        margin: 2rem;
        max-width: calc(100vw - 4rem);
    }
    
    .modal-content {
        border-radius: 15px;
    }
    
    /* Form improvements for iPad */
    input, textarea, select {
        font-size: 16px !important; /* Prevents zoom on iOS Safari */
        padding: 0.75rem;
        border-radius: 8px;
    }
    
    /* Ensure content doesn't overflow on iPad */
    .container {
        max-width: 95%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Chrome mobile address bar fix */
@supports (-webkit-touch-callout: none) {
    .hero-section, .main-content {
        min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        min-height: calc(100vh - constant(safe-area-inset-top) - constant(safe-area-inset-bottom));
    }
    
    /* iPad Safari specific fixes */
    html, body {
        height: 100%;
        overflow-x: hidden;
    }
    
    /* Fix for iPad Safari viewport issues */
    .navbar {
        position: -webkit-sticky;
        position: sticky;
        top: 20px;
    }
}

/* Brave browser specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
    .btn-primary-custom {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Edge specific backdrop filter fallback */
@supports not (backdrop-filter: blur(20px)) {
    .navbar, .modal-content {
        background: rgba(0, 0, 0, 0.95) !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Firefox gradient fallback */
@-moz-document url-prefix() {
    .btn-primary-custom {
        background: #FFA500 !important; /* Orange fallback */
    }
    
    .nav-pulse-blob {
        background: rgba(0, 255, 255, 0.8) !important; /* Cyan fallback */
    }
}

/* Safari font rendering improvements */
@media not all and (min-resolution:.001dpcm) {
    @supports (-webkit-appearance:none) {
        html {
            -webkit-text-size-adjust: 100%;
            -webkit-font-smoothing: antialiased;
        }
        
        .btn-primary-custom, .nav-link {
            -webkit-transform: translateZ(0);
            transform: translateZ(0);
        }
    }
}

/* ==== PERFORMANCE OPTIMIZATIONS ==== */

/* GPU acceleration for smooth animations */
.navbar, .btn-primary-custom, .nav-pulse-blob {
    will-change: transform;
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
}

/* Prevent layout thrashing */
.nav-link:hover {
    contain: layout style paint;
}

/* ==== ACCESSIBILITY FIXES ==== */

/* Focus indicators for all browsers */
button:focus, input:focus, .nav-link:focus {
    outline: 2px solid rgba(0, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary-custom {
        border: 2px solid #FFD700 !important;
    }
    
    .nav-link {
        border: 1px solid rgba(255, 255, 255, 0.5) !important;
    }
}

/* ==== ENHANCED BROWSER-SPECIFIC COMPATIBILITY ==== */

/* Safari-specific enhancements */
@supports (-webkit-appearance: none) {
    /* Fix Safari grid issues */
    .row, .col-lg-4, .col-md-12 {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }
    
    /* Safari video/audio element fixes */
    video, audio {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        backface-visibility: hidden;
    }
    
    /* Safari button styling fixes */
    button, input[type="button"], input[type="submit"] {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
}

/* Edge-specific fixes for Chromium Edge */
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
    .navbar {
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .modal-content {
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }
}

/* Brave browser specific fixes (Chromium-based) */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    @supports (-webkit-appearance: none) and (contain: none) {
        .btn-primary-custom {
            will-change: transform, box-shadow;
        }
        
        .nav-link:hover {
            will-change: transform, background-color;
        }
    }
}

/* Chrome-specific optimizations */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
    /* Chrome-specific gradient rendering improvements */
    .btn-primary-custom {
        background-attachment: fixed;
    }
    
    /* Chrome scroll performance */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    /* Firefox input styling */
    input, textarea, select {
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Firefox backdrop-filter alternative */
    .navbar::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        border-radius: inherit;
        z-index: -1;
    }
    
    /* Firefox gradient fixes */
    .btn-primary-custom {
        background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%) !important;
    }
}

/* ==== MOBILE AND TOUCH IMPROVEMENTS ==== */

/* Touch device optimizations */
@media (pointer: coarse) {
    /* Larger touch targets for mobile/tablet */
    .nav-link, .btn-primary-custom {
        min-height: 48px;
        padding: 0.75rem 1rem;
    }
    
    /* Remove hover effects on touch devices */
    .nav-link:hover, .btn-primary-custom:hover {
        transform: none;
    }
    
    /* Better touch feedback */
    .nav-link:active, .btn-primary-custom:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Landscape mobile/tablet fixes */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 0.5rem 0;
        top: 10px;
    }
    
    .nav-link {
        font-size: 0.9rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    body {
        padding-top: 70px; /* Reduce top padding for landscape */
    }
}

/* ==== PERFORMANCE ENHANCEMENTS ==== */

/* GPU acceleration for smooth performance across browsers */
.navbar, .btn-primary-custom, .modal-content, .nav-link {
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
    backface-visibility: hidden;
    
    -webkit-perspective: 1000px;
    -moz-perspective: 1000px;
    -ms-perspective: 1000px;
    perspective: 1000px;
}

/* Prevent text selection issues across browsers */
.navbar, .nav-link, .btn-primary-custom {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}