/* style.css */
:root {
  --primary: #2c3e50;
  --secondary: #3498db;
  --accent: #e74c3c;
  --light: #ecf0f1;
  --dark: #2c3e50;
  --gray: #95a5a6;
  --success: #27ae60;
  --warning: #f39c12;
  --text: #333;
  --text-light: #777;
  --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', sans-serif;
  line-height: 1.6;
  color: var(--text);
  direction: var(--page-direction, rtl); /* Default to rtl, can be overridden by JS */
  overflow-x: hidden;
  /* تحسينات الأداء */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* قواعد خاصة باللغة العربية */
body[dir="rtl"] .feature-line {
  flex-direction: row-reverse !important;
}

body[dir="rtl"] .feature-line i {
  margin-left: 10px !important;
  margin-right: 0 !important;
}

body {
  /* Hide body until translations are loaded to prevent FOUC */
  visibility: hidden;
}


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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
}

h1 {
  font-size: 3.5rem;
}

h2 {
  font-size: 2.5rem;
  position: relative;
  padding-bottom: 15px;
}

h2:after {
  content: '';
  position: absolute;
  bottom: 0;
  /* Default for RTL */
  right: 0;
  left: auto;
  width: 70px;
  height: 4px;
  background: var(--secondary);
  border-radius: 2px;
}

p {
  margin-bottom: 1rem;
  color: var(--text-light);
}

.highlight {
  color: var(--secondary);
}

/* Buttons */
.btn {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  -webkit-border-radius: 50px;
  -moz-border-radius: 50px;
  border-radius: 50px;
  font-weight: 600;
  text-decoration: none;
  -webkit-transition: var(--transition);
  -moz-transition: var(--transition);
  -ms-transition: var(--transition);
  -o-transition: var(--transition);
  -webkit-transition: var(--transition);
  transition: var(--transition);
  cursor: pointer;
  border: none;
  text-align: center;
  font-size: 1rem;
}

.btn-primary {
  background: var(--secondary);
  color: white;
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
  background: #2980b9;
  -webkit-transform: translateY(-3px);
  -moz-transform: translateY(-3px);
  -ms-transform: translateY(-3px);
  -o-transform: translateY(-3px);
  -webkit-transform: translateY(-3px);
  transform: translateY(-3px);
  box-shadow: 0 7px 15px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--secondary);
  border: 2px solid var(--secondary);
}

.btn-secondary:hover {
  background: var(--secondary);
  color: white;
  -webkit-transform: translateY(-3px);
  -moz-transform: translateY(-3px);
  -ms-transform: translateY(-3px);
  -o-transform: translateY(-3px);
  -webkit-transform: translateY(-3px);
  transform: translateY(-3px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-small {
  padding: 8px 20px;
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  -webkit-transition: var(--transition);
  -moz-transition: var(--transition);
  transition: var(--transition);
}

.navbar.scrolled {
  background: white;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  padding: 5px 0;
}

.nav-container {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  padding: 15px 0;
}

.logo {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.5rem;
}

.logo img {
  height: 38px; /* كان 50px */
  margin-left: 10px; /* For RTL */
  margin-right: 0;
}

.nav-menu {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 25px; /* المسافة بين قائمة الروابط والأزرار */
  -webkit-box-flex: 1;
  -ms-flex-positive: 1;
  flex-grow: 1; /* السماح لهذا العنصر بالنمو */
  -webkit-box-pack: end;
  -ms-flex-pack: end;
  justify-content: flex-end; /* دفع المحتوى إلى النهاية (يمين في LTR) */
  flex-wrap: wrap;
}

.footer-logo {
  height: 80px;      /* تكبير الأيقونة */
  width: 80px;       /* جعلها مربعة */
  border-radius: 50%; /* جعلها دائرية */
  object-fit: cover;  /* لضبط الصورة داخل الدائرة */
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); /* ظل خفيف اختياري */
}

.nav-links {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  list-style: none;
  -webkit-box-flex: 1;
  -ms-flex-positive: 1;
  flex-grow: 1; /* جعل القائمة تتمدد لتملأ المساحة */
  -ms-flex-pack: distribute;
  justify-content: space-around; /* توزيع الروابط بشكل متساوٍ */
  padding: 0 20px; /* إضافة هوامش داخلية لتجنب الالتصاق */
}

.nav-links a:after {
  content: '';
  position: absolute;
  bottom: -5px;
  /* Default for RTL */
  right: 0;
  left: auto;
  width: 0;
  height: 2px;
  background: var(--secondary);
  transition: var(--transition);
}

.nav-links a:hover:after,
.nav-links a.active:after {
  width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--secondary);
}
.nav-links a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: var(--transition);
  position: relative;
}


.nav-actions {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 15px;
}

.language-switcher {
  padding: 8px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: white;
  color: var(--text);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  min-width: 120px;
  direction: ltr;
  text-align: left;
  font-size: 0.9rem;
}

/* New Language Switcher Styles */
.language-switcher-container {
  position: relative;
}

.language-switcher-btn {
  background-color: transparent;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 8px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  min-width: 120px;
  justify-content: space-between;
}

.flag-icon {
  width: 24px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.language-switcher-btn i {
  transition: transform 0.3s ease;
}

.language-switcher-btn[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.language-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  list-style: none;
  padding: 5px 0;
  margin-top: 5px;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

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

@media (max-width: 768px) {
  .language-switcher {
    min-width: 100px;
    padding: 6px 10px;
    font-size: 0.85rem;
  }
}
.language-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.language-dropdown .dropdown-item:hover {
  background-color: #f5f5f5;
}

/* End of New Language Switcher Styles */




.nav-toggle {
  display: none;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  cursor: pointer;
}

.bar {
  width: 25px;
  height: 3px;
  background: var(--primary);
  margin: 3px 0;
  transition: var(--transition);
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 100vh;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  color: white;
  overflow: hidden;
  padding-top: 80px;
}

/* Performance enhancement for hero background */
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/image1.jpg');
  background-size: cover;
  background-position: center;
  z-index: -2;
}

.hero-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(44, 62, 80, 0.8); /* Using primary color for overlay */
  z-index: -1;
}

.hero .container {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  display: -ms-grid;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero-content h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  animation: fadeInUp 1s ease;
}

.hero-content p {
  font-size: 1.2rem;
  margin-bottom: 30px;
  color: rgba(255, 255, 255, 0.8);
  animation: fadeInUp 1s ease 0.2s forwards;
  opacity: 0;
}

.hero-actions {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 15px;
  animation: fadeInUp 1s ease 0.4s forwards;
  opacity: 0;
}

.hero-image {
  position: relative;
  height: 500px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.floating-card {
  position: absolute;
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  color: var(--text); /* لون النص الافتراضي */
  width: 200px; /* زيادة العرض لاستيعاب النصوص الأطول */
  text-align: center;
  animation: float 5s ease-in-out infinite;
}

.floating-card:nth-child(1) {
  top: 20%;
  left: 10%;
  animation-delay: 0s;
  background: var(--secondary);
  color: white;
}

.floating-card:nth-child(2) {
  top: 50%;
  right: 10%;
  animation-delay: 1s;
}

.floating-card:nth-child(3) {
  bottom: 20%;
  left: 20%;
  animation-delay: 2s;
  background: var(--accent);
  color: white;
}

.floating-card i {
  font-size: 2rem;
  margin-bottom: 10px;
}

.floating-card h4 {
  margin-bottom: 8px; /* تعديل المسافة */
  font-size: 1rem; /* تصغير حجم الخط قليلاً */
}

.floating-card p {
  margin: 0;
  font-size: 0.85rem; /* تصغير حجم الخط قليلاً */
  color: #555;
}

/* جعل النص فاتحاً في البطاقات الملونة لزيادة الوضوح */
.floating-card:nth-child(1) p,
.floating-card:nth-child(3) p {
  color: rgba(255, 255, 255, 0.85);
}

.scroll-down {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 1.5rem;
  animation: bounce 2s infinite;
}

/* Stats Section */
.stats {
  padding: 40px 0 0; /* Adjusted padding */
  background: transparent; /* Make background transparent */
  border-top: 1px solid #e0e0e0; /* Add a separator line */
}

.stats-grid {
  display: -ms-grid;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
}

.stat-item {
  text-align: center;
  padding: 30px 20px;
  background: white;
  border-radius: 10px;
  -webkit-box-shadow: var(--shadow);
  -moz-box-shadow: var(--shadow);
  box-shadow: var(--shadow);
  -webkit-transition: var(--transition);
  transition: var(--transition);
}

.stat-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.stat-item i {
  font-size: 2.5rem;
  color: var(--secondary);
  margin-bottom: 15px;
}

.counter {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.stat-item p {
  margin: 0;
  color: var(--text-light);
  font-weight: 600;
}

/* Sections */
.section {
  padding: 100px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2::after {
  left: 50% !important;
  right: 50% !important;
  transform: translate(-50%, 0);
}

.section-header p {
  max-width: 700px;
  margin: 0 auto;
  font-size: 1.1rem;
}

.bg-light {
  background: var(--light);
}

.bg-dark {
  background: var(--dark);
  color: white;
}

.bg-dark .section-header h2,
.bg-dark .section-header p {
  color: white;
}

.bg-dark .section-header h2:after {
  background: var(--secondary);
}

/* Cards */
.grid-3 {
  display: -ms-grid;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  -webkit-box-shadow: var(--shadow);
  -moz-box-shadow: var(--shadow);
  box-shadow: var(--shadow);
  -webkit-transition: transform 0.3s ease, box-shadow 0.3s ease;
  -moz-transition: transform 0.3s ease, box-shadow 0.3s ease;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  will-change: transform;
  text-align: center; /* القيمة الافتراضية */
}

/* محاذاة الكروت للغة العربية */
[dir="rtl"] .card {
  text-align: right;
}

/* محاذاة الكروت للغة الإنجليزية ولغات أخرى */
[dir="ltr"] .card {
  text-align: left;
}

/* تحديد اتجاه النص والمحاذاة بناءً على لغة الكروت */
.work-card .card-content[lang="en"],
.work-card .card-content[lang="de"] {
  direction: ltr;
  text-align: left;
}

.work-card .card-content[lang="ar"] {
  direction: rtl;
  text-align: right;
}

.card:hover {
  -webkit-transform: translateY(-10px);
  -moz-transform: translateY(-10px);
  transform: translateY(-10px);
  -webkit-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.card-icon {
  position: absolute;
  top: 20px;
  left: 20px;
  background: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  z-index: 2;  
  color: var(--secondary);
  font-size: 1.2rem;
}

.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  margin-bottom: 0;
}

.card-content {
  padding: 0 12px 25px;
}

.work-card .card-content {
  padding: 0 8px 16px;   /* مسافة بسيطة من الجوانب */
  display: flex;
  flex-direction: column;
  height: calc(100% - 200px);

  text-align: start;     /* يبدأ من اليمين لو RTL، من الشمال لو LTR */
  direction: inherit;    /* يرث اتجاه اللغة من الصفحة */
}


.card h3 {
  font-size: 1.3rem;
  margin-top: 8px;
  margin-bottom: 8px;
  color: var(--primary);
}

.card p {
  margin: 0 0 15px;
  color: var(--text-light);
}

.card-link {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 5px;
  color: var(--secondary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  -webkit-transition: var(--transition);
}

.card-link:hover {
  gap: 10px;
  color: var(--primary);
}

.team-desc {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  background: white;
  -webkit-border-radius: 10px;
  border-radius: 10px;  
  box-shadow: var(--shadow);
}

.team-desc p {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  font-weight: 600;
  color: var(--primary);
}

.team-desc i {
  color: var(--secondary);
  font-size: 1.2rem;
}

/* About Section */
.about-grid {
  display: -ms-grid;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
}

.about-image {
  height: 100%; /* جعل حاوية الصورة تمتد بكامل الارتفاع */
}

.about-image img {
  width: 100%;
  height: 100%; /* جعل الصورة تملأ الحاوية بالكامل */
  object-fit: cover; /* لضمان ملء الصورة للمساحة دون تشويه */
  border-radius: 15px;
  -webkit-border-radius: 15px;
  box-shadow: var(--shadow);
}

.features {
  margin-top: 30px;
}

.feature {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.feature i {
  font-size: 1.5rem;
  color: var(--secondary);
  margin-top: 5px;
}

.feature h4 {
  margin-bottom: 5px;
  color: var(--primary);
}

.feature p {
  margin: 0;
  color: var(--text-light);
}

/* الجامعات - سلايدر نهائي ومضمون */
.logos-slider {
  width: 100%;
  overflow: hidden;
  height: 200px;
  background: transparent;
  position: relative;
  margin-bottom: 40px;
  direction: ltr;
}

.logos-container {
  width: 100%;
  overflow: hidden;
}

.logos-track {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 50px;
  align-items: center;
  width: max-content;
  animation: final-scroll 60s linear infinite;
}

.logo-item {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  height: 150px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-item img {
  max-width: 180px;
  max-height: 100px;
  object-fit: contain;
  display: block;
}

/* توقف عند hover */
.logos-slider:hover .logos-track {
  -webkit-animation-play-state: paused;
  animation-play-state: paused;
}

/* تأثير hover */
.logo-item:hover {
  -webkit-transform: scale(1.05);
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* حركة نهائية ومضمونة */
@keyframes final-scroll {
  0% {
    -webkit-transform: translateX(0);
    transform: translateX(0);
  }
  100% {
    -webkit-transform: translateX(calc(-11 * (220px + 50px)));
    transform: translateX(calc(-11 * (220px + 50px))); /* 11 هو عدد الصور الأصلية */
  }
}

/* Testimonials */
.testimonials-slider {
  /* This class is no longer used for the grid, but kept for potential future use */
  position: relative;
  width: 100%;
  overflow: hidden;
}

.testimonial-grid {
  display: -ms-grid;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}
.testimonial {
  background: rgba(255, 255, 255, 0.1);
  padding: 30px;
  border-radius: 15px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-transition: transform 0.3s ease, background 0.3s ease;
  transition: transform 0.3s ease, background 0.3s ease;
}

.testimonial:hover {
  -webkit-transform: translateY(-5px);
  -moz-transform: translateY(-5px);
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
}

.testimonial-content {
  position: relative;
}

.quote {
  position: absolute;
  top: -20px;
  left: -10px;
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.1);
}

.testimonial p {
  color: white;
  font-style: italic;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

.testimonial-author {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  gap: 15px;
}

.testimonial-author img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

/* تحسين تحميل صور آراء العملاء */
.testimonial-img {
  opacity: 1; /* إظهار الصور مباشرة */
  transition: opacity 0.3s ease-in-out;
  background-color: #e9ecef; /* لون خلفية فاتح */
  object-fit: cover;
  will-change: opacity;
}

.testimonial-img[src] {
  opacity: 1;
}

.testimonial-author h4 {
  color: white;
  margin-bottom: 5px;
}

.testimonial-author p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-style: normal;
}

/* Contact Section */
.contact-grid {
  display: -ms-grid;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
}

.contact-info h3 {
  margin-bottom: 30px;
  color: var(--primary);
}

.contact-item {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.contact-item i {
  font-size: 1.5rem;
  color: var(--secondary);
  margin-top: 5px;
}

.contact-item h4 {
  margin-bottom: 5px;
  color: var(--primary);
}

.contact-item p {
  margin: 0;
  color: var(--text-light);
}

.contact-email-link {
  color: var(--text-light); /* لون مطابق للنص المحيط */
  text-decoration: none; /* إزالة الخط السفلي */
  transition: color 0.3s ease;
}

.contact-email-link:hover {
  color: var(--secondary); /* لون أزرق عند المرور */
  text-decoration: none; /* التأكيد على عدم وجود خط سفلي */
}


.contact-form {
  background: white;
  padding: 30px;
  -webkit-border-radius: 15px;
  -moz-border-radius: 15px;
  border-radius: 15px;  
  box-shadow: var(--shadow);
}

.form-group {
  position: relative;
  margin-bottom: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;  
  padding: 15px 50px 15px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;  
  -webkit-transition: var(--transition);
  -moz-transition: var(--transition);
  transition: var(--transition);
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.form-group i {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  color: var(--gray);
}

.form-group textarea + i {
  top: 20px;
  transform: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--secondary);  
  -webkit-box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  -moz-box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  outline: none;
}

/* Footer */
.footer {
  background: var(--dark);
  color: white;
  padding: 80px 0 0;
}

.footer-grid {
  display: -ms-grid;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 60px;
}

.footer-col h4 {
  color: white;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 10px;
}

.footer-col h4:after {
  content: '';
  position: absolute;
  bottom: 0;
  /* Default for RTL */
  right: 0;
  left: auto;
  width: 40px;
  height: 3px;
  background: var(--secondary);
}

.footer-col p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 20px;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col ul li a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  -webkit-transition: var(--transition);
  transition: var(--transition);
}

.footer-col ul li a:hover {
  color: var(--secondary);
  -webkit-padding-start: 5px;
  padding-right: 5px;
}

.social-links {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 15px;
}

.social-links a {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  text-decoration: none;
  -webkit-transition: var(--transition);
  transition: var(--transition);
}

.social-links a:hover {
  background: var(--secondary);
  -webkit-transform: translateY(-3px);
  -moz-transform: translateY(-3px);
  transform: translateY(-3px);
}

.newsletter-form {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  margin-top: 15px;
}

.newsletter-form input {
  flex: 1;
  padding: 12px 15px;
  border: none;
  border-radius: 5px 0 0 5px;
  font-family: 'Cairo', sans-serif;
}

.newsletter-form input.valid {
  border: 2px solid var(--success);
  box-shadow: 0 0 5px rgba(39, 174, 96, 0.5);
}

.newsletter-form input.invalid {
  border: 2px solid var(--accent);
  box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
}

.newsletter-form button {
  padding: 0 18px;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  -webkit-transition: var(--transition);
  transition: var(--transition);
}

.newsletter-form button:hover {
  background: #2980b9;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  flex-direction: row; /* Default for RTL */
}

.footer-bottom p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

.footer-links {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  -webkit-transition: var(--transition);
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--secondary);
}

/* Scroll to Top */
.scroll-top {
  position: fixed;
  position: fixed;
  bottom: 30px;
  /* Default for RTL */
  left: 30px;
  right: auto;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: var(--transition);
  z-index: 999;
  border: none;
}

.scroll-top.active {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  background: #2980b9;
  -webkit-transform: translateY(-3px);
  -moz-transform: translateY(-3px);
  transform: translateY(-3px);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: translateY(30px);
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
    -webkit-transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
    -webkit-transform: translateY(-15px);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0) translateX(-50%);
  }
  40% {
    -webkit-transform: translateY(-20px) translateX(-50%);
    transform: translateY(-20px) translateX(-50%);
  }
  60% {
    -webkit-transform: translateY(-10px) translateX(-50%);
    transform: translateY(-10px) translateX(-50%);
  }
}

/* Work Cards Styling */
.work-card {
  position: relative;
  background: white;
  border-radius: 15px;
  overflow: hidden;
  -webkit-box-shadow: var(--shadow);
  box-shadow: var(--shadow);
  -webkit-transition: transform 0.3s ease, box-shadow 0.3s ease;
  -moz-transition: transform 0.3s ease, box-shadow 0.3s ease;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  padding-bottom: 50px; /* مساحة للأزرار الثابتة */
  will-change: transform;
  margin-bottom: 15px;
}

/* Works Container Styling */
.works-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.works-container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 20px;
  padding: 15px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  margin: 0 40px;
}

.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  -webkit-transition: var(--transition);
  transition: var(--transition);
}

.scroll-btn:hover {
  background: var(--primary);
  -webkit-transform: translateY(-50%) scale(1.1);
  -moz-transform: translateY(-50%) scale(1.1);
  transform: translateY(-50%) scale(1.1);
}

.scroll-btn.left {
  right: 0;
}

.scroll-btn.right {
  left: 0;
}

.works-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.works-container .work-card {
  flex: 0 0 250px;
}

.work-card:hover {
  -webkit-transform: translateY(-5px);
  -moz-transform: translateY(-5px);
  transform: translateY(-5px);
  -webkit-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.work-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;  
  -webkit-transition: transform 0.3s ease;
  transition: transform 0.3s ease;
}

.work-card:hover img {
  -webkit-transform: scale(1.05);
  transform: scale(1.05);
}

.work-card .card-content h3 {
  font-size: 1rem;
  margin-bottom: 8px; /* تعديل المسافة بين العنوان والوصف */
}

.work-card .card-content p {
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 0; /* إزالة الهامش السفلي من الفقرة داخل بطاقة العمل */
}

.section-title {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--secondary), #2980b9);
  color: white;
  padding: 8px 15px;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  z-index: 3;
  border-radius: 10px 10px 0 0;
}

.fixed-download-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: block;
  text-align: center;
  padding: 10px;
  background: #27ae60;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95em;
  font-weight: bold;  
  -webkit-transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  -moz-transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 2;
  will-change: transform;
}

.fixed-download-btn:hover {
  background: #229954;  
  -webkit-transform: translateY(-2px);
  -moz-transform: translateY(-2px);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

/* تحسين أداء الأنيميشن عند السكرول */
.card, .feature, .testimonial, .work-card {
  opacity: 0;
  -webkit-transform: translateY(50px);
  transform: translateY(50px);
  -webkit-transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: opacity, transform;
}

/* إزالة المسافة العلوية من أول قسم بعد الـ header */
.hero + .section {
  padding-top: 0; /* إزالة المسافة العلوية تمامًا */
}


.card.is-visible, .feature.is-visible, .testimonial.is-visible, .work-card.is-visible {
  opacity: 1;
  -webkit-transform: translateY(0);
  -moz-transform: translateY(0);
  transform: translateY(0);
}

/* Lazy Loading Image Styles */
.lazy-image {
  transition: opacity 0.4s ease-in-out;
  opacity: 0;
}

.lazy-image.loaded {
  opacity: 1;
}

/* Responsive Design */
@media (max-width: 992px) {
  h1 {
    font-size: 2.8rem;
  }
  
  h2 {
    font-size: 2.2rem;
  }
  
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .hero-image {
    height: 400px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  
  .about-image {
    order: -1;
  }
}

@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav-menu {
    position: fixed;
    top: 80px;
    right: -100%;
    width: 80%;
    max-height: calc(100vh - 80px); /* Use max-height to allow shrinking */
    background: white;
    display: flex; /* Ensure flex is active */
    flex-direction: column; /* Stack items vertically */
    justify-content: flex-start; /* Align items to the top */
    padding: 0; /* Remove padding to use full height for scrolling */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    align-items: stretch; /* Stretch items to full width */
    overflow-y: auto;
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  .nav-links {
    padding: 0;
    flex-direction: column;
  }

  .nav-links li {
    width: 100%;
  }
  
  .nav-links a {
    display: block;
    padding: 15px 25px; /* Increase padding for better touch targets */
    border-bottom: 1px solid #eee;
    width: 100%;
    text-align: right;
  }

  .works-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    overflow-x: visible;
    margin: 0;
    padding: 0;
  }

  .works-container .work-card {
    flex-basis: auto; /* Reset flex basis */
  }

  .scroll-btn {
    display: none;
  }

  .nav-actions {
    padding: 20px 25px; /* Add padding here */
    width: 100%;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .nav-links a:hover, .nav-links a.active {
    background-color: #f8f9fa;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .nav-toggle.active .bar:nth-child(1) {
    -webkit-transform: rotate(-45deg) translate(-5px, 6px);
    transform: rotate(-45deg) translate(-5px, 6px);
  }
  
  .nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle.active .bar:nth-child(3) {
    -webkit-transform: rotate(45deg) translate(-5px, -6px);
    transform: rotate(45deg) translate(-5px, -6px);
  }
  
  .hero-actions {
    flex-direction: column;
  }
  
  .floating-card {
    position: relative;
    margin: 15px auto;
    width: 80%;
  }
  
  .hero-image {
    height: auto;
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 576px) {
  h1 {
    font-size: 2.2rem;
    line-height: 1.2;
  }
  
  h2 {
    font-size: 1.8rem;
    line-height: 1.3;
  }
  
  .section {
    padding: 50px 0;
  }
  
  .section-header {
    margin-bottom: 40px;
  }
  
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .testimonials-slider {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .stat-item {
    padding: 20px 15px;
  }
  
  .floating-card {
    width: 95%;
    padding: 15px;
  }
  
  .floating-card h4 {
    font-size: 1rem;
  }
  
  .floating-card p {
    font-size: 0.8rem;
  }
  
  .hero-content h1 {
    font-size: 2.4rem;
    margin-bottom: 15px;
  }
  
  .hero-content p {
    font-size: 1.1rem;
    margin-bottom: 25px;
  }
  
  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .card-content {
    padding: 20px;
  }
  
  .testimonial {
    padding: 20px;
  }
  
  .work-card {
    padding-bottom: 50px;
  }
  
  .fixed-download-btn {
    padding: 8px;
    font-size: 0.85em;
  }
  
  .payment-icons {
    gap: 15px;
  }
  
  .payment-icons i {
    font-size: 2.2rem;
  }
  
  .whatsapp-float {
    width: 50px;
    height: 50px;
    font-size: 1.8em;
    bottom: 20px;
    right: 20px;
  }

  .wiki-assistant-float {
    width: 50px;
    height: 50px;
    font-size: 1.6em;
    bottom: 80px; /* Positioned above WhatsApp button */
    right: 20px;
  }
  
  .scroll-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    left: 20px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px 12px 12px 40px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .logos-slider {
    height: 120px;
  }
  
  .logo-item {
    min-width: 160px;
    height: 100px;
    padding: 15px;
  }
  
  .logo-item img {
    max-width: 130px;
    max-height: 70px;
  }
  
  .contact-grid {
    gap: 30px;
  }
  
  .contact-form {
    padding: 20px;
  }
}

.static-content {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 900px;
  margin: 0 auto;
}

.static-content h3 {
  color: var(--primary);
  margin-top: 30px;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
}

.static-content p {
  line-height: 1.8;
  color: var(--text-light);
}

.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.payment-method {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.payment-method:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  border-color: var(--secondary);
}

.payment-method i {
  font-size: 2.5rem;
  color: var(--primary);
}

.payment-method img {
  height: 35px;
  height: 40px; /* توحيد ارتفاع جميع صور طرق الدفع */
  object-fit: contain;
}

.payment-method span {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.payment-note {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.payment-contact {
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.payment-contact .contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #25D366;
  color: white;
  padding: 8px 18px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}
.payment-contact .contact-link:hover {
  background-color: #128C7E;
  transform: scale(1.05);
}
/* For screen-reader only labels */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* قسم طرق الدفع */
.payment-section {
  background: #f9f9f9;
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  margin-top: 50px;
  border: 1px solid #eee;
}

.payment-section h3 {
  color: var(--primary);
  margin-bottom: 25px;
  font-size: 1.6rem;
}

.payment-subtitle {
  color: var(--primary);
  font-size: 1.3rem;
  margin-top: 30px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 10px;
}
.payment-icons {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  flex-wrap: wrap;
  margin-bottom: 25px;
  color: var(--gray);
}

.payment-icons i, .payment-icons .payment-text {
  font-size: 2.8rem;
}
.payment-icons .payment-text {
  font-size: 1.2rem;
  font-weight: 600;
}
.footer-whatsapp-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #25D366;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.footer-whatsapp-link:hover {
  color: #128C7E;
}

.footer-whatsapp-link i {
  font-size: 1.5em;
  vertical-align: middle;
}

body:not(.homepage) .footer-whatsapp-link {
  margin-top: 15px;
}

.payment-icons img {
  height: 45px; /* لتوحيد حجم الصور مع الأيقونات الأخرى */
  object-fit: contain;
}

.whatsapp-float {
  position: fixed;
  bottom: 30px;
  /* Default for RTL */
  right: 30px;
  left: auto;
  background: #25D366;
  color: #FFF;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  font-size: 2em;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  -webkit-transform: translateY(20px);
  -moz-transform: translateY(20px);
  -ms-transform: translateY(20px);
  -o-transform: translateY(20px);
  transform: translateY(20px);
}

.wiki-assistant-float {
  position: fixed;
  bottom: 95px; /* Positioned above WhatsApp button */
  /* Default for RTL */
  right: 30px;
  left: auto;
  background: #6c757d; /* A professional gray tone */
  color: #FFF;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  font-size: 1.8em;
  z-index: 9998; /* Slightly below WhatsApp for overlap management */
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  -webkit-transform: translateY(20px);
  -moz-transform: translateY(20px);
  -ms-transform: translateY(20px);
  -o-transform: translateY(20px);
  transform: translateY(20px);
}

/* للصفحة الرئيسية - في الجهة المقابلة لسهم العودة للأعلى */
body.homepage .whatsapp-float {
  right: 30px;
}

/* للصفحات الأخرى - تظهر دائماً */
body:not(.homepage) .whatsapp-float {
  opacity: 1;
  visibility: visible;
  -webkit-transform: translateY(0);
  -moz-transform: translateY(0);
  -ms-transform: translateY(0);
  -o-transform: translateY(0);
  transform: translateY(0);
}

/* في الصفحة الرئيسية - تظهر عند الوصول لقسم الخدمات */
body.homepage .whatsapp-float.show {
  opacity: 1;
  visibility: visible;
  -webkit-transform: translateY(0);
  -moz-transform: translateY(0);
  -ms-transform: translateY(0);
  -o-transform: translateY(0);
  transform: translateY(0);
}

/* للصفحات الأخرى - تظهر دائماً */
body:not(.homepage) .wiki-assistant-trigger {
  opacity: 1;
  visibility: visible;
  -webkit-transform: translateY(0);
  -moz-transform: translateY(0);
  -ms-transform: translateY(0);
  -o-transform: translateY(0);
  transform: translateY(0);
}

body.homepage .wiki-assistant-trigger.show {
  opacity: 1;
  visibility: visible;
  -webkit-transform: translateY(0);
  -moz-transform: translateY(0);
  -ms-transform: translateY(0);
  -o-transform: translateY(0);
  transform: translateY(0);
}

.whatsapp-float:hover {
  background: #128C7E;
  -webkit-transform: translateY(-3px);
  -moz-transform: translateY(-3px);
  -ms-transform: translateY(-3px);
  -o-transform: translateY(-3px);
  transform: translateY(-3px);
}

/* تحسين hover للصفحات الأخرى */
body:not(.homepage) .whatsapp-float:hover {
  -webkit-transform: translateY(-3px);
  -moz-transform: translateY(-3px);
  -ms-transform: translateY(-3px);
  -o-transform: translateY(-3px);
  transform: translateY(-3px);
}

body:not(.homepage) .wiki-assistant-trigger:hover {
  background: #5a6268; /* Darker gray for hover effect */
  -webkit-transform: translateY(-3px);
  -moz-transform: translateY(-3px);
  -ms-transform: translateY(-3px);
  -o-transform: translateY(-3px);
  transform: translateY(-3px);
}

/* Custom styles for new pricing cards */
.price-tag {
  font-size: 1.1em;
  margin: 15px 0;
  color: var(--dark);
}
.price-tag strong {
  font-size: 1.4em;
  color: var(--secondary);
}
.price-card-extra-icon {
  font-size: 2.5em;
  color: var(--secondary);
  margin-bottom: 15px;
  display: block;
  text-align: center;
}

.price-card-discover-btn {
  margin-top: 15px;
  display: inline-block;
  width: auto;
}

.additional-services {
  list-style: none;
  padding: 0;
  text-align: right;
  margin: 15px 0;
}
.additional-services li {
  margin-bottom: 10px;
  font-size: 0.95em;
}
.additional-services li i {
  color: var(--secondary);
  margin-left: 8px; /* Default for RTL */
  margin-right: 0;
}

.section-footer {
  text-align: center;
  margin-top: 40px;
  line-height: 1.8;
}

/* LTR adjustments */
html[dir="ltr"] {
  --page-direction: ltr;
}

html[dir="ltr"] body {
  direction: ltr;
}

html[dir="ltr"] h2:after {
  left: 50% !important;
  right: 50% !important;
  transform: translate(-50%, 0);
}

html[dir="ltr"] .logo img {
  margin-left: 0;
  margin-right: 10px;
}

html[dir="ltr"] .nav-links a:after {
  right: auto;
  left: 0;
}

html[dir="ltr"] .nav-menu {
  justify-content: flex-start; /* Push content to the start (left in LTR) */
}

html[dir="ltr"] .nav-links {
  justify-content: space-around; /* Distribute links evenly */
}

html[dir="ltr"] .nav-links a {
  text-align: left;
}

html[dir="ltr"] .nav-actions {
  flex-direction: row;
}

html[dir="ltr"] .language-switcher {
  text-align: right;
}

html[dir="ltr"] .footer-col h4:after {
  right: auto;
  left: 0;
}

html[dir="ltr"] .footer-col ul li a:hover {
  padding-left: 5px;
  padding-right: 0;
}


html[dir="ltr"] .footer-bottom p {
  text-align: left;
}

html[dir="ltr"] .footer-links {
  flex-direction: row;
}

html[dir="ltr"] .scroll-top {
  left: auto;
  right: 30px;
}

html[dir="ltr"] .whatsapp-float {
  right: auto;
  left: 30px;
}

/* Responsive adjustments for LTR */
@media (max-width: 768px) {
  html[dir="ltr"] .nav-menu {
    right: auto;
    left: -100%;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
  }

  html[dir="ltr"] .nav-menu.active {
    left: 0;
  }

  html[dir="ltr"] .nav-links a {
    text-align: left;
  }

  html[dir="ltr"] .nav-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
  }
  
  html[dir="ltr"] .nav-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
  }

  html[dir="ltr"] .footer-bottom {
    flex-direction: column; /* Stack vertically on small screens */
  }

  html[dir="ltr"] .footer-bottom p {
    text-align: center;
  }

  html[dir="ltr"] .scroll-top {
    left: 30px; /* Keep on left for consistency with RTL on small screens */
    right: auto;
  }

  html[dir="ltr"] .whatsapp-float {
    right: 30px; /* Keep on right for consistency with RTL on small screens */
    left: auto;
  }

  html[dir="ltr"] .wiki-assistant-float {
    right: 30px;
    left: auto;
  }
}

@media (max-width: 576px) {
  html[dir="ltr"] .scroll-top {
    left: 20px;
    right: auto;
  }

  html[dir="ltr"] .whatsapp-float {
    right: 20px;
    left: auto;
  }

  html[dir="ltr"] .wiki-assistant-float {
    right: 20px;
    left: auto;
  }
}

/* Specific adjustments for RTL/LTR in work cards */
html[dir="ltr"] .work-card .card-content {
  text-align: left;
  direction: ltr;
}

html[dir="rtl"] .work-card .card-content {
  text-align: right;
  direction: rtl;
}

html[dir="ltr"] .card-icon {
  left: auto;
  right: 20px;
}

html[dir="rtl"] .card-icon {
  left: 20px;
  right: auto;
}

html[dir="ltr"] .card-link i {
  margin-left: 5px;
  margin-right: 0;
  transform: scaleX(-1); /* Flip arrow for LTR */
}

html[dir="rtl"] .card-link i {
  margin-right: 5px;
  margin-left: 0;
  transform: scaleX(1);
}

html[dir="ltr"] .team-desc p i {
  margin-right: 10px;
  margin-left: 0;
}

html[dir="ltr"] .feature i {
  margin-right: 15px;
  margin-left: 0;
}

html[dir="ltr"] .contact-item i {
  margin-right: 15px;
  margin-left: 0;
}

html[dir="ltr"] .form-group input,
html[dir="ltr"] .form-group select,
html[dir="ltr"] .form-group textarea {
  padding: 15px 15px 15px 50px; /* Adjust padding for icon on left */
}

html[dir="ltr"] .form-group i {
  right: auto;
  left: 15px;
}

html[dir="ltr"] .newsletter-form input {
  border-radius: 0 5px 5px 0;
}

html[dir="ltr"] .newsletter-form button {
  border-radius: 5px 0 0 5px;
}

html[dir="ltr"] .additional-services {
  text-align: left;
}

html[dir="ltr"] .additional-services li i {
  margin-right: 8px;
  margin-left: 0;
}

/* Specific adjustments for German language navbar to improve spacing */
html[lang="de"] .nav-links {
  flex-grow: 1; /* Ensure the links container can grow */
  justify-content: space-between; /* Distribute links to fill the available space */
  padding: 0 10px; /* Add some padding to avoid sticking to edges */
}

/* Wikipedia Modal Styles */
.wiki-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.wiki-modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.wiki-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.wiki-close:hover,
.wiki-close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

.wiki-modal-content h2 {
  margin-top: 0;
  color: #333;
  text-align: center;
}

.wiki-modal-content input[type="text"] {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 16px;
}

.wiki-modal-content button {
  width: 100%;
  background-color: #6c757d;
  color: white;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.wiki-modal-content button:hover {
  background-color: #5a6268;
}

#wiki-results {
  margin-top: 20px;
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid #ddd;
  padding-top: 10px;
}

#wiki-results p {
  margin: 0 0 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
}

/* ===========================
   Wikipedia Assistant Styles
   =========================== */
:root{
  --primary:#0b5ea8;
  --secondary:#2980b9;
  --text:#222;
  --text-light:#6b7280; 
  --bg:#f6f9fc;
  --card:#fff;
  --wiki-primary: #3366cc; /* لون جوجل الأزرق */
  --wiki-secondary: #4a89dc; /* أزرق أفتح */
  --wiki-bg: #f8f9fa;
  --wiki-card-bg: #ffffff;
  --wiki-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Trigger Button */
.wiki-assistant-trigger{
  position:fixed;
  bottom:95px;
  right:30px;
  width:55px;height:55px;border-radius:50%;
  /* Glassmorphism Style */
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--wiki-primary); /* لون الأيقونة */
  text-decoration: none;
  display:flex;align-items:center;justify-content:center;
  font-size:1.5rem;z-index:9999;cursor:pointer;box-shadow:0 8px 25px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
  opacity: 0; /* Added for initial hidden state */
  visibility: hidden; /* Added for initial hidden state */
  transform: translateY(20px); /* Added for initial hidden state */
}
.wiki-assistant-trigger:hover{transform:translateY(-5px) scale(1.05); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2); background: rgba(255, 255, 255, 0.3);}
/* Panel */
#wikiAssistantPanel{
  position:fixed;
  right:10px; /* مسافة بسيطة من الجانب */
  left:auto;
  width:380px;max-width:calc(100vw - 20px);
  background:var(--wiki-bg);border-radius:14px;box-shadow:var(--wiki-shadow);
  display:flex;flex-direction:column;opacity:0;visibility:hidden;
  transform: translateY(18px) scale(.98);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, bottom 0.3s ease;
  z-index:9998;
  bottom: 30px; /* تثبيت من الأسفل */
  top: auto;
  height: auto; /* ارتفاع تلقائي */
  max-height: 85vh; /* حد أقصى */
}

#wikiAssistantPanel.active {
  opacity:1;
  visibility:visible;
  transform: translateY(0) scale(1);
}

/* ارتفاع مختلف حسب التبويب */
#wikiAssistantPanel:has(#panel-search-articles.active) {
  height: 70vh;
  max-height: 620px;
}

/* إلغاء تغيير حجم النافذة عند الانتقال إلى تبويب البحث عن المراجع */
/* #wikiAssistantPanel:has(#panel-search-references.active) {
  height: auto; 
  max-height: 85vh;
} */

#wikiAssistantPanel {
  height: 75vh;
  max-height: 650px;
}
/* تم نقل هذا القسم للأعلى ودمجه مع التعريف الرئيسي */
.wiki-assistant-header{
  padding:8px 12px;background:var(--wiki-primary);color:#fff;border-radius:14px 14px 0 0;display:flex;align-items:center;justify-content:space-between;
}
.wiki-assistant-header h3{margin:0;font-size:1.1rem;display:flex;gap:6px;align-items:center}
.wiki-assistant-header h3.wiki-title-de{font-size:0.7rem!important}
.ref-features-section[lang="de"], .ref-be-first-section[lang="de"] {margin-top: 2px !important;}
html[lang="de"] .ref-features-section, html[lang="de"] .ref-be-first-section {margin-top: 2px !important;}
html[lang="de"] .ref-features-section h5, html[lang="de"] .ref-be-first-section h4 {transform: translateY(-3px);}
.wiki-close-btn{background:none;border:0;color:#fff;font-size:1rem;cursor:pointer;opacity:.9}
.wiki-assistant-controls{display:flex;align-items:center;gap:6px;padding:8px;border-bottom:1px solid #eef2f6;background:#fff}
.wiki-assistant-controls select, .wiki-assistant-controls button{
  padding:6px 8px;border-radius:6px;border:1px solid #ddd;background:#fff;font-size:0.8rem;cursor:pointer;transition: border-color 0.2s;
}
.wiki-assistant-controls select:hover, .wiki-assistant-controls button:hover {
  border-color: var(--wiki-secondary);
}
.wiki-assistant-controls select {
  min-width: 110px;
}
.wiki-search-form {
  flex: 1;
}
.wiki-display-modes {
  display: flex;
  padding: 0 8px 8px;
  background: #fff;
  border-bottom: 1px solid #eef2f6;
  gap: 6px;
}

.wiki-mode-btn {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ddd;
  background: #f9f9f9;
  color: #555;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}
.wiki-mode-btn.active {
  background-color: var(--wiki-secondary);
  color: #fff;
  border-color: var(--wiki-secondary);
  box-shadow: 0 2px 5px rgba(74, 137, 220, 0.2);
}
.wiki-assistant-body{padding:10px;overflow:auto;flex:1;background:var(--wiki-bg)}
.wiki-panel-footer-text {
  font-size: 0.7rem; /* حجم الخط مناسب */
  color: #555;
  padding: 6px 10px; /* تقليل الـ padding */
  border-top: 1px solid #eef2f6;
  text-align: center;
  background: #f9f9f9;
  margin: 0;
  display: block;
  margin-top: auto;
  border-radius: 0 0 14px 14px;
  line-height: 1.4; /* تحسين تباعد الأسطر */
}
/* Search */
#wikiSearchInput{
  width: 100%;padding:10px 14px;border-radius:999px;border:1px solid #e2e8f0;font-size:0.95rem;transition: all 0.2s;
  outline:none;box-shadow:none;
}
#wikiSearchInput:focus{box-shadow:0 0 0 3px rgba(74, 137, 220, 0.3);border-color:var(--wiki-secondary)}
.wiki-btn-search{background-color:var(--wiki-secondary) !important;color:#fff !important;border-radius:8px;padding:8px 12px;border:0;cursor:pointer;flex-shrink:0;transition: background-color 0.2s;}
.wiki-btn-search:hover { background-color: var(--wiki-primary); }
/* Loader & messages */
.wiki-loader{width:40px;height:40px;border-radius:50%;border:4px solid #e0e0e0;border-top-color:var(--wiki-secondary);animation:spin 1s linear infinite;margin:18px auto}
@keyframes spin{100%{transform:rotate(360deg)}}
.wiki-msg{padding:20px;text-align:center;color:var(--text-light);font-size:1rem;font-weight:500;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:150px}
.wiki-error{color:#b91c1c;font-weight:600}
/* Results grid */
.wiki-results-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px}
.wiki-card{background:var(--wiki-card-bg);border-radius:10px;padding:12px;border:1px solid #eef2f6;box-shadow:0 4px 12px rgba(0,0,0,0.05);transition:transform .2s, box-shadow .2s;}
.wiki-card:hover{transform:translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.08);}
.wiki-result-title{font-size:1rem;color:var(--wiki-primary);margin:0 0 8px 0}
.wiki-result-snippet{font-size:0.9rem;color:var(--text-light);line-height:1.45;margin:0}
.wiki-readmore{display:inline-block;margin-top:10px;color:var(--wiki-secondary);font-size:0.85rem;text-decoration:none;font-weight:bold;}
.wiki-readmore:hover { text-decoration: underline; }
/* Full article */
.wiki-full-article{padding:6px 2px}
.wiki-full-article-title{font-size:1.15rem;color:var(--primary);margin:0 0 6px 0}
.wiki-original-link{font-size:0.9rem;color:var(--secondary);text-decoration:none}
.wiki-article-content{font-size:0.98rem;line-height:1.7;color:var(--text);margin-top:10px}
.wiki-article-content p{margin:0 0 10px}
/* hide some clutter from Wikipedia HTML */
.wiki-article-content .infobox, .wiki-article-content .thumb, .wiki-article-content .mw-editsection{display:none !important}
.wiki-article-content img{max-width:100%;height:auto;display:block;margin:8px 0}
/* responsive */
@media(max-width:640px){
  #wikiAssistantPanel{left:10px;right:10px;width:auto;bottom:20px;height:auto;max-height:80vh;transform:translateY(0) !important;}
  .wiki-results-grid{grid-template-columns:1fr}
}

/* New styles for Wiki Tabs */
.wiki-tabs {
  display: flex;
  flex-direction: column;
  height: 100%; /* Ensure tabs take full height of panel */
}

.wiki-tab-list {
  display: flex;
  border-bottom: 1px solid #eef2f6;
  background: #fff;
  padding: 0 12px;
  flex-shrink: 0; /* Prevent shrinking */
}

.wiki-tab {
  padding: 10px 15px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
  flex-grow: 1; /* Allow tabs to grow and fill space */
  text-align: center;
}

.wiki-tab:hover {
  color: var(--wiki-primary);
}

.wiki-tab.active {
  color: var(--wiki-primary);
}

.wiki-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; /* Overlap with border-bottom of tab-list */
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--wiki-primary);
}

.wiki-tab-panel {
  display: none;
  flex-grow: 1; /* Allow panel to grow and fill remaining space */
  overflow: hidden; /* Hide overflow for content inside */
  padding: 0; /* Remove default padding as content will have its own */
}

.wiki-tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* Adjustments for controls and body within tab panel */
.wiki-tab-panel .wiki-assistant-controls,
.wiki-tab-panel .wiki-display-modes {
  border-bottom: none; /* Remove redundant border */
}

.wiki-tab-panel .wiki-assistant-body {
  flex: 1; /* Allow body to take remaining space */
  overflow-y: auto; /* Enable scrolling for results */
  padding: 16px;
  max-height: calc(70vh - 200px); /* Ensure scrolling works */
}

/* Specific scrolling for references results */
#refResultsContainer {
  overflow-y: auto;
  max-height: calc(70vh - 250px);
}

/* Ensure the wiki-assistant-controls and wiki-display-modes are visible within the active tab panel */
.wiki-tab-panel.active .wiki-assistant-controls,
.wiki-tab-panel.active .wiki-display-modes {
  display: flex; /* Or block, depending on original layout */
}

/* RTL adjustments for tabs */
html[dir="rtl"] .wiki-tab.active::after {
  left: 0;
  right: auto;
}

html[dir="ltr"] .wiki-tab.active::after {
  left: 0;
  right: auto;
}

.wiki-result-readmore {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--secondary);
  display: inline-block;
}

/* RTL adjustments for Wikipedia elements */
html[dir="rtl"] .wiki-assistant-trigger {
  right: 30px;
  left: auto;
}

html[dir="rtl"] #wikiAssistantPanel {
  right: 100px !important;
  left: auto;
  transform-origin: bottom right;
}

html[dir="ltr"] .wiki-assistant-trigger {
  right: auto;
  left: 30px;
}

html[dir="ltr"] #wikiAssistantPanel {
  transform-origin: bottom left;
  left: 100px !important;
  right: auto;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  /* إخفاء الأيقونة العائمة والنافذة على الشاشات الصغيرة (الهواتف) */
  .wiki-assistant-trigger {
    display: none !important;
  }

  #wikiAssistantPanel {
    display: none !important;
  }
}

/* إظهار الأيقونة والنافذة على التابلت والشاشات الأكبر */
@media (min-width: 769px) {
  .wiki-assistant-trigger {
    display: flex;
  }

  #wikiAssistantPanel {
    display: flex;
  }
}

/* Styles for Wikipedia Assistant Copy Button */
.wiki-full-article {
  position: relative;
}

.wiki-copy-article-btn {
  position: sticky;
  top: 10px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-color: var(--wiki-secondary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10;
  transition: all 0.3s ease;
  float: left;
  margin: 0 15px 15px 0;
}

html[dir="ltr"] .wiki-copy-article-btn {
  float: right;
  margin: 0 0 15px 15px;
}

.wiki-copy-article-btn:hover {
  transform: scale(1.1) translateY(-2px);
  background-color: var(--wiki-primary);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.wiki-copy-article-btn:active {
  transform: scale(0.95);
}

/* References Tab Styles */
.references-search-controls {
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid #eef2f6;
}

.ref-form-group {
  margin-bottom: 10px;
}

.ref-form-group input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.95rem;
  transition: all 0.2s;
  outline: none;
  font-family: 'Cairo', sans-serif;
  cursor: text;
}

/* تعديل شكل المؤشر فقط في خانات الإدخال */
input[type="text"]:hover, 
input[type="email"]:hover, 
input[type="number"]:hover, 
input[type="password"]:hover, 
input[type="search"]:hover, 
input[type="tel"]:hover, 
input[type="url"]:hover,
textarea:hover {
  cursor: text;
}

.ref-form-group input:focus {
  box-shadow: 0 0 0 3px rgba(74, 137, 220, 0.3);
  border-color: var(--wiki-secondary);
}

.ref-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.ref-form-row select,
.ref-form-row input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s;
  font-family: 'Cairo', sans-serif;
}

.ref-form-row select:hover,
.ref-form-row input:hover {
  border-color: var(--wiki-secondary);
}

.ref-form-row select:focus,
.ref-form-row input:focus {
  outline: none;
  border-color: var(--wiki-secondary);
  box-shadow: 0 0 0 3px rgba(74, 137, 220, 0.2);
}

/* Fix number input direction for non-Arabic languages */
html[dir="ltr"] .ref-form-row input[type="number"],
html[dir="ltr"] #refCount,
html[dir="ltr"] #refFromYear {
  direction: ltr;
  text-align: left;
}

html[dir="rtl"] .ref-form-row input[type="number"],
html[dir="rtl"] #refCount,
html[dir="rtl"] #refFromYear {
  direction: ltr; /* Keep numbers LTR even in RTL */
  text-align: left;
}

.ref-empty-state {
  text-align: center;
  padding: 50px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.ref-empty-state p {
  margin: 0;
  color: var(--text-light);
  font-size: 1rem;
  font-weight: 500;
}

.ref-empty-state i {
  font-size: 3rem;
  color: var(--gray);
  margin-bottom: 15px;
  opacity: 0.5;
}

.ref-results-list {
  list-style: none;
  counter-reset: ref-counter;
  padding: 0;
  margin: 0;
}

.ref-results-list li {
  counter-increment: ref-counter;
  padding: 12px 12px 12px 20px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  border-right: 3px solid var(--wiki-secondary);
  position: relative;
  font-size: 0.85rem;
  line-height: 1.6;
  transition: all 0.2s ease;
}

.ref-results-list li:hover {
  background: #e9ecef;
  transform: translateX(-3px);
}

.ref-results-list li::before {
  content: counter(ref-counter);
  background: var(--wiki-secondary);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: bold;
  font-size: 0.75rem;
}

.ref-content {
  font-family: 'Times New Roman', serif;
  color: var(--text);
}

.ref-link {
  color: var(--secondary); /* Same color as the window buttons */
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  margin-top: 5px;
  font-size: 0.8rem;
  word-break: break-all;
  transition: color 0.1s ease-in-out;
}

.ref-link:visited {
    color: var(--secondary); /* Keep the same color after visiting */
}

.ref-link:hover {
  color: var(--secondary); /* Keep the same color on hover */
  text-decoration: none;
}

.ref-link:active {
  color: var(--accent) !important; /* Red color on click */
}

.ref-actions {
  padding: 12px;
  background: #fff;
  border-top: 1px solid #eef2f6;
  display: none; /* مخفي افتراضياً */
  gap: 8px;
  flex-shrink: 0; /* منع الانكماش */
}

.ref-actions.show {
  display: flex !important;
}

.ref-action-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: var(--wiki-secondary);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: 'Cairo', sans-serif;
}

.ref-action-btn:hover {
  background: var(--wiki-primary);
  transform: translateY(-2px);
}

.ref-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ref-note {
  padding: 10px 15px;
  border-radius: 8px;
  margin: 15px 12px;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 600;
  display: block;
  transition: all 0.3s ease;
}

.ref-note.success {
  background: #d4edda;
  color: #155724;
  border: 2px solid #28a745;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.ref-note.error {
  background: #f8d7da;
  color: #721c24;
  border: 2px solid #dc3545;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.ref-note.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.ref-loading {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.ref-loading p {
  margin: 0;
  color: var(--wiki-secondary);
  font-weight: 600;
  font-size: 0.95rem;
}

.ref-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(74, 137, 220, 0.2);
  border-radius: 50%;
  border-top-color: var(--wiki-secondary);
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.ref-access-form {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 10px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.ref-access-content {
  text-align: center;
  max-width: 350px;
  width: 100%;
  background: white;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.ref-access-content .ref-form-group input {
  font-weight: 600;
  letter-spacing: 2px;
}

.ref-access-content a {
  transition: all 0.2s ease;
}

.ref-access-content a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .ref-form-row {
    grid-template-columns: 1fr;
  }
  
  .ref-actions {
    flex-direction: column;
  }
  
  .ref-access-form {
    min-height: 350px;
    padding: 15px;
  }
}

/* تصغير حجم الخط للغة الألمانية */
html[lang="de"] .ref-title {
  font-size: 0.8rem !important;
}

html[lang="de"] .ref-desc {
  font-size: 0.8rem !important;
}
