/* Safari Compatibility Fixes - Imobify v3.7 */

/* 1. Backdrop-filter fallbacks para Safari */
.backdrop-blur-xl {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.backdrop-blur-lg {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* 2. Grid fallbacks para Safari */
.grid {
    display: -webkit-grid;
    display: grid;
}

.grid-cols-1 {
    -webkit-grid-template-columns: repeat(1, minmax(0, 1fr));
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    -webkit-grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
    -webkit-grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
    -webkit-grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* 3. Flexbox fallbacks para Safari */
.flex {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.flex-col {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
}

.flex-row {
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
    flex-direction: row;
}

.items-center {
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.justify-center {
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}

.justify-between {
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

/* 4. Transform fallbacks para Safari */
.transform {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.translate-y-0 {
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

.translate-y-1 {
    -webkit-transform: translateY(0.25rem);
    transform: translateY(0.25rem);
}

.translate-y-2 {
    -webkit-transform: translateY(0.5rem);
    transform: translateY(0.5rem);
}

.scale-105 {
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
}

/* 5. Transition fallbacks para Safari */
.transition {
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.transition-all {
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.transition-transform {
    -webkit-transition: transform 0.3s ease;
    transition: transform 0.3s ease;
}

.transition-colors {
    -webkit-transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* 6. Border-radius fallbacks para Safari */
.rounded-lg {
    -webkit-border-radius: 0.5rem;
    border-radius: 0.5rem;
}

.rounded-xl {
    -webkit-border-radius: 0.75rem;
    border-radius: 0.75rem;
}

.rounded-2xl {
    -webkit-border-radius: 1rem;
    border-radius: 1rem;
}

.rounded-full {
    -webkit-border-radius: 9999px;
    border-radius: 9999px;
}

/* 7. Box-shadow fallbacks para Safari */
.shadow-lg {
    -webkit-box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shadow-xl {
    -webkit-box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 8. Gradient fallbacks para Safari */
.bg-gradient-to-r {
    background: -webkit-linear-gradient(left, var(--tw-gradient-stops));
    background: linear-gradient(to right, var(--tw-gradient-stops));
}

.bg-gradient-to-br {
    background: -webkit-linear-gradient(135deg, var(--tw-gradient-stops));
    background: linear-gradient(135deg, var(--tw-gradient-stops));
}

/* 9. Fixes específicos para Safari */
@supports (-webkit-appearance: none) {
    /* Safari-specific fixes */
    
    /* Fix para backdrop-filter em Safari */
    .navigation {
        background: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }
    
    /* Fix para grid em Safari */
    .grid {
        display: -webkit-grid;
        display: grid;
    }
    
    /* Fix para flexbox em Safari */
    .flex {
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
    }
    
    /* Fix para transform em Safari */
    .transform {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Fix para transition em Safari */
    .transition {
        -webkit-transition: all 0.3s ease;
        transition: all 0.3s ease;
    }
}

/* 10. Media queries específicas para Safari */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    /* Safari-specific styles */
    
    /* Fix para elementos flutuantes */
    .floating-element {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Fix para animações */
    @keyframes float {
        0%, 100% { 
            -webkit-transform: translateY(0px) rotate(0deg);
            transform: translateY(0px) rotate(0deg);
        }
        50% { 
            -webkit-transform: translateY(-20px) rotate(180deg);
            transform: translateY(-20px) rotate(180deg);
        }
    }
    
    @keyframes gradientShift {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }
    
    /* Fix para dashboard preview */
    .dashboard-preview {
        -webkit-transform: perspective(1000px) rotateY(-15deg) rotateX(10deg);
        transform: perspective(1000px) rotateY(-15deg) rotateX(10deg);
    }
    
    .dashboard-preview:hover {
        -webkit-transform: perspective(1000px) rotateY(-8deg) rotateX(4deg) scale(1.03);
        transform: perspective(1000px) rotateY(-8deg) rotateX(4deg) scale(1.03);
    }
}

/* 11. Fixes para problemas específicos do Safari */
.safari-fix {
    /* Force hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* 12. Fix para scroll suave no Safari */
html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 13. Fix para elementos com backdrop-filter */
.backdrop-blur {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* 14. Fix para grid gaps no Safari */
.gap-4 {
    gap: 1rem;
    -webkit-gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
    -webkit-gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
    -webkit-gap: 2rem;
}

/* 15. Fix para flex gaps no Safari */
.flex.gap-2 > * + * {
    margin-left: 0.5rem;
}

.flex.gap-4 > * + * {
    margin-left: 1rem;
}

.flex.gap-6 > * + * {
    margin-left: 1.5rem;
}

/* 16. Fix para elementos com position sticky no Safari */
.sticky {
    position: -webkit-sticky;
    position: sticky;
}

/* 17. Fix para elementos com clip-path no Safari */
.clip-path {
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* 18. Fix para elementos com mask no Safari */
.mask {
    -webkit-mask: url(#mask);
    mask: url(#mask);
}

/* 19. Fix para elementos com filter no Safari */
.filter {
    -webkit-filter: blur(0);
    filter: blur(0);
}

/* 20. Fix para elementos com mix-blend-mode no Safari */
.mix-blend-mode {
    -webkit-mix-blend-mode: normal;
    mix-blend-mode: normal;
}
