/* iOS 12 and older Safari compatibility fixes */

/* Ensure basic layout works */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

/* Fallback for CSS variables (not fully supported in iOS 12) */
:root {
  --primary: #FF6B6B;
  --secondary: #4ECDC4;
  --success: #56AB2F;
  --warning: #F7B733;
  --info: #45B3E7;
}

/* Ensure images load properly */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Fix for flexbox issues in older Safari */
.flex {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.flex-col {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.items-center {
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
}

.justify-center {
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}

/* Fix for grid issues */
.grid {
  display: -ms-grid;
  display: grid;
}

/* Ensure transforms work */
.transform {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Fix for backdrop-filter (not supported in iOS 12) */
.backdrop-blur-sm {
  background-color: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* Ensure animations work */
@-webkit-keyframes slideIn {
  0% {
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    -webkit-transform: translateX(0);
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideIn {
  0% {
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    -webkit-transform: translateX(0);
    transform: translateX(0);
    opacity: 1;
  }
}

.animate-slide-in {
  -webkit-animation: slideIn 0.3s ease-out;
  animation: slideIn 0.3s ease-out;
}

/* Fix for object-fit (partial support in iOS 12) */
.object-cover {
  -o-object-fit: cover;
  object-fit: cover;
  font-family: 'object-fit: cover;'; /* IE/Edge polyfill */
}

/* Ensure rounded corners work */
.rounded-2xl {
  border-radius: 1rem;
  -webkit-border-radius: 1rem;
}

.rounded-full {
  border-radius: 9999px;
  -webkit-border-radius: 9999px;
}

/* Fix for sticky positioning (not supported in iOS 12) */
.sticky {
  position: -webkit-sticky;
  position: sticky;
}

/* Ensure transitions work */
.transition-all {
  -webkit-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

/* Fix for appearance */
button,
input,
select,
textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Ensure focus styles work */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary, #FF6B6B);
  outline-offset: 2px;
}

/* Fix for user-select */
.select-none {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Ensure proper font rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fix for touch scrolling */
.overflow-auto,
.overflow-scroll {
  -webkit-overflow-scrolling: touch;
}

/* Ensure proper z-index stacking */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

/* Fix for gap property (not supported in iOS 12 flexbox) */
.gap-2 > * + * { margin-left: 0.5rem; }
.gap-4 > * + * { margin-left: 1rem; }
.gap-6 > * + * { margin-left: 1.5rem; }
.gap-8 > * + * { margin-left: 2rem; }

/* Vertical gap for flex-col */
.flex-col.gap-2 > * + * { margin-left: 0; margin-top: 0.5rem; }
.flex-col.gap-4 > * + * { margin-left: 0; margin-top: 1rem; }
.flex-col.gap-6 > * + * { margin-left: 0; margin-top: 1.5rem; }
.flex-col.gap-8 > * + * { margin-left: 0; margin-top: 2rem; }
