/* ====== المتغيرات الأساسية ====== */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary: #8b5cf6;
  --dark: #0f172a;
  --gray-900: #1e293b;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --light: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* ====== Reset & Global Styles ====== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1200px;
  padding: 0 1rem;
  margin: 0 auto;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* ====== Header Styles ====== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  transition: var(--transition);
}

/* ====== Header Top Styles ====== */
.header-top {
  background-color: var(--dark);
  padding: 10px 0;
  font-size: 14px;
  color: var(--gray-300);
}

.header-top-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.top-left > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-left a {
  color: var(--gray-300);
  transition: var(--transition);
}

.top-left a:hover {
  color: var(--white);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.social-icons {
  display: flex;
  gap: 10px;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--gray-300);
  font-size: 12px;
  transition: var(--transition);
}

.social-icon:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
}

.language-switch {
  position: relative;
  cursor: pointer;
}

.current-lang {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 4px;
  transition: var(--transition);
}

.current-lang:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.flag-icon {
  width: 18px;
  height: auto;
  border-radius: 2px;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background-color: var(--gray-800);
  border-radius: 8px;
  overflow: hidden;
  min-width: 150px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  z-index: 10;
}

.language-switch:hover .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  transition: var(--transition);
}

.lang-option:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ====== Header Main Styles ====== */
.header-main {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px 0;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}

.main-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo a {
  display: block;
}

.logo img {
  height: 40px;
  transition: var(--transition);
}

.logo-dark {
  display: block;
}

.logo-light {
  display: none;
}

.menu-toggle {
  display: none;
  cursor: pointer;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 24px;
  width: 30px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: var(--gray-700);
  border-radius: 3px;
  transition: var(--transition);
}

.main-menu {
  margin-left: auto;
  margin-right: 40px;
}

.menu-list {
  display: flex;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}

.menu-item {
  position: relative;
  margin: 0;
  padding: 0;
}

.menu-link {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  color: var(--gray-700);
  font-weight: 500;
  transition: var(--transition);
  border-radius: 6px;
  text-align: left;
  justify-content: flex-start;
  width: 100%;
}

.menu-link span {
  display: block;
  width: 100%;
  text-align: left;
}

.dropdown-icon {
  margin-left: 5px;
  font-size: 10px;
  transition: var(--transition);
}

.menu-item.active .menu-link,
.menu-link:hover {
  color: var(--primary);
}

.menu-item.active .menu-link {
  background-color: rgba(59, 130, 246, 0.08);
}

.menu-item.has-dropdown:hover .dropdown-icon {
  transform: rotate(180deg);
}

.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--white);
  border-radius: 8px;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  z-index: 10;
}

.menu-item.has-dropdown:hover .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(5px);
}

.submenu li a {
  display: block;
  padding: 8px 20px;
  color: var(--gray-700);
  transition: var(--transition);
  text-align: left;
  padding-left: 20px;
}

.submenu li a:hover {
  background-color: var(--gray-100);
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 500;
  transition: var(--transition);
}

.btn-outline-light {
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline-light:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: rgba(59, 130, 246, 0.05);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.support-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--gray-100);
  color: var(--primary);
  transition: var(--transition);
}

.support-icon:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
}

.tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--dark);
  color: var(--white);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  pointer-events: none;
}

.tooltip:before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background-color: var(--dark);
}

.support-icon:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* ====== Transparent Header Variation (for hero sections) ====== */
.header.transparent .header-main {
  background-color: transparent;
  box-shadow: none;
}

.header.transparent .logo-light {
  display: block;
}

.header.transparent .logo-dark {
  display: none;
}

.header.transparent .menu-link {
  color: var(--white);
}

.header.transparent .menu-item.active .menu-link,
.header.transparent .menu-link:hover {
  color: var(--primary-light);
}

.header.transparent .menu-item.active .menu-link {
  background-color: rgba(255, 255, 255, 0.1);
}

.header.transparent .hamburger span {
  background-color: var(--white);
}

.header.transparent .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--white);
}

.header.transparent .btn-outline-light:hover {
  border-color: var(--white);
  background-color: rgba(255, 255, 255, 0.1);
}

.header.transparent .support-icon {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.header.transparent .support-icon:hover {
  background-color: var(--white);
  color: var(--primary);
}

/* ====== Scrolled State ====== */
.header.scrolled .header-top {
  padding: 5px 0;
}

.header.scrolled .header-main {
  padding: 12px 0;
}

.header.scrolled .logo img {
  height: 35px;
}

/* ====== Transparent Header Scrolled ====== */
.header.transparent.scrolled .header-main {
  background-color: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

/* ====== RTL Support ====== */
html[dir="rtl"] .menu-link {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .menu-link span {
  text-align: right;
}

html[dir="rtl"] .dropdown-icon {
  margin-left: 0;
  margin-right: 5px;
}

html[dir="rtl"] .main-menu {
  margin-left: 40px;
  margin-right: auto;
}

html[dir="rtl"] .submenu {
  left: auto;
  right: 0;
}

html[dir="rtl"] .submenu li a {
  text-align: right;
  padding-right: 20px;
  padding-left: 0;
}

html[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

/* ====== Responsive Designs ====== */
@media (max-width: 1024px) {
  .top-left > div:not(:first-child) {
    display: none;
  }
  
  .menu-link {
    padding: 10px 12px;
  }
  
  .header-actions .action-button {
    padding: 8px 16px;
  }
}

@media (max-width: 992px) {
  .menu-toggle {
    display: block;
    z-index: 100;
    position: relative;
  }
  
  .main-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background-color: var(--white);
    box-shadow: var(--shadow-xl);
    padding: 60px 20px 20px 20px;
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
  }
  
  .main-menu.active {
    right: 0;
    opacity: 1;
    visibility: visible;
  }
  
  .menu-list {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  
  .menu-item {
    width: 100%;
  }
  
  .menu-link {
    padding: 12px 15px;
    justify-content: space-between;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 5px;
    background-color: #f8fafc;
    padding-left: 15px;
  }
  
  .menu-link:hover,
  .menu-item.active .menu-link {
    background-color: #e2e8f0;
  }
  
  .submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background-color: var(--white);
    margin-top: 5px;
    display: none;
    margin-bottom: 10px;
    border-radius: 8px;
    padding: 5px;
    border: 1px solid #e2e8f0;
    width: 100%;
  }
  
  .submenu li a {
    padding-left: 25px;
  }
  
  .menu-item.has-dropdown.active .submenu,
  .menu-item.has-dropdown.open .submenu {
    display: block;
  }
  
  .menu-item.has-dropdown .dropdown-icon {
    margin-left: auto;
  }
  
  .menu-item.has-dropdown.active .dropdown-icon,
  .menu-item.has-dropdown.open .dropdown-icon {
    transform: rotate(180deg);
  }
  
  .header-actions {
    display: none;
  }
  
  .menu-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 9px);
  }
  
  .menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -9px);
  }
  
  .menu-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
  }
  
  .menu-close:hover {
    background-color: var(--primary);
    color: var(--white);
  }
  
  html[dir="rtl"] .main-menu {
    right: auto;
    left: -100%;
  }
  
  html[dir="rtl"] .main-menu.active {
    right: auto;
    left: 0;
  }
  
  html[dir="rtl"] .menu-close {
    right: auto;
    left: 15px;
  }
  
  html[dir="rtl"] .menu-link {
    padding-right: 15px;
    padding-left: 0;
  }
  
  html[dir="rtl"] .submenu li a {
    padding-right: 25px;
    padding-left: 0;
  }
  
  html[dir="rtl"] .menu-item.has-dropdown .dropdown-icon {
    margin-right: auto;
    margin-left: 0;
  }
  
  body.menu-opened {
    overflow: hidden;
  }
  
  .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }
  
  .menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 768px) {
  /* 2. تثبيت زر اللغة وأزرار التواصل في مكانهما على الشاشات الصغيرة */
  .header-top-inner {
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .top-left, .top-right {
    width: auto;
    justify-content: flex-start;
  }
  
  .top-right {
    justify-content: flex-end;
  }
  
  .top-left > div:not(:first-child) {
    display: none;
  }
  
  .language-switch {
    margin-left: auto;
  }
  
  .social-icons {
    margin-right: auto;
  }
}

@media (max-width: 576px) {
  .header-top {
    font-size: 12px;
  }
  
  .logo img {
    height: 32px;
  }
  
  .menu-toggle {
    z-index: 101;
  }
}

/* ====== 1. زيادة المسافة بين الهيدر وقسم Home ===== */
.section#home {
  padding-top: 150px; /* زيادة المسافة في الأعلى */
  margin-top: 0;
}

/* للشاشات الصغيرة */
@media (max-width: 768px) {
  .section#home {
    padding-top: 120px;
  }
}

/* ===== 3. مواضع الأزرار العائمة ===== */
/* زر تاوك - دائمًا في الزاوية اليمنى السفلية */
.tawkto-button,
#tawkchat-minified-wrapper {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 990 !important;
  left: auto !important; /* تجاوز أي إعدادات RTL */
}

/* زر العودة للأعلى - دائمًا فوق زر تاوك */
.back-to-top {
  position: fixed;
  bottom: 90; /* ضع هذا فوق زر تاوك */
  right: 29px;
  z-index: 990;
  left: auto !important; /* تجاوز أي إعدادات RTL */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--primary-dark);
  transform: translateY(-3px);
}

/* زر واتساب - دائمًا في الزاوية اليسرى السفلية */
.whatsapp-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: auto !important; /* تجاوز أي إعدادات RTL */
  z-index: 990;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #25D366;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-md);
}

/* ضمان هذه المواضع حتى في وضع RTL */
html[dir="rtl"] .tawkto-button,
html[dir="rtl"] #tawkchat-minified-wrapper {
  right: 17px !important;
  left: auto !important;
}

html[dir="rtl"] .back-to-top {
  right: 20px;
  left: auto !important;
}

html[dir="rtl"] .whatsapp-button {
  left: 20px;
  right: auto !important;
}

/* ===== 4. تأثير الوميض لأزرار التواصل الاجتماعي ===== */
@keyframes socialPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* تطبيق التأثير على جميع أزرار التواصل الاجتماعي */
.social-icon,
.whatsapp-button,
.back-to-top {
  animation: socialPulse 2s infinite;
}

/* تأخير التأثير لكل زر لمنع تزامنهم */
.social-icon:nth-child(2) {
  animation-delay: 0.3s;
}

.social-icon:nth-child(3) {
  animation-delay: 0.6s;
}

.whatsapp-button {
  animation-delay: 0.9s;
}

/* تحسين القائمة الجانبية على الأجهزة المحمولة */
@media (max-width: 992px) {
  .main-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh !important; /* تأكيد الارتفاع الكامل */
    min-height: 100vh !important; /* الحد الأدنى للارتفاع */
    overflow-y: auto;
    z-index: 1000;
    background-color: var(--white);
    padding: 20px;
    padding-top: 70px; /* مساحة للهيدر */
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: block;
  }
  
  /* إزالة شريط التمرير المزدوج */
  .menu-list {
    height: auto !important;
    overflow: visible !important;
    padding: 0;
    margin: 0;
    width: 100%;
  }
  
  /* تحسين مظهر الروابط */
  .menu-link {
    padding: 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    width: 100%;
    display: flex;
    align-items: center;
  }
  
  /* تعديلات RTL للقائمة الجانبية */
  html[dir="rtl"] .main-menu {
    right: auto;
    left: -100%;
  }
  
  html[dir="rtl"] .main-menu.active {
    right: auto;
    left: 0;
  }
  
  /* إزالة تنسيقات زر الإغلاق لأننا أزلناه */
  .menu-close {
    display: none;
  }
  
  /* تأكيد مظهر زر القائمة حتى في اتجاه RTL */
  .menu-toggle {
    display: flex;
    z-index: 1001;
  }
  
  /* إضافة طبقة تغطية شفافة خلف القائمة */
  .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* منع التمرير في الصفحة عند فتح القائمة */
  body.menu-opened {
    overflow: hidden;
  }
}

/* تأكيد عرض القائمة على الشاشات الصغيرة جدًا */
@media (max-width: 576px) {
  .main-menu {
    width: 85%;
  }
}

/* تنسيق زر العودة للأعلى */
.back-to-top {
  position: fixed;
  bottom: 100px;
  right: 30x;
  width: 40px;
  height: 40px;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 990;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--primary-light);
  transform: translateY(-3px);
}

/* ضمان أن زر العودة للأعلى يظل في مكانه في اتجاه RTL */
html[dir="rtl"] .back-to-top {
  left: auto !important;
  right: 20px !important;
}