/* =============================================
   CROSS-BROWSER COMPATIBILITY LAYER
   Works on: Chrome, Safari, Firefox, Edge, iOS, Android
   ============================================= */

/* ===== VENDOR PREFIXES FOR FLEXBOX ===== */
.flex,
.hero-actions,
.nav-container,
.nav-actions,
.form-actions,
.service-option-content,
.urgency-content,
.booking-contact-card,
.floater-grid,
.floater-stat,
.team-card,
.about-card-stats,
.faq-header {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
}

/* ===== VENDOR PREFIXES FOR GRID ===== */
.grid-2,
.grid-3,
.grid-4,
.services-grid,
.stats-grid,
.about-grid,
.team-grid,
.footer-grid,
.form-row,
.service-selector,
.urgency-selector,
.bento-grid,
.mission-vision-grid,
.tech-grid,
.about-card-stats {
    display: -ms-grid;
    display: grid;
}

/* ===== BACKDROP FILTER FALLBACK ===== */
.navbar,
.booking-form-wrapper,
.service-card,
.team-card,
.stat-card,
.mv-card,
.faq-item,
.hero-stats-floater,
.bento-card {
    /* Fallback solid background for browsers without backdrop-filter */
    background-color: rgba(15, 15, 37, 0.95);
}

@supports ((-webkit-backdrop-filter: blur(20px)) or (backdrop-filter: blur(20px))) {

    .navbar,
    .booking-form-wrapper,
    .service-card,
    .team-card,
    .stat-card,
    .mv-card,
    .faq-item,
    .hero-stats-floater,
    .bento-card {
        background-color: rgba(15, 15, 37, 0.7);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }
}

/* ===== TRANSFORM VENDOR PREFIXES ===== */
.btn:hover,
.service-card:hover,
.team-card:hover,
.stat-card:hover,
.sector-card-premium:hover {
    -webkit-transform: translateY(-5px);
    -ms-transform: translateY(-5px);
    transform: translateY(-5px);
}

.reveal {
    -webkit-transform: translateY(30px);
    -ms-transform: translateY(30px);
    transform: translateY(30px);
}

.reveal.active {
    -webkit-transform: translateY(0);
    -ms-transform: translateY(0);
    transform: translateY(0);
}

/* ===== TRANSITION VENDOR PREFIXES ===== */
*,
*::before,
*::after {
    -webkit-transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    -moz-transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    -ms-transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    -o-transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

/* ===== ANIMATION VENDOR PREFIXES ===== */
@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(20px);
    }

    to {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@-webkit-keyframes pulse {

    0%,
    100% {
        -webkit-transform: scale(1);
        opacity: 1;
    }

    50% {
        -webkit-transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@-webkit-keyframes spin {
    from {
        -webkit-transform: rotate(0deg);
    }

    to {
        -webkit-transform: rotate(360deg);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== BOX SIZING FOR ALL BROWSERS ===== */
html {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    -webkit-box-sizing: inherit;
    -moz-box-sizing: inherit;
    box-sizing: inherit;
}

/* ===== SMOOTH SCROLL FOR ALL BROWSERS ===== */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    html {
        height: -webkit-fill-available;
    }

    body {
        min-height: -webkit-fill-available;
    }

    .hero {
        min-height: -webkit-fill-available;
    }
}

/* ===== FORM INPUTS - CROSS BROWSER ===== */
input,
textarea,
select,
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Remove Safari autofill background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px rgba(25, 25, 45, 1) inset !important;
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Firefox specific styles */
@-moz-document url-prefix() {
    select {
        text-indent: 0.01px;
        text-overflow: '';
    }

    .form-group select {
        padding-right: 30px;
    }
}

/* Edge specific styles */
@supports (-ms-ime-align: auto) {
    .navbar {
        background: rgba(15, 15, 37, 0.98);
    }
}

/* ===== DATE/TIME INPUT FIXES ===== */
input[type="date"],
input[type="time"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.7;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ===== SELECT DROPDOWN ARROW ===== */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px !important;
}

/* ===== BUTTON LOADING STATE ===== */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    -webkit-animation: spin 0.8s linear infinite;
    animation: spin 0.8s linear infinite;
}

/* ===== FORM ERROR/SUCCESS STATES ===== */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.form-group input.success,
.form-group select.success,
.form-group textarea.success {
    border-color: #10B981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

/* Error message styling */
.error-message {
    color: #EF4444;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.form-group.has-error .error-message {
    display: block;
}

/* ===== NOTIFICATION STYLES ===== */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    -webkit-animation: slideInRight 0.3s ease;
    animation: slideInRight 0.3s ease;
    max-width: 90%;
}

.notification-success {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
}

.notification-error {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
}

.notification button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.notification button:hover {
    opacity: 1;
}

@-webkit-keyframes slideInRight {
    from {
        -webkit-transform: translateX(100%);
        opacity: 0;
    }

    to {
        -webkit-transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {

    /* Remove hover effects on touch devices */
    .btn:hover,
    .service-card:hover,
    .team-card:hover {
        -webkit-transform: none;
        transform: none;
    }

    /* Larger touch targets */
    .btn,
    .nav-toggle,
    .faq-header,
    input[type="radio"]+.service-option-content,
    input[type="radio"]+.urgency-content {
        min-height: 48px;
    }

    /* Prevent text selection on buttons */
    .btn,
    .nav-toggle {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ===== PRINT STYLES ===== */
@media print {

    .navbar,
    .hero-scroll,
    .btn,
    .form-actions,
    .notification {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .section {
        page-break-inside: avoid;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    :root {
        --bg-card: rgba(0, 0, 0, 0.9);
        --text-light: #FFFFFF;
    }

    .btn-primary {
        border: 2px solid white;
    }
}

/* ===== REDUCED MOTION ===== */
@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;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1 !important;
        -webkit-transform: none !important;
        transform: none !important;
    }
}

/* ===== DARK MODE SYSTEM PREFERENCE ===== */
@media (prefers-color-scheme: dark) {
    /* Already dark theme, no changes needed */
}

/* ===== FALLBACK FONTS ===== */
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ===== OVERFLOW FIXES ===== */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* ===== FOCUS STATES FOR ACCESSIBILITY ===== */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
}

/* Hide outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Show outline for keyboard users */
:focus-visible {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
}