/* Google Fonts - Cairo for Arabic with performance optimization */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* Performance optimizations */
* {
  box-sizing: border-box;
}

/* Optimize font loading */
@font-face {
  font-family: 'Cairo';
  font-display: swap; /* Improve font loading performance */
}

/* Critical rendering optimizations */
img {
  max-width: 100%;
  height: auto;
  loading: lazy; /* Native lazy loading */
}

/* AI Demo Button Animations */
@keyframes pulse-slow {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes rainbow-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes bounce-gentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

.ai-demo-btn {
  background-size: 200% 200%;
  animation: rainbow-shift 3s ease infinite, bounce-gentle 2s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.ai-demo-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.ai-demo-btn:hover::before {
  left: 100%;
}

.ai-demo-btn:hover {
  animation: none;
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* Reduce layout shift */
.aspect-ratio-16-9 {
  aspect-ratio: 16 / 9;
}

.aspect-ratio-1-1 {
  aspect-ratio: 1 / 1;
}

/* Minimal extras over Tailwind */
html, body { height: 100%; }
/* mimic Inventis framed page */
body { background: #f2f2f2; }
/* Fallback if Tailwind isn't loaded yet */
.hidden { display: none !important; }
#fsMenu { transition: opacity .2s ease; }

/* Desktop nav fallback (shows even if Tailwind is blocked) */
.main-desktop-nav { display: none; }
@media (min-width: 768px) {
  .main-desktop-nav { display: flex !important; align-items: center; gap: 1.5rem; }
}

/* Markdown content styling (Medium-like) */
.prose {
  font-family: Inconsolata, ui-sans-serif, system-ui;
  line-height: 1.8;
}
.prose pre {
  background: #111; color: #f8f8f2; padding: 1rem; overflow: auto;
}
.prose code { background: #111; color: #f8f8f2; padding: 0.15rem 0.35rem; border-radius: 4px; }
.prose pre code { background: transparent; padding: 0; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.25em; margin-bottom: .6em; }
.prose a { text-decoration: underline; }

/* Centered blog layout */
.blog-centered { max-width: 860px; margin-left: auto; margin-right: auto; }

/* Arabic language styling with Cairo font */
[lang="ar"], .lang-ar {
  font-family: 'Cairo', sans-serif !important;
  direction: rtl;
  text-align: right;
}

/* Ensure proper spacing for Arabic hero section */
[lang="ar"] #typed, .lang-ar #typed {
  display: inline-block;
  margin-left: 0.5rem;
  margin-right: 0;
  vertical-align: top;
  line-height: 1.2;
  z-index: 1;
  position: relative;
}

[lang="ar"] h1, .lang-ar h1 {
  margin-bottom: 2rem;
  line-height: 1.1;
  overflow: visible;
}

/* Ensure description text has enough top margin in Arabic */
[lang="ar"] h1 + p, .lang-ar h1 + p {
  margin-top: 3rem !important;
  clear: both;
  position: relative;
  z-index: 10;
}

/* Additional spacing for hero section in Arabic */
[lang="ar"] .hero-section h1, .lang-ar .hero-section h1 {
  padding-bottom: 1rem;
}

/* Ensure typed animation doesn't overflow */
[lang="ar"] #typed, .lang-ar #typed {
  max-width: 100%;
  word-wrap: break-word;
}

/* Override for specific elements that should stay LTR in Arabic */
[lang="ar"] .ltr, .lang-ar .ltr {
  direction: ltr;
  text-align: left;
}

/* Ensure code blocks and technical content remain LTR */
[lang="ar"] code, [lang="ar"] pre, [lang="ar"] .stack-item, 
.lang-ar code, .lang-ar pre, .lang-ar .stack-item {
  direction: ltr;
  text-align: left;
  font-family: 'Inconsolata', monospace !important;
}

/* Force proper sizing for admin form inputs */
.admin-form input[type="text"], 
.admin-form input[type="email"], 
.admin-form input[type="file"], 
.admin-form textarea {
  font-size: 0.875rem !important;
  padding: 0.375rem 0.5rem !important;
  height: 2.25rem !important;
  line-height: 1.25rem !important;
}

.admin-form textarea {
  height: 6rem !important;
  line-height: 1.625 !important;
}

.admin-form button {
  font-size: 0.875rem !important;
  padding: 0.375rem 0.75rem !important;
  height: 2.25rem !important;
}

/* Desktop search visibility */
.desktop-search {
  display: flex !important;
  align-items: center;
}

/* Hide desktop search on mobile screens */
@media (max-width: 767px) {
  .desktop-search {
    display: none !important;
  }
}

/* WhatsApp button styles */
.whatsapp-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 40;
  width: 56px;
  height: 56px;
  background-color: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.whatsapp-btn:hover {
  background-color: #128C7E;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Demo page utilities */
.space-y-2 > * + * {
  margin-top: 0.5rem;
}

/* Enhanced button styling */
.btn-enhanced {
  transition: all 0.3s ease;
}

.btn-enhanced:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Responsive adjustments for mobile */
@media (max-width: 640px) {
  .whatsapp-btn {
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
  }
}