/* ==================== CROSS-BROWSER COMPATIBILITY ==================== */

/* Prefixos para Flexbox (Safari, Edge Legacy) */
.hero-grid,
.services-grid,
.calculator-grid,
.loan-type-selector,
.calc-mode-buttons,
.calc-radio-group {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

/* Prefixos para Transform (Safari, Edge Legacy) */
.btn-primary:hover,
.btn-secondary:hover,
.service-card:hover,
.loan-type-btn:hover,
.why-card:hover,
.testimonial-card:hover,
.partner-logo:hover {
    -webkit-transform: translateY(-2px);
    -ms-transform: translateY(-2px);
    transform: translateY(-2px);
}

/* Prefixos para Transition (Safari, Edge Legacy) */
.btn-primary,
.btn-secondary,
.service-card,
.loan-type-btn,
.calc-mode-btn,
.calc-radio-label {
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

/* Prefixos para Border Radius (Edge Legacy) */
.calculator-card,
.calc-result-card,
.calc-input-lg,
.calc-radio-label {
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
}

/* Prefixos para Box Shadow (Safari, Edge Legacy) */
.calculator-card,
.service-card,
.calc-result-card {
    -webkit-box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

/* Prefixos para User Select (Safari, Edge Legacy) */
.calc-input-lg[readonly],
.calc-result-value {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Prefixos para Appearance (Safari, Firefox) */
input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="radio"] {
    -webkit-appearance: radio;
    -moz-appearance: radio;
    appearance: radio;
}

/* Fix para Input Range no IE11 e Edge Legacy */
input[type="range"]::-ms-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

input[type="range"]::-ms-fill-lower {
    background: var(--blue-600);
    border-radius: 10px;
}

input[type="range"]::-ms-fill-upper {
    background: #e5e7eb;
    border-radius: 10px;
}

input[type="range"]::-ms-thumb {
    width: 20px;
    height: 20px;
    background: var(--blue-600);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
}

/* Fix para Flexbox no IE11 */
.calculator-grid {
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.calc-inputs,
.calc-results {
    -ms-flex: 1 1 45%;
    flex: 1 1 45%;
}

/* Fix para Grid no IE11 (usa Flexbox como fallback) */
@supports not (display: grid) {

    .services-grid,
    .why-grid,
    .testimonials-grid {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .service-card,
    .why-card,
    .testimonial-card {
        -ms-flex: 1 1 calc(33.333% - 2rem);
        flex: 1 1 calc(33.333% - 2rem);
    }
}

/* Fix para Object Fit no IE11 e Edge Legacy */
@supports not (object-fit: cover) {

    .hero-image img,
    .about-image img {
        width: 100%;
        height: auto;
    }
}

/* Fix para Smooth Scroll no Safari */
@supports not (scroll-behavior: smooth) {
    html {
        scroll-behavior: auto;
    }
}

/* Fix para Sticky no IE11 e Edge Legacy */
@supports not (position: sticky) {
    #header {
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 1000;
    }
}

/* Fix para CSS Variables no IE11 */
@supports not (--css: variables) {
    .btn-primary {
        background: #2563eb;
        color: white;
    }

    .btn-primary:hover {
        background: #1d4ed8;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Melhora performance de scroll no iOS */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix para 100vh no Mobile (iOS Safari) */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        min-height: -webkit-fill-available;
    }
}

/* Previne seleÃ§Ã£o de texto em elementos interativos (Mobile) */
.loan-type-btn,
.calc-mode-btn,
.btn-primary,
.btn-secondary {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
/* ==================== VALIDAÇÃO DE CAMPOS ==================== */

/* Remove spinners em inputs number (melhor UX mobile) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Feedback visual para erro em campos editáveis */
.calc-input-lg.error {
    border: 2px solid #ef4444 !important;
    background: #fee2e2 !important;
    -webkit-animation: shake 0.3s ease;
    animation: shake 0.3s ease;
}

/* Animação de shake para erro */
@-webkit-keyframes shake {
    0%, 100% { -webkit-transform: translateX(0); transform: translateX(0); }
    25% { -webkit-transform: translateX(-5px); transform: translateX(-5px); }
    75% { -webkit-transform: translateX(5px); transform: translateX(5px); }
}

@keyframes shake {
    0%, 100% { -webkit-transform: translateX(0); transform: translateX(0); }
    25% { -webkit-transform: translateX(-5px); transform: translateX(-5px); }
    75% { -webkit-transform: translateX(5px); transform: translateX(5px); }
}
