/* ========================================
   CSS محسّن ومتجاوب لجميع الأجهزة والشاشات
   ======================================== */

/* === Article Header Container === */
.article-header {
  text-align: center;
  margin-bottom: 50px;
  padding: 20px;
  animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Article Meta (تاريخ النشر ووقت القراءة) === */
.article-meta {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 500;
  flex-wrap: wrap;
}

body.dark .article-meta { 
  color: #94a3b8; 
}

/* أيقونة صغيرة قبل التاريخ */
.article-meta::before {
  content: "📅";
  font-size: 1.1rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* تحسين عنصر time */
.article-meta time {
  font-weight: 600;
  color: var(--primary);
  padding: 4px 10px;
  background: rgba(255, 111, 97, 0.1);
  border-radius: 6px;
  transition: all 0.3s ease;
}

body.dark .article-meta time {
  background: rgba(255, 111, 97, 0.15);
}

.article-meta time:hover {
  background: rgba(255, 111, 97, 0.2);
  transform: scale(1.05);
}

/* === Article Title (العنوان الرئيسي) === */
.article-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.3;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(255, 111, 97, 0.1);
  animation: slideInLeft 0.8s ease-out 0.2s both;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

body.dark .article-title { 
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* تأثير hover للعنوان */
.article-title:hover {
  letter-spacing: 0px;
  transition: letter-spacing 0.5s ease;
}

/* === Article Description (الوصف) === */
.article-description {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-secondary);
  margin-bottom: 35px;
  line-height: 1.7;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
  padding: 0 20px;
  animation: slideInRight 0.8s ease-out 0.4s both;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

body.dark .article-description { 
  color: #cbd5e1; 
}

/* === Article Thumbnail (الصورة الرئيسية) === */
.article-thumbnail {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: center;
  border-radius: 20px;
  margin-top: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 2px solid var(--border-light);
  animation: zoomIn 0.8s ease-out 0.6s both;
  position: relative;
  display: block;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

body.dark .article-thumbnail {
  border-color: var(--border-dark);
}

/* تأثير hover للصورة */
.article-thumbnail:hover {
  transform: scale(1.03) translateY(-10px);
  box-shadow: 0 30px 80px rgba(255, 111, 97, 0.3);
  border-color: var(--primary);
}

/* overlay gradient على الصورة عند hover */
.article-thumbnail::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.1), rgba(232, 92, 80, 0.1));
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 20px;
  pointer-events: none;
}

.article-thumbnail:hover::after {
  opacity: 1;
}

/* === خط فاصل زخرفي بعد الوصف === */
.article-description::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  margin: 25px auto 0;
  border-radius: 2px;
  animation: expandWidth 0.8s ease-out 0.8s both;
}

@keyframes expandWidth {
  from {
    width: 0;
  }
  to {
    width: 80px;
  }
}

/* === تحسين Typography والنصوص === */
body {
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.8;
  letter-spacing: 0.3px;
}

.article-content {
  font-size: clamp(1rem, 2vw, 1.08rem);
}

.article-content p {
  margin-bottom: 1.8rem;
  text-align: justify;
  hyphens: auto;
  color: var(--text-secondary);
  line-height: 1.85;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content p {
  color: var(--dark-secondary);
}

/* عناوين H2 مع خط سفلي متدرج */
.article-content h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin: 3rem 0 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 3px solid transparent;
  background: linear-gradient(90deg, var(--primary) 0%, transparent 60%);
  background-position: 0 100%;
  background-size: 100% 3px;
  background-repeat: no-repeat;
  color: var(--text-light);
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content h2 {
  color: var(--dark-text);
}

/* عناوين H3 بلون Primary */
.article-content h3 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 600;
  margin: 2.5rem 0 1.2rem;
  color: var(--primary);
  position: relative;
  padding-left: 20px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.article-content h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 70%;
  background: linear-gradient(180deg, var(--primary), var(--primary-light));
  border-radius: 3px;
}

/* عناوين H4 */
.article-content h4 {
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: var(--text-light);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content h4 {
  color: var(--dark-text);
}

/* === تحسين القوائم النقطية والمرقمة === */

/* قوائم نقطية بعلامات تأشير جذابة */
.article-content ul {
  list-style: none;
  padding-left: 0;
  margin: 1.8rem 0;
}

.article-content ul li {
  position: relative;
  padding-left: 35px;
  margin-bottom: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content ul li {
  color: var(--dark-secondary);
}

.article-content ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 2px;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 111, 97, 0.25);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.article-content ul li:hover::before {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(255, 111, 97, 0.4);
}

/* قوائم مرقمة بأرقام دائرية ملونة */
.article-content ol {
  counter-reset: item;
  list-style: none;
  padding-left: 0;
  margin: 1.8rem 0;
}

.article-content ol li {
  counter-increment: item;
  position: relative;
  padding-left: 50px;
  margin-bottom: 1.3rem;
  line-height: 1.8;
  color: var(--text-secondary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content ol li {
  color: var(--dark-secondary);
}

.article-content ol li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.95rem;
  box-shadow: 0 3px 10px rgba(255, 111, 97, 0.3);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.article-content ol li:hover::before {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 5px 15px rgba(255, 111, 97, 0.45);
}

/* === تحسين الصور === */

/* صور داخل المحتوى */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  margin: 2.5rem auto;
  display: block;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
  transition: all 0.35s ease;
  border: 1px solid var(--border-light);
}

body.dark .article-content img {
  border-color: var(--border-dark);
}

.article-content img:hover {
  transform: scale(1.03) translateY(-5px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  border-color: var(--primary);
}

/* === Blockquotes أنيقة === */
.article-content blockquote {
  position: relative;
  margin: 2.5rem 0;
  padding: 1.8rem 1.8rem 1.8rem 3.5rem;
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.06), rgba(255, 138, 122, 0.04));
  border-left: 5px solid var(--primary);
  border-radius: 12px;
  font-style: italic;
  color: var(--text-secondary);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content blockquote {
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.12), rgba(255, 138, 122, 0.08));
  color: var(--dark-secondary);
}

.article-content blockquote:hover {
  transform: translateX(5px);
  box-shadow: 0 8px 25px rgba(255, 111, 97, 0.15);
}

.article-content blockquote::before {
  content: """;
  position: absolute;
  left: 18px;
  top: 15px;
  font-size: 3.5rem;
  color: var(--primary);
  opacity: 0.25;
  line-height: 1;
  font-family: Georgia, serif;
}

.article-content blockquote p {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.12rem);
  line-height: 1.75;
}

/* === تحسين الجداول === */
.article-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2.5rem 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-light);
  overflow-x: auto;
  display: block;
}

body.dark .article-content table {
  border-color: var(--border-dark);
}

.article-content th {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 1.1rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: clamp(0.9rem, 2vw, 1.02rem);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.article-content td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--card-light);
  color: var(--text-secondary);
  transition: all 0.25s ease;
  font-size: clamp(0.85rem, 1.8vw, 1rem);
}

body.dark .article-content td {
  border-bottom-color: var(--border-dark);
  background: var(--dark-card);
  color: var(--dark-secondary);
}

.article-content tr:last-child td {
  border-bottom: none;
}

.article-content tr:hover td {
  background: rgba(255, 111, 97, 0.08);
  color: var(--text-light);
}

body.dark .article-content tr:hover td {
  color: var(--dark-text);
}

/* === تحسين أكواد البرمجة === */

/* Inline code */
.article-content code {
  background: rgba(255, 111, 97, 0.1);
  color: var(--primary);
  padding: 4px 9px;
  border-radius: 6px;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: clamp(0.85em, 1.5vw, 0.92em);
  font-weight: 500;
  border: 1px solid rgba(255, 111, 97, 0.2);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content code {
  background: rgba(255, 111, 97, 0.15);
  border-color: rgba(255, 111, 97, 0.25);
}

/* Code blocks */
.article-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.8rem;
  border-radius: 14px;
  overflow-x: auto;
  margin: 2rem 0;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
  border: 1px solid #334155;
  position: relative;
  padding-top: 2.8rem;
}

/* نقاط ملونة كـ VS Code */
.article-content pre::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 16px;
  width: 13px;
  height: 13px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 22px 0 0 #fbbf24, 44px 0 0 #10b981;
}

.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: clamp(0.85rem, 1.8vw, 0.96rem);
  line-height: 1.7;
  border: none;
}

/* === تحسين تجربة القراءة === */

/* تمرير سلس */
html {
  scroll-behavior: smooth;
}

/* شريط تمرير مخصص */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

body.dark ::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border-radius: 6px;
  border: 2px solid var(--bg-light);
}

body.dark ::-webkit-scrollbar-thumb {
  border-color: var(--dark-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-dark), var(--primary));
}

/* === تحسين الروابط === */
.article-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.article-content a:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

/* === علامات Strong === */
.article-content strong {
  color: var(--primary);
  font-weight: 600;
}

body.dark .article-content strong {
  color: var(--primary-light);
}

/* === صندوق معلومات مميز === */
.article-content .info-box,
.article-content .note-box {
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.06), rgba(255, 138, 122, 0.04));
  border-left: 5px solid var(--primary);
  border-radius: 12px;
  padding: 1.5rem 1.5rem 1.5rem 3rem;
  margin: 2rem 0;
  position: relative;
  box-shadow: 0 4px 15px rgba(255, 111, 97, 0.1);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.dark .article-content .info-box,
body.dark .article-content .note-box {
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.12), rgba(255, 138, 122, 0.08));
}

.article-content .info-box::before,
.article-content .note-box::before {
  content: "💡";
  position: absolute;
  left: 15px;
  top: 18px;
  font-size: 1.5rem;
}

.article-content .info-box p:last-child,
.article-content .note-box p:last-child {
  margin-bottom: 0;
}

/* === تحسين قسم المشاركة === */
.share-section {
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.05), rgba(255, 138, 122, 0.03));
  padding: 25px;
  border-radius: 18px;
  margin-bottom: 40px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 111, 97, 0.15);
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
}

body.dark .share-section {
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.1), rgba(255, 138, 122, 0.06));
  border-color: rgba(255, 111, 97, 0.2);
}

.share-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  color: var(--primary);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  flex-shrink: 0;
}

body.dark .share-btn {
  background: var(--dark-bg);
}

.share-btn:hover {
  transform: scale(1.2) rotate(5deg);
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(255, 111, 97, 0.4);
}

/* === تحسين البطاقات المرتبطة === */
.related-card {
  background: var(--card-light);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-light);
}

body.dark .related-card {
  background: var(--dark-card);
  border-color: var(--border-dark);
}

.related-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(255, 111, 97, 0.2);
  border-color: var(--primary);
}

.related-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.related-card:hover img {
  transform: scale(1.08);
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  color: var(--primary);
  font-weight: 600;
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
  transition: all 0.3s ease;
}

.read-more::after {
  content: "→";
  transition: transform 0.3s ease;
}

.related-card:hover .read-more {
  color: var(--primary-dark);
}

.related-card:hover .read-more::after {
  transform: translateX(5px);
}

/* === تحسين Feedback Widget === */
.feedback-widget {
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.05), rgba(255, 138, 122, 0.03));
  border: 2px solid rgba(255, 111, 97, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

body.dark .feedback-widget {
  background: linear-gradient(135deg, rgba(255, 111, 97, 0.1), rgba(255, 138, 122, 0.06));
  border-color: rgba(255, 111, 97, 0.2);
}

.feedback-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* === Animation للعناصر === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-wrapper {
  animation: fadeInUp 0.6s ease-out;
}

/* === تحسين Selection (التحديد) === */
::selection {
  background: var(--primary);
  color: white;
}

::-moz-selection {
  background: var(--primary);
  color: white;
}

/* ========================================
   Media Queries - دعم جميع الأجهزة
   ======================================== */

/* === شاشات كبيرة جداً (Large Desktops) 1920px+ === */
@media (min-width: 1920px) {
  .article-container {
    max-width: 1100px;
  }
  
  .article-wrapper {
    padding: 60px;
  }
  
  .article-title {
    font-size: 3.2rem;
  }
  
  .article-description {
    font-size: 1.3rem;
  }
}

/* === شاشات كبيرة (Desktops) 1200px - 1919px === */
@media (min-width: 1200px) and (max-width: 1919px) {
  .article-container {
    max-width: 1000px;
  }
  
  .article-wrapper {
    padding: 50px;
  }
}

/* === شاشات متوسطة (Tablets Landscape) 992px - 1199px === */
@media (min-width: 992px) and (max-width: 1199px) {
  .article-container {
    max-width: 900px;
    padding: 40px 20px;
  }
  
  .article-wrapper {
    padding: 45px;
  }
  
  .article-title {
    font-size: 2.4rem;
  }
  
  .article-description {
    font-size: 1.15rem;
  }
  
  .article-content {
    font-size: 1.05rem;
  }
}

/* === شاشات متوسطة صغيرة (Tablets) 768px - 991px === */
@media (min-width: 768px) and (max-width: 991px) {
  .article-container {
    max-width: 750px;
    padding: 35px 20px;
  }
  
  .article-wrapper {
    padding: 40px 30px;
  }
  
  .article-header {
    padding: 15px;
    margin-bottom: 40px


}

