/*
 * Browser-Specific CSS Fixes
 * Correções específicas para cada navegador
 * Atlantida DMC - 2025
 */

/* Internet Explorer Fixes */
.browser-ie .flex-container {
    display: -ms-flexbox !important;
    display: flex !important;
}

.browser-ie .flex-item {
    -ms-flex: 1 !important;
    flex: 1 !important;
}

.browser-ie .grid-container {
    display: -ms-flexbox !important;
    display: flex !important;
    -ms-flex-wrap: wrap !important;
    flex-wrap: wrap !important;
}

.browser-ie .grid-item {
    -ms-flex: 1 1 300px !important;
    flex: 1 1 300px !important;
}

/* IE11 specific fixes */
.browser-ie-11 .object-fit {
    width: 100%;
    height: 100%;
    object-fit: none;
    font-family: 'object-fit: cover;';
}

/* Firefox Fixes */
.browser-firefox input[type="range"] {
    -moz-appearance: none;
    background: transparent;
}

.browser-firefox input[type="range"]::-moz-range-track {
    background: #ddd;
    height: 4px;
    border-radius: 2px;
}

.browser-firefox input[type="range"]::-moz-range-thumb {
    background: var(--primary-dark, #1E3347);
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
}

.browser-firefox .scrollbar-custom {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Safari Fixes */
.browser-safari .sticky-element {
    position: -webkit-sticky;
    position: sticky;
}

.browser-safari .backdrop-filter {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.browser-safari input[type="search"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.browser-safari input[type="search"]::-webkit-search-decoration,
.browser-safari input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Chrome Fixes */
.browser-chrome input[type="range"]::-webkit-slider-track {
    background: #ddd;
    height: 4px;
    border-radius: 2px;
}

.browser-chrome input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: var(--primary-dark, #1E3347);
    border-radius: 50%;
    width: 16px;
    height: 16px;
}

.browser-chrome .scrollbar-custom::-webkit-scrollbar {
    width: 8px;
}

.browser-chrome .scrollbar-custom::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.browser-chrome .scrollbar-custom::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.browser-chrome .scrollbar-custom::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Edge Legacy Fixes */
.browser-edge .grid-container {
    display: -ms-grid;
    display: grid;
}

.browser-edge .flex-container {
    display: -ms-flexbox;
    display: flex;
}

/* Mobile Fixes */
.browser-mobile .hover-effect:hover {
    /* Remove hover effects on mobile */
    transform: none !important;
    box-shadow: none !important;
}

.browser-mobile input,
.browser-mobile select,
.browser-mobile textarea {
    font-size: 16px !important; /* Prevent zoom on iOS */
}

.browser-mobile .vh-fix {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}

/* Feature Support Fallbacks */

/* No Flexbox Support */
.no-flexbox .flex-container {
    display: table;
    width: 100%;
}

.no-flexbox .flex-item {
    display: table-cell;
    vertical-align: top;
}

/* No Grid Support */
.no-grid .grid-container {
    display: flex;
    flex-wrap: wrap;
}

.no-grid .grid-item {
    flex: 1 1 300px;
}

/* No Custom Properties Support */
.no-customproperties .fallback-colors {
    /* Fallback colors applied */
    color: #333333;
}

.no-customproperties .primary-bg {
    background-color: #1E3347 !important;
}

.no-customproperties .accent-bg {
    background-color: #D71921 !important;
}

.no-customproperties .primary-text {
    color: #1E3347 !important;
}

/* No Object-Fit Support */
.no-objectfit .object-fit-cover {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.no-objectfit .object-fit-cover img {
    opacity: 0;
}

/* No Sticky Position Support */
.no-stickyposition .sticky-fallback {
    position: fixed;
    top: 0;
    z-index: 1000;
}

/* No Backdrop Filter Support */
.no-backdropfilter .backdrop-fallback {
    background-color: rgba(255, 255, 255, 0.8);
}

/* No Aspect Ratio Support */
.no-aspectratio .aspect-ratio-fallback {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 */
}

.no-aspectratio .aspect-ratio-fallback > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Print Styles */
@media print {
    .browser-chrome,
    .browser-firefox,
    .browser-safari,
    .browser-edge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .browser-edge .high-contrast-element,
    .browser-ie .high-contrast-element {
        border: 2px solid;
        background: Window;
        color: WindowText;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .browser-safari *,
    .browser-chrome *,
    .browser-firefox * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .browser-safari .auto-dark,
    .browser-chrome .auto-dark,
    .browser-firefox .auto-dark {
        background-color: #1a1a1a;
        color: #ffffff;
    }
}

/* Specific Version Fixes */

/* Chrome < 60 */
.browser-chrome.version-lt-60 .css-grid {
    display: flex;
    flex-wrap: wrap;
}

/* Firefox < 52 */
.browser-firefox.version-lt-52 .css-grid {
    display: flex;
    flex-wrap: wrap;
}

/* Safari < 10.1 */
.browser-safari.version-lt-10 .css-grid {
    display: flex;
    flex-wrap: wrap;
}

/* Edge Legacy < 16 */
.browser-edge.version-lt-16 .css-grid {
    display: -ms-grid;
}

/* Performance Optimizations */
.browser-ie .will-change-transform {
    /* IE doesn't support will-change, remove it */
    will-change: auto;
}

.browser-safari .gpu-accelerated {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.browser-chrome .gpu-accelerated {
    will-change: transform;
}

/* Input Styling Fixes */
.browser-safari input[type="date"],
.browser-safari input[type="time"],
.browser-safari input[type="datetime-local"] {
    -webkit-appearance: none;
    appearance: none;
}

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

.browser-firefox input[type="number"]::-moz-number-spin-box {
    -moz-appearance: none;
}

.browser-chrome input[type="number"]::-webkit-outer-spin-button,
.browser-chrome input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Form Validation Styling */
.browser-firefox input:invalid {
    box-shadow: none;
}

.browser-chrome input:invalid,
.browser-safari input:invalid {
    outline: none;
}

/* Selection Styling */
.browser-firefox ::-moz-selection {
    background-color: var(--primary-light, #4A90E2);
    color: white;
}

.browser-chrome ::selection,
.browser-safari ::selection {
    background-color: var(--primary-light, #4A90E2);
    color: white;
}

/* Focus Styling */
.browser-firefox button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

.browser-chrome button:focus,
.browser-safari button:focus {
    outline: 2px solid var(--primary-light, #4A90E2);
    outline-offset: 2px;
}

/* Smooth Scrolling */
.browser-safari {
    -webkit-scroll-behavior: smooth;
    scroll-behavior: smooth;
}

.browser-chrome,
.browser-firefox {
    scroll-behavior: smooth;
}
