/* Safari iOS Compatibility Fixes */
/* These fixes specifically target iOS Safari issues without changing visual appearance */

/* Prevent zoom on input focus by ensuring minimum 16px font size on iOS */
@supports (-webkit-touch-callout: none) {
    input, 
    textarea, 
    select {
        font-size: 16px !important;
        -webkit-appearance: none;
        border-radius: 0;
    }
    
    input[type="text"],
    input[type="email"], 
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea {
        font-size: 16px !important;
        -webkit-appearance: none;
    }
}

/* Enhanced radio button styling for better iOS touch targets */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    outline: none;
    margin-right: 8px;
    position: relative;
    vertical-align: middle;
    cursor: pointer;
}

input[type="radio"]:checked {
    border-color: #007cba;
    background-color: #007cba;
}

input[type="radio"]:checked::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Improved checkbox styling for iOS */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    outline: none;
    margin-right: 8px;
    position: relative;
    vertical-align: middle;
    cursor: pointer;
}

input[type="checkbox"]:checked {
    border-color: #007cba;
    background-color: #007cba;
}

input[type="checkbox"]:checked::before {
    content: '✓';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}

/* iOS Safari specific fixes for Swiper carousels */
.swiper-container,
.swiper-wrapper,
.swiper-slide {
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.swiper-container {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
}

.swiper-slide {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Fix for Contact Form 7 step visibility issues on iOS */
.wpcf7-form .step {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
}

.wpcf7-form .step:not(.current-step) {
    display: none !important;
}

/* Ensure form elements are properly visible on iOS Safari */
.wpcf7 input,
.wpcf7 textarea,
.wpcf7 select {
    opacity: 1 !important;
    visibility: visible !important;
    -webkit-appearance: none;
    appearance: none;
}

/* iOS Safari button touch improvements */
button,
input[type="submit"],
input[type="button"],
.btn {
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
}

/* Prevent iOS Safari from adding blue highlight on touch */
a, button, input, textarea, select {
    -webkit-tap-highlight-color: transparent;
}

/* Fix for iOS Safari viewport issues */
@media screen and (max-width: 767px) {
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    /* Ensure touch targets are at least 44px as per iOS guidelines */
    button,
    input[type="submit"],
    input[type="button"],
    .btn,
    a.button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
}

/* iOS Safari form validation styling */
input:invalid {
    box-shadow: none;
    -webkit-appearance: none;
}

input:focus:invalid {
    outline: none;
    border-color: #dc3232;
}

/* Enhanced touch scrolling for iOS */
.scrollable,
.overflow-auto,
.elementor-widget-container {
    -webkit-overflow-scrolling: touch;
}

/* Fix for iOS Safari zoom on select */
select {
    font-size: 16px !important;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* iOS Safari specific media query for better responsiveness */
@supports (-webkit-touch-callout: none) {
    .responsive-element {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Fix for iOS Safari input autofill styling */
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px white inset !important;
    -webkit-text-fill-color: #333 !important;
}

/* iOS Safari specific touch action improvements */
.touch-element,
.clickable,
.swiper-slide,
.carousel-item {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Ensure proper rendering on iOS Safari */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iOS Safari specific fixes for form elements in modals/popups */
.modal input,
.popup input,
.overlay input {
    font-size: 16px !important;
    -webkit-appearance: none;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Additional iOS Safari optimizations */
img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Fix for iOS Safari sticky elements */
.sticky,
.fixed-element {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
