/* Critical CSS for performance optimization */

/* Font loading optimization */
@font-face {
  font-family: 'Cairo';
  font-display: swap;
  font-weight: 300 700;
  src: url('https://fonts.gstatic.com/s/cairo/v28/SLXgc1nY6HkvalIvTp2mxd4.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE80-FEFC;
}

@font-face {
  font-family: 'Inter';
  font-display: swap;
  font-weight: 300 700;
  src: url('https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hjg.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Critical performance optimizations */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Image optimization */
img {
  max-width: 100%;
  height: auto;
  loading: lazy;
  decoding: async;
}

/* Preload critical images */
.hero-bg {
  background-image: url('/static/images/hero-bg.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
}

/* Performance-optimized animations */
@media (prefers-reduced-motion: no-preference) {
  .animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
  }
  
  @keyframes fadeInUp {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .animate-fade-in-up {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Loading spinner for better UX */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f4f6;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Alert messages */
.alert {
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 6px;
  font-weight: 500;
  animation: slideIn 0.3s ease-out;
}

.alert-success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-error {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

@keyframes slideIn {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Form loading state */
.loading {
  pointer-events: none;
  opacity: 0.7;
}

.loading input,
.loading textarea,
.loading button {
  cursor: not-allowed;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  /* Improve tap targets for mobile */
  button,
  a,
  input[type="submit"],
  input[type="button"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Optimize form inputs for mobile */
  input,
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Focus indicators for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.3s;
}

.skip-to-content:focus {
  top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bg-gray-50 {
    background-color: #ffffff;
  }
  
  .text-gray-600 {
    color: #000000;
  }
  
  .border-gray-200 {
    border-color: #000000;
  }
}

/* Print styles */
@media print {
  .no-print,
  nav,
  footer,
  .mobile-menu,
  .cta-buttons {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  h1 { font-size: 24pt; }
  h2 { font-size: 18pt; }
  h3 { font-size: 16pt; }
  
  a::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }
}