/* =====================================
   تحسينات قسم المجلات المقترحة
   Related & Suggested Posts
   ===================================== */

/* تحسين عنوان القسم */
.related-title, .selected-items > .content > h2 {
  font-size: 28px;
  font-weight: 700;
  color: #222;
  margin-bottom: 30px;
  position: relative;
  padding-bottom: 15px;
}

.related-title::after, .selected-items > .content > h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #007bff, #0056b3);
  border-radius: 3px;
}

/* Container المحتوى */
.selected-items-slider, .related-posts {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* البطاقات المقترحة */
.swiper-slide {
  display: flex !important;
  height: auto;
  padding: 10px;
}

.vertical-card {
  width: 100%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #f0f0f0;
}

.vertical-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border-color: #007bff;
}

/* صورة البطاقة */
.vertical-card .img {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f0f0f0;
}

.vertical-card .img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.vertical-card:hover .img img {
  transform: scale(1.05);
}

/* زر الهوفر */
.vertical-card .hover-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 123, 255, 0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.vertical-card:hover .hover-btn {
  opacity: 1;
}

.vertical-card .hover-btn p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.vertical-card .hover-btn img {
  width: 16px;
  height: 16px;
}

/* عنوان البطاقة */
.vertical-card h4 {
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  line-height: 1.4;
  margin: 0;
  min-height: 45px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vertical-card:hover h4 {
  color: #007bff;
}

/* تحسين Swiper Navigation */
.swiper-button-next, .swiper-button-prev {
  width: 40px;
  height: 40px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #007bff;
}

.swiper-button-next:hover, .swiper-button-prev:hover {
  background: #007bff;
  border-color: #007bff;
  color: white;
  transform: scale(1.1);
}

.swiper-button-next img, .swiper-button-prev img {
  width: 20px;
  height: 20px;
}

/* لا توجد نتائج */
.related-posts:empty::after {
  content: 'لا توجد مجلات مقترحة أخرى';
  display: block;
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

/* بطاقات المقالات المقترحة */
.related-card {
  width: 220px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.related-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border-color: #007bff;
}

.related-card a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.related-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.related-card:hover img {
  transform: scale(1.05);
}

.related-card h4 {
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: #333;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-card:hover h4 {
  color: #007bff;
}

/* Container التصفيف */
.selected-items {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
}

.selected-items .content {
  flex: 1;
}

/* Swiper Container */
.swiper {
  overflow: visible;
}

.swiper-wrapper {
  display: flex;
  align-items: stretch;
}

.swiper-slide {
  height: auto;
}

/* التوافقية مع الأجهزة المختلفة */
@media (max-width: 1024px) {
  .swiper-slide {
    width: 220px !important;
  }
  
  .related-card {
    width: 180px;
  }
  
  .related-title, .selected-items > .content > h2 {
    font-size: 24px;
  }
}

@media (max-width: 768px) {
  .selected-items {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .swiper-slide {
    width: 180px !important;
  }
  
  .related-card {
    width: 150px;
  }
  
  .related-card img {
    height: 120px;
  }
  
  .vertical-card .img {
    aspect-ratio: auto;
    height: 150px;
  }
  
  .related-title, .selected-items > .content > h2 {
    font-size: 20px;
    margin-bottom: 20px;
  }
  
  .related-posts {
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .swiper-slide {
    width: 140px !important;
  }
  
  .related-card {
    width: 100%;
  }
  
  .related-posts {
    flex-direction: column;
  }
  
  .vertical-card h4 {
    font-size: 12px;
    padding: 8px;
  }
  
  .swiper-button-next, .swiper-button-prev {
    width: 36px;
    height: 36px;
  }
  
  .related-title, .selected-items > .content > h2 {
    font-size: 18px;
  }
}

/* دعم الوضع الليلي */
@media (prefers-color-scheme: dark) {
  .vertical-card, .related-card, .selected-items-slider, .related-posts {
    background: #1a1a1a;
    border-color: #333;
  }
  
  .vertical-card h4, .related-card h4 {
    color: #e0e0e0;
  }
  
  .vertical-card:hover h4, .related-card:hover h4 {
    color: #66b3ff;
  }
  
  .related-title, .selected-items > .content > h2 {
    color: #e0e0e0;
  }
  
  .swiper-button-next, .swiper-button-prev {
    background: #2a2a2a;
    border-color: #444;
    color: #66b3ff;
  }
  
  .swiper-button-next:hover, .swiper-button-prev:hover {
    background: #007bff;
    border-color: #007bff;
    color: white;
  }
}

/* دعم RTL (العربية) */
[dir="rtl"] .selected-items {
  flex-direction: row-reverse;
}

[dir="rtl"] .related-title::after, 
[dir="rtl"] .selected-items > .content > h2::after {
  right: auto;
  left: 0;
}

[dir="rtl"] .swiper-slide {
  margin-right: 0;
  margin-left: 20px;
}

/* تحسين الأداء */
.vertical-card, .related-card {
  contain: layout style paint;
  will-change: transform;
}

/* تحسينات الرسوم المتحركة */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.vertical-card, .related-card {
  animation: slideIn 0.5s ease-out;
}

/* تأثيرات تفاعلية إضافية */
.vertical-card {
  position: relative;
}

.vertical-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.vertical-card:hover::before {
  opacity: 1;
}

/* استجابة اللمس */
@media (hover: none) and (pointer: coarse) {
  .vertical-card, .related-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  
  .vertical-card:active, .related-card:active {
    transform: translateY(-4px);
  }
}
