/**
 * Browser Compatibility & Mobile Optimization Stylesheet
 * Supports: IE11+, Edge, Chrome, Firefox, Safari, Opera
 * Mobile: iOS Safari, Chrome Mobile, Samsung Internet
 *
 * @version 1.0
 * @author SBuilder.nl
 */

/* ========================================
   CSS VARIABLES FALLBACKS FOR OLD BROWSERS
   ======================================== */

/* Fallback colors for browsers without CSS variables support */
body {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 16px;
}

/* ========================================
   VENDOR PREFIXES
   ======================================== */

/* Flexbox prefixes */
.wizard-container,
.form-grid,
.button-group,
.service-grid,
.module-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}

/* Transform prefixes */
.wizard-step,
.button,
.card {
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
}

/* Transition prefixes */
.button,
.form-control,
.wizard-step {
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

/* Backdrop-filter fallback */
.wizard-step {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

@supports not (backdrop-filter: blur(20px)) {
    .wizard-step {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* Border-radius prefixes for older browsers */
.wizard-step,
.button,
.form-control {
    -webkit-border-radius: 1rem;
    -moz-border-radius: 1rem;
    border-radius: 1rem;
}

/* Box-shadow prefixes */
.wizard-step,
.card {
    -webkit-box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    -moz-box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Linear gradient prefixes */
body,
.hero-gradient {
    background: -webkit-linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    background: -moz-linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    background: -o-linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

/* User-select prefixes */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ========================================
   MOBILE RESPONSIVE FIXES
   ======================================== */

/* Base mobile optimization */
@media only screen and (max-width: 768px) {
    /* Typography scaling */
    body {
        font-size: 14px;
        line-height: 1.5;
    }

    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    /* Container padding */
    .wizard-container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .wizard-step {
        padding: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    /* Button sizing */
    .button {
        padding: 0.875rem 1.5rem !important;
        font-size: 1rem !important;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .button-group {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Form controls */
    .form-control {
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 0.875rem 1rem !important;
    }

    /* Grid layouts */
    .service-grid,
    .module-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Card spacing */
    .service-card,
    .module-card {
        padding: 1rem !important;
    }
}

/* Small phones */
@media only screen and (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .wizard-title {
        font-size: 1.75rem !important;
    }

    .wizard-subtitle {
        font-size: 1rem !important;
    }

    .wizard-step {
        padding: 1rem !important;
        border-radius: 0.75rem !important;
    }
}

/* Tablets */
@media only screen and (min-width: 769px) and (max-width: 1024px) {
    .wizard-container {
        max-width: 90%;
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .service-grid,
    .module-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

/* Larger touch targets for mobile */
@media (pointer: coarse) {
    .button,
    .service-card,
    .module-card,
    .checkbox-wrapper {
        min-height: 44px; /* Apple's minimum touch target */
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .button:hover,
    .service-card:hover,
    .module-card:hover {
        -webkit-transform: none;
        -ms-transform: none;
        transform: none;
    }
}

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

/* IE 11 specific fixes */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    /* Flexbox fixes for IE11 */
    .wizard-container {
        display: block;
    }

    .button-group {
        display: block;
    }

    .button {
        display: block;
        width: 100%;
        margin-bottom: 1rem;
    }

    /* Grid fallback for IE11 */
    .service-grid,
    .module-grid {
        display: block;
    }

    .service-card,
    .module-card {
        display: block;
        margin-bottom: 1rem;
    }
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
    .form-control {
        padding: 0.875rem 1.25rem;
    }
}

/* Safari specific fixes */
@supports (-webkit-appearance: none) {
    .button {
        -webkit-appearance: none;
    }

    .form-control {
        -webkit-appearance: none;
        border-radius: 0.75rem;
    }
}

/* ========================================
   iOS SAFARI FIXES
   ======================================== */

/* Prevent iOS input zoom */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* iOS safe area */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* Fix iOS momentum scrolling */
body {
    -webkit-overflow-scrolling: touch;
}

/* Prevent iOS text size adjust */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

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

/* GPU acceleration */
.wizard-step,
.button,
.service-card,
.module-card {
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    -moz-perspective: 1000;
    perspective: 1000;
}

/* Smooth scrolling with fallback */
html {
    scroll-behavior: smooth;
    -webkit-scroll-behavior: smooth;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .button {
        border: 3px solid currentColor !important;
    }

    .wizard-step {
        border: 2px solid currentColor !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        -webkit-animation-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        -webkit-animation-iteration-count: 1 !important;
        animation-iteration-count: 1 !important;
        -webkit-transition-duration: 0.01ms !important;
        -o-transition-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1e3a8a 0%, #581c87 100%);
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

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

@media print {
    body {
        background: white;
        color: black;
    }

    .button,
    .navigation {
        display: none;
    }

    .wizard-step {
        background: white;
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}

/* ========================================
   LANDSCAPE MOBILE FIXES
   ======================================== */

@media only screen and (max-height: 500px) and (orientation: landscape) {
    .wizard-header {
        margin-bottom: 1rem !important;
    }

    .wizard-title {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .wizard-subtitle {
        font-size: 0.875rem !important;
    }

    .wizard-step {
        padding: 1rem !important;
    }
}

/* ========================================
   COMMON CROSS-BROWSER RESETS
   ======================================== */

/* Remove default margins/padding */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* Button reset */
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    background: none;
    cursor: pointer;
}

/* Input reset */
input,
textarea,
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
}

/* Remove blue highlight on tap (mobile) */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Link styles */
a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
