/* ========================================
   MASTER SPLINTER - BROWSER COMPATIBILITY
   Cross-Browser Support for All Major Browsers
   ======================================== */

/* ========================================
   CSS RESET & NORMALIZATION
   ======================================== */

/* Ensure consistent box-sizing across all browsers */
*,
*::before,
*::after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

/* Remove default margins and paddings */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
}

/* HTML5 display definitions for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
  display: block;
}

/* ========================================
   FLEXBOX COMPATIBILITY
   ======================================== */

/* Flexbox with vendor prefixes for older browsers */
.flex-container,
.site-header,
.hero__stats,
.services-grid,
.footer-grid,
.header-controls,
.cart-item,
.newsletter-form {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
}

/* Flex direction */
.flex-column {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -moz-box-orient: vertical;
  -moz-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
}

/* Flex wrap */
.flex-wrap {
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

/* Justify content */
.justify-center {
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -moz-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.justify-between {
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  -moz-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

/* Align items */
.align-center {
  -webkit-box-align: center;
  -webkit-align-items: center;
  -moz-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

/* Flex grow */
.flex-1 {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -moz-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

/* ========================================
   GRID LAYOUT COMPATIBILITY
   ======================================== */

/* CSS Grid with fallback for older browsers */
.services-grid,
.products-grid,
.gallery-track,
.trust-badges,
.process-steps {
  display: -ms-grid;
  display: grid;
}

/* Grid template columns with IE11 support */
@supports not (display: grid) {
  .services-grid,
  .products-grid {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
  }
  
  .services-grid > *,
  .products-grid > * {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 calc(33.333% - 1.5rem);
    -ms-flex: 0 0 calc(33.333% - 1.5rem);
    flex: 0 0 calc(33.333% - 1.5rem);
    margin: 0.75rem;
  }
}

/* ========================================
   TRANSFORM COMPATIBILITY
   ======================================== */

/* Transform with vendor prefixes */
.transform-scale {
  -webkit-transform: scale(1.05);
  -moz-transform: scale(1.05);
  -ms-transform: scale(1.05);
  -o-transform: scale(1.05);
  transform: scale(1.05);
}

.transform-translate {
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  -o-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

.transform-rotate {
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
}

/* ========================================
   TRANSITION COMPATIBILITY
   ======================================== */

/* Transitions with vendor prefixes */
.button,
.service-card,
.product-card,
.nav-link {
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

/* ========================================
   BORDER RADIUS COMPATIBILITY
   ======================================== */

/* Border radius with vendor prefixes */
.button,
.service-card,
.product-card,
.modal,
.input {
  -webkit-border-radius: var(--radius-md);
  -moz-border-radius: var(--radius-md);
  border-radius: var(--radius-md);
}

/* ========================================
   BOX SHADOW COMPATIBILITY
   ======================================== */

/* Box shadow with vendor prefixes */
.service-card,
.product-card,
.modal,
.floating-whatsapp {
  -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   BACKDROP FILTER COMPATIBILITY
   ======================================== */

/* Backdrop filter with fallback */
.site-nav,
.modal-overlay {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Fallback for browsers that don't support backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {
  .site-nav,
  .modal-overlay {
    background: rgba(246, 251, 255, 0.95);
  }
  
  [data-theme="dark"] .site-nav,
  [data-theme="dark"] .modal-overlay {
    background: rgba(26, 31, 38, 0.95);
  }
}

/* ========================================
   GRADIENT COMPATIBILITY
   ======================================== */

/* Linear gradient with vendor prefixes */
.hero,
.newsletter-section {
  background: -webkit-linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  background: -moz-linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  background: -o-linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

/* ========================================
   APPEARANCE COMPATIBILITY
   ======================================== */

/* Remove default appearance for form elements */
input,
select,
textarea,
button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* ========================================
   USER SELECT COMPATIBILITY
   ======================================== */

/* Prevent text selection on interactive elements */
.button,
.nav-link,
.service-card,
.product-card {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ========================================
   SCROLLBAR STYLING (Webkit browsers)
   ======================================== */

/* Custom scrollbar for Webkit browsers */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark);
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--color-bg);
}

/* ========================================
   PLACEHOLDER STYLING
   ======================================== */

/* Placeholder with vendor prefixes */
::-webkit-input-placeholder {
  color: var(--color-muted);
  opacity: 1;
}

::-moz-placeholder {
  color: var(--color-muted);
  opacity: 1;
}

:-ms-input-placeholder {
  color: var(--color-muted);
  opacity: 1;
}

::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

/* ========================================
   OBJECT FIT COMPATIBILITY
   ======================================== */

/* Object fit with fallback */
img,
video {
  -o-object-fit: cover;
  object-fit: cover;
}

/* Fallback for IE11 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  img,
  video {
    width: 100%;
    height: auto;
  }
}

/* ========================================
   STICKY POSITIONING COMPATIBILITY
   ======================================== */

/* Fixed header for all browsers */
.site-header {
  position: -webkit-fixed;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 10000;
}

/* ========================================
   CALC() COMPATIBILITY
   ======================================== */

/* Calc with vendor prefixes */
.container {
  width: -webkit-calc(100% - 4rem);
  width: -moz-calc(100% - 4rem);
  width: calc(100% - 4rem);
}

/* ========================================
   CSS VARIABLES FALLBACK
   ======================================== */

/* Fallback for browsers that don't support CSS variables */
@supports not (--css: variables) {
  body {
    background: #f6fbff;
    color: #181819;
  }
  
  .button {
    background: #82cfe2;
    color: white;
  }
  
  .service-card {
    background: white;
    border: 1px solid #d9e6ef;
  }
}

/* ========================================
   FILTER EFFECTS COMPATIBILITY
   ======================================== */

/* Filter with vendor prefixes */
.image-filter {
  -webkit-filter: blur(5px);
  filter: blur(5px);
}

/* ========================================
   ANIMATION COMPATIBILITY
   ======================================== */

/* Animation with vendor prefixes */
@-webkit-keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@-moz-keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  -webkit-animation: fadeIn 0.5s ease;
  -moz-animation: fadeIn 0.5s ease;
  animation: fadeIn 0.5s ease;
}

/* ========================================
   CLIP-PATH COMPATIBILITY
   ======================================== */

/* Clip path with vendor prefixes */
.clip-path {
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

/* ========================================
   WILL-CHANGE OPTIMIZATION
   ======================================== */

/* Performance optimization for animations */
.service-card,
.product-card,
.button {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000;
  perspective: 1000;
}

/* ========================================
   TOUCH ACTION (Mobile)
   ======================================== */

/* Prevent double-tap zoom on mobile */
a, button, input, select, textarea {
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

/* ========================================
   TEXT RENDERING OPTIMIZATION
   ======================================== */

/* Optimize text rendering across browsers */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* ========================================
   SAFE AREA INSETS (iPhone X+)
   ======================================== */

/* Support for notch devices */
@supports (padding: max(0px)) {
  .site-header,
  .site-footer {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  /* لا تعديل لزر الواتساب في الكمبيوتر */
}

/* ========================================
   INTERNET EXPLORER SPECIFIC FIXES
   ======================================== */

/* IE10+ specific styles */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /* Fix flexbox bugs in IE */
  .flex-container {
    display: -ms-flexbox;
  }
  
  /* Fix min-height in IE */
  .hero,
  .section {
    height: auto;
  }
  
  /* Fix object-fit in IE */
  img {
    width: 100%;
  }
}

/* IE11 specific fixes */
_:-ms-fullscreen, :root .services-grid {
  display: -ms-grid;
  -ms-grid-columns: 1fr 1fr 1fr;
  -ms-grid-rows: auto;
}

/* ========================================
   SAFARI SPECIFIC FIXES
   ======================================== */

/* Fix for Safari's viewport units bug */
@supports (-webkit-touch-callout: none) {
  .hero {
    min-height: -webkit-fill-available;
  }
}

/* Fix for Safari's date input */
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}

/* ========================================
   FIREFOX SPECIFIC FIXES
   ======================================== */

/* Firefox-specific button fixes */
@-moz-document url-prefix() {
  button::-moz-focus-inner,
  input[type="button"]::-moz-focus-inner,
  input[type="submit"]::-moz-focus-inner {
    border: 0;
    padding: 0;
  }
}

/* ========================================
   EDGE SPECIFIC FIXES
   ======================================== */

/* Edge-specific fixes */
@supports (-ms-ime-align: auto) {
  .services-grid {
    display: -ms-grid;
  }
}

/* ========================================
   PRINT COMPATIBILITY
   ======================================== */

@media print {
  /* Optimize for printing */
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  @page {
    margin: 2cm;
  }
}
