/* ============================================
   إصلاحات شاملة للأيقونات والتنسيق
   ============================================ */

/* إصلاح أيقونات Font Awesome في الهيدر */
.header-icons button {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icons button i {
  font-size: 20px !important;
  line-height: 1 !important;
  display: inline-block !important;
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
  font-style: normal !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* تأكيد عرض الأيقونات */
.fa-bars::before,
.fa-search::before {
  display: inline-block !important;
}

/* إصلاح شريط الأخبار العاجلة */
.breaking-content {
  display: flex !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  animation: scrollNews 40s linear infinite !important;
  will-change: transform;
}

.breaking-item {
  display: flex !important;
  flex: 0 0 auto !important;
  min-width: max-content !important;
  white-space: nowrap !important;
  align-items: center !important;
}

@keyframes scrollNews {
  0% {
    transform: translateX(100vw);
  }
  100% {
    transform: translateX(-100%);
  }
}

.breaking-content:hover {
  animation-play-state: paused !important;
}

/* تحسين المساحات الإعلانية */
.ad-banner {
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 30px 0;
  border-radius: 12px;
  color: var(--text-light);
  font-size: 16px;
  border: 2px dashed var(--border-color);
  position: relative;
  overflow: hidden;
}

.ad-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0, 0, 0, 0.02) 10px,
    rgba(0, 0, 0, 0.02) 20px
  );
}

.ad-banner i {
  margin-left: 10px;
  color: var(--accent-gold);
  font-size: 24px;
}

/* ============================================
   تصميم احترافي لأزرار الهيدر - Google Material Icons
   ============================================ */

.search-icon,
.menu-icon {
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  color: var(--primary-color) !important;
  transition: all 0.3s ease;
  padding: 8px;
  border-radius: 8px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  position: relative;
  overflow: visible;
  box-shadow: none;
}

/* تأثير الضوء المتحرك */
.search-icon::after,
.menu-icon::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.8) 50%,
    transparent 70%
  );
  transform: rotate(45deg);
  transition: all 0.6s ease;
  opacity: 0;
}

.search-icon:hover::after,
.menu-icon:hover::after {
  opacity: 1;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

/* تأثير الخلفية عند المرور */
.search-icon::before,
.menu-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(43, 64, 73, 0.08) 0%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  transition:
    width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-icon:hover::before,
.menu-icon:hover::before {
  width: 120%;
  height: 120%;
}

/* حالة المرور */
.search-icon:hover,
.menu-icon:hover {
  border-color: var(--primary-color) !important;
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 8px 20px rgba(43, 64, 73, 0.12),
    0 4px 8px rgba(43, 64, 73, 0.08),
    0 0 0 4px rgba(43, 64, 73, 0.04);
  background: linear-gradient(135deg, #ffffff 0%, #fff5f7 100%) !important;
}

/* حالة الضغط */
.search-icon:active,
.menu-icon:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow:
    0 4px 12px rgba(43, 64, 73, 0.1),
    0 2px 4px rgba(43, 64, 73, 0.06);
  transition: all 0.1s ease;
}

/* تنسيق أيقونات Material Icons */
.search-icon .material-icons,
.menu-icon .material-icons {
  font-size: 24px !important;
  color: #1f2937 !important;
  display: block !important;
  line-height: 1 !important;
  position: relative;
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  font-weight: 400;
  user-select: none;
}

/* تأثير الأيقونة عند المرور */
.search-icon:hover .material-icons,
.menu-icon:hover .material-icons {
  color: var(--primary-color) !important;
  transform: scale(1.15) rotate(5deg);
  filter: drop-shadow(0 2px 4px rgba(43, 64, 73, 0.2));
}

.search-icon:active .material-icons,
.menu-icon:active .material-icons {
  transform: scale(1.05) rotate(0deg);
}

/* تأثير Focus للوصولية */
.search-icon:focus,
.menu-icon:focus {
  outline: none;
  border-color: var(--primary-color) !important;
  box-shadow:
    0 0 0 4px rgba(43, 64, 73, 0.1),
    0 4px 12px rgba(43, 64, 73, 0.15);
}

/* تحسين للشاشات الصغيرة */
@media (max-width: 768px) {
  .search-icon,
  .menu-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .search-icon .material-icons,
  .menu-icon .material-icons {
    font-size: 22px !important;
  }
}

/* تحسين زر العودة للأعلى */
.back-to-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 15px rgba(43, 64, 73, 0.3);
  transition: all 0.3s ease;
  z-index: 999;
}

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 8px 25px rgba(43, 64, 73, 0.4);
  background: linear-gradient(
    135deg,
    var(--accent-gold),
    var(--accent-gold-dark)
  );
}

.back-to-top.show {
  display: flex;
}

/* تحسين close-menu button */
.close-menu {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-menu:hover {
  color: var(--primary-color);
  background: var(--background-light);
  transform: rotate(90deg);
}

/* تأكد من تحميل الأيقونات */
i.fas,
i.far,
i.fab {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .header-icons {
    gap: 15px;
  }

  .search-icon,
  .menu-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .back-to-top {
    bottom: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
  }
}

/* ============================================
   إصلاح مشكلة الـ Scroll الأفقي على الجوال
   ============================================ */
@media (max-width: 768px) {
  .container,
  .header-container,
  .hero-slider,
  .slider-container,
  .news-grid,
  .category-section,
  .footer-grid,
  section,
  header,
  footer,
  main,
  aside {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* إصلاح شريط الأخبار العاجلة - تم إزالة القيود الصارمة للسماح بالحركة الكاملة للأخبار المتبقية */
  .breaking-news-wrapper,
  .breaking-ticker {
    overflow: hidden !important;
  }

  /* لمنع أي padding يتسبب في overflow */
  .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* إيقاف أنيميشن السلايدر على الجوال لتجنب مشاكل اختفاء الصور في متصفحات مثل Safari */
  .hero-slider,
  .slide.active img,
  .slide.active .slide-content,
  .slide-title,
  .slide-category,
  .slide-date {
    animation: none !important;
  }

  .slide {
    will-change: auto !important;
  }
}
