:root {
  /* --- ARBAJI GROUP COLORS --- */
  /* Primary (Navy Blue from Logo) */
  --primary-color: #1D3557;
  /* Secondary (Light Gray/Silver from Logo) */
  --secondary-color: #A8DADC;
  /* Accent (Medium Blue for contrast) */
  --accent-color: #457B9D;
  /* --- STATUS COLORS (KEPT) --- */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  /* --- GRADIENTS BASED ON NEW PALETTE --- */
  --gradient-1: linear-gradient(135deg, #1D3557 0%, #457B9D 100%);
  --gradient-2: linear-gradient(135deg, #1D3557 0%, #457B9D 100%);
  /* Kept original for contrast option */
  --gradient-3: linear-gradient(135deg, #A8DADC 0%, #457B9D 100%);
  --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  /* --- TEXT & EFFECT COLORS --- */
  --text-light: #f8fafc;
  --text-dark: #1D3557;
  /* Matches Primary for deep contrast */
  --glass: rgba(255, 255, 255, 0.1);
  --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  overflow-x: hidden;
  background: #fefefe;
}

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  padding: 1rem 0;
}

#home {
  padding-top: 0;
  /* لإتاحة 100vh كاملة */
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
  /* قيمة افتراضية للحفاظ على التباعد */
}

.section-title {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 800;
  background: var(--gradient-1);
  /* يجب تعريف var(--gradient-1) في مكان ما */
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* تم تخفيض الهامش لتجنب اختفاء العنوان تحت شريط التنقل الثابت */
  margin-top: 5rem;
}

.section-subtitle {
  font-size: 1.2rem;
  color: #64748b;
  font-weight: 300;
  max-width: 600px;
  margin: 0.5rem auto 0 auto;
  /* إضافة هامش علوي بسيط للفصل عن العنوان */
}

.section-padding {
  padding: 1rem 0 !important;
  /* جرب هذا أولاً */
}

/* Advanced Navigation */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  z-index: 1000;
  padding: 1rem 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

nav.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 2rem;
}

.logo {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  transition: all 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
  filter: brightness(1.2);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

.nav-menu a {
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.nav-menu a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-3);
  border-radius: 25px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.nav-menu a:hover::before {
  opacity: 0.1;
  transform: scale(1);
}

.nav-menu a:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}

/* Language Selector */
.language-selector {
  position: relative;
}

.language-btn {
  /* تم تحديث استخدام secondary-color */
  background: rgba(168, 218, 220, 0.2);
  border: 1px solid rgba(168, 218, 220, 0.4);
  color: var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.language-btn:hover {
  /* تم تحديث استخدام secondary-color */
  background: rgba(168, 218, 220, 0.4);
  transform: translateY(-2px);
}

/* Enhanced Hero with 3D Building Animation */
.hero {
  height: 100vh;
  background-image: url('../assets/background2.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  perspective: 1000px;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-1);
  /* Your existing gradient variable */
  opacity: 0.7;
  /* Adjust this value for the desired faded effect (0.1 for very light, 0.9 for quite strong) */
  z-index: 1;
  /* Ensure the overlay is above the background image but below any hero content */
}

/* Add this if you have content inside .hero that needs to be above the overlay */
.hero>* {
  position: relative;
  z-index: 2;
  /* Ensure your hero content is above the overlay */
}

.hero-3d-container {
  position: absolute;
  width: 100%;
  height: 100%;
}

#hero-3d-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-content {
  text-align: center;
  color: white;
  z-index: 2;
  max-width: 800px;
  padding: 0 2rem;
  position: relative;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(50px);
  animation: heroSlideUp 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}

.typing-text {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  margin-bottom: 3rem;
  opacity: 0;
  animation: heroSlideUp 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.8s forwards;
  min-height: 3rem;
}

.cta-group {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  animation: heroSlideUp 1.2s cubic-bezier(0.4, 0, 0.2, 1) 1.1s forwards;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.cta-button:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

@keyframes heroSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll Animations */
.fade-in {
  opacity: 1;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* Loading Animation */
.loading {
  background: var(--gradient-1);
  /* يستخدم التدرج الجديد */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: all 0.5s ease;
}

.loading.hide {
  opacity: 0;
  visibility: hidden;
}

.loader {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 🚀 🚀 */
/* 🚀 Responsive Design 🚀 */
/* 🚀 🚀 */

/* 🚀 تحسين استجابة تخطيطات الشبكة (Grid Layouts) 🚀 */
@media (max-width: 992px) {
  .hero {
    /* هذا هو التعديل الأهم:
      إلغاء تأثير "fixed" على الأجهزة اللوحية والموبايل
      لأنه يسبب مشاكل في العرض ويجعل الصورة تبدو "مقربة" أو "مقطوعة"
      'scroll' يجعل الخلفية تمرر مع الصفحة بشكل طبيعي
    */
    background-attachment: scroll;
  }

  /* للأجهزة اللوحية (Tablet) */
  .products-grid,
  .doctors-grid,
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    /* عمودان للأجهزة اللوحية */
    gap: 1.5rem;
  }

  .contact-content {
    grid-template-columns: 1fr;
    /* عمود واحد للتواصل */
    gap: 2.5rem;
  }
}

/* 🚀 Responsive Design (From Original) & Mobile Nav Improvements 🚀 */
@media (max-width: 768px) {
  .hero {
    background-attachment: scroll; /* هذا السطر مكرر ولكن لا يضر */
  }

  .nav-menu {
    display: none;
    /* القاعدة الأصلية */
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .products-grid,
  .doctors-grid,
  .services-grid {
    grid-template-columns: 1fr;
  }

  .contact-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-slide {
    padding: 2rem;
  }

  .products-filter,
  .doctors-filters {
    flex-direction: column;
    align-items: center;
  }

  /* 🚀 تحسين استجابة التنقل على الأجهزة الصغيرة 🚀 */

  /* عرض قائمة التنقل عند فتح الهامبرغر */
  .nav-menu.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    /* أسفل شريط التنقل */
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  }

  .nav-menu li {
    text-align: center;
    width: 100%;
  }

  .nav-menu a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0;
  }

  /* عرض زر الهامبرغر وإخفاء قائمة التنقل الأساسية */
  .hamburger {
    display: flex;
    /* لعرض زر الهامبرغر على شاشات الموبايل */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    margin-left: 1rem;
    /* مسافة عن محدد اللغة */
  }

  .hamburger-line {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
  }

  /* تحويل الهامبرغر إلى علامة إغلاق */
  .hamburger[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
  }

  .hamburger[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
  }

  .hamburger[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
  }

  .language-selector {
    margin-left: auto;
    /* دفع محدد اللغة إلى اليسار قليلاً */
  }

  /* إظهار زر الهامبرغر على الشاشات الصغيرة */
  .nav-container {
    padding: 0 1rem;
  }

  /* توزيع عناصر التنقل: الشعار، القائمة (مخفية)، محدد اللغة، الهامبرغر */
  .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* لا يتم عرض nav-menu إلا إذا أضفنا له .open */
  }
}

/* إضافة نمط لزر الهامبرغر في الشاشات الكبيرة ليظل مخفياً */
@media (min-width: 769px) {
  .hero {
    /* !! تم حذف السطر الإشكالي هنا !!
      كان هنا سطر "background-attachment: scroll;" يمنع 
      تأثير البارالاكس "fixed" من العمل على الديسكتوب.
      بحذفه، سيعود التأثير للعمل على الشاشات الكبيرة فقط.
    */
  }

  .hamburger {
    display: none;
  }
}

/* 🚀 Mobile-specific Layout Tweaks 🚀 */
@media (max-width: 576px) {
  .hero {
    background-attachment: scroll; /* هذا السطر مكرر ولكن لا يضر */
  }

  /* للأجهزة المحمولة (Mobile) */
  .products-grid,
  .doctors-grid,
  .services-grid {
    grid-template-columns: 1fr;
    /* عمود واحد للأجهزة المحمولة */
  }

  .cta-group {
    flex-direction: column;
    /* أزرار الدعوة للعمل (CTA) تصبح فوق بعضها */
  }

  .products-filter,
  .doctors-filters {
    /* لتجنب عرض الأزرار على سطر واحد وضمان التمرير الأفقي أو التراص */
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .filter-btn,
  .doctor-filter-btn {
    flex-grow: 1;
    /* لتوزيع الأزرار بالتساوي أو جعلها تملأ السطر */
  }

  .contact-item div {
    font-size: 0.9rem;
  }

  .contact-info {
    padding: 1.5rem;
  }

  .container {
    padding: 0 1rem;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  .section-title {
    font-size: 2rem;
    /* قيمة صريحة للهواتف */
    margin-top: 3rem;
    /* هامش علوي أكثر أمانًا للهواتف */
  }

  .section-subtitle {
    font-size: 1rem;
  }
}