/* =============================================
   Arabic Blog - Global Styles
   Font: Tajawal | Direction: RTL
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary: #5c6ef8;
  --primary-light: #eef0ff;
  --accent: #ff6b6b;
  --accent2: #ffa94d;
  --text-dark: #1a1d3a;
  --text-mid: #4a4f6a;
  --text-light: #8890b5;
  --bg: #f7f8ff;
  --card-bg: #ffffff;
  --border: #e8eaf6;
  --shadow-sm: 0 2px 12px rgba(92, 110, 248, 0.08);
  --shadow-md: 0 8px 32px rgba(92, 110, 248, 0.14);
  --shadow-lg: 0 20px 60px rgba(92, 110, 248, 0.18);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text-dark);
  line-height: 1.7;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* =============================================
   HEADER / NAVBAR
   ============================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  height: 68px;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(92,110,248,0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.nav-links a {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-mid);
  transition: background var(--transition), color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-search {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 0.4rem 1rem;
  gap: 0.5rem;
  transition: border var(--transition), box-shadow var(--transition);
  max-width: 240px;
  flex: 1;
}

.nav-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(92,110,248,0.1);
}

.nav-search input {
  border: none;
  background: transparent;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.92rem;
  color: var(--text-dark);
  direction: rtl;
  width: 100%;
  outline: none;
}

.nav-search input::placeholder { color: var(--text-light); }

.nav-search svg { color: var(--text-light); flex-shrink: 0; }

/* =============================================
   HERO SECTION
   ============================================= */
.hero {
  max-width: 1200px;
  margin: 2.5rem auto 1rem;
  padding: 0 2rem;
}

.hero-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 480px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}

.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.hero-card:hover img { transform: scale(1.04); }

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,10,40,0.85) 0%, rgba(15,10,40,0.15) 60%, transparent 100%);
}

.hero-content {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  padding: 2.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.9rem;
  border-radius: 50px;
  margin-bottom: 1rem;
  letter-spacing: 0.3px;
}

.hero-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 1rem;
  max-width: 700px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.88rem;
}

.hero-read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  color: var(--primary);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.6rem 1.5rem;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  margin-top: 1.2rem;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.hero-read-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(92,110,248,0.4);
}

/* =============================================
   SECTION HEADER  
   ============================================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 1.5em;
  background: linear-gradient(to bottom, var(--primary), #8b5cf6);
  border-radius: 3px;
}

.see-all {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  transition: opacity var(--transition);
}
.see-all:hover { opacity: 0.75; }

/* =============================================
   ARTICLES GRID
   ============================================= */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.8rem;
}

/* ---- Article Card ---- */
.article-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

.card-img-wrap {
  position: relative;
  height: 210px;
  overflow: hidden;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.article-card:hover .card-img-wrap img { transform: scale(1.06); }

.card-category {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
}

.card-body {
  padding: 1.3rem 1.4rem 1.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.07rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.45;
  margin-bottom: 0.65rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-excerpt {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.card-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.author-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-mid);
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.card-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* =============================================
   CATEGORIES BAR
   ============================================= */
.categories-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.cat-btn {
  padding: 0.45rem 1.1rem;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-mid);
  cursor: pointer;
  transition: all var(--transition);
}

.cat-btn:hover,
.cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(92,110,248,0.3);
}

/* =============================================
   FEATURED SIDEBAR ROW (Top Articles)
   ============================================= */
.top-articles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.top-article-item {
  display: flex;
  gap: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 1rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  align-items: flex-start;
}

.top-article-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.top-article-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-light);
  line-height: 1;
  min-width: 2.5rem;
  text-align: center;
}

.top-article-info { flex: 1; }

.top-article-cat {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.top-article-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.top-article-date {
  font-size: 0.77rem;
  color: var(--text-light);
}

/* =============================================
   NEWSLETTER BANNER
   ============================================= */
.newsletter-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  text-align: center;
  margin: 2.5rem 0;
  position: relative;
  overflow: hidden;
}

.newsletter-banner::before {
  content: '';
  position: absolute;
  top: -40px;
  left: -40px;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}

.newsletter-banner::after {
  content: '';
  position: absolute;
  bottom: -60px;
  right: -30px;
  width: 250px;
  height: 250px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.newsletter-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.newsletter-desc {
  color: rgba(255,255,255,0.85);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.newsletter-form {
  display: flex;
  gap: 0.6rem;
  max-width: 460px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  flex-direction: row-reverse;
}

.newsletter-form input {
  flex: 1;
  padding: 0.75rem 1.2rem;
  border: none;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  direction: rtl;
  outline: none;
}

.newsletter-form button {
  padding: 0.75rem 1.8rem;
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition);
}

.newsletter-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
  background: var(--text-dark);
  color: rgba(255,255,255,0.75);
  padding: 3rem 2rem 1.5rem;
  margin-top: 3rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-brand .logo { color: #fff; margin-bottom: 0.8rem; }

.footer-desc {
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.55);
}

.footer-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
}

.footer-links li { margin-bottom: 0.55rem; }

.footer-links a {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.55);
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--primary); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.83rem;
  color: rgba(255,255,255,0.4);
}

/* =============================================
   ARTICLE PAGE
   ============================================= */
.article-page {
  max-width: 860px;
  margin: 2.5rem auto;
  padding: 0 2rem 4rem;
}

.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1.8rem;
}

.article-breadcrumb a { color: var(--primary); }
.article-breadcrumb a:hover { text-decoration: underline; }
.article-breadcrumb span { opacity: 0.5; }

.article-header { margin-bottom: 2rem; }

.article-category {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border-radius: 50px;
  margin-bottom: 1rem;
}

.article-main-title {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1.3;
  margin-bottom: 1.2rem;
}

.article-meta-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.8rem;
}

.article-meta-row span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.87rem;
  color: var(--text-light);
}

.article-meta-row .author-name { color: var(--text-mid); font-weight: 600; }

.article-cover {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.article-body {
  font-size: 1.05rem;
  color: var(--text-mid);
  line-height: 1.9;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 2rem 0 0.8rem;
  padding-right: 1rem;
  border-right: 4px solid var(--primary);
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 1.5rem 0 0.6rem;
}

.article-body p { margin-bottom: 1.2rem; }

.article-body ul, .article-body ol {
  padding-right: 1.8rem;
  margin-bottom: 1.2rem;
}

.article-body li { margin-bottom: 0.5rem; }

.article-body blockquote {
  background: var(--primary-light);
  border-right: 4px solid var(--primary);
  padding: 1.2rem 1.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--primary);
  font-size: 1.05rem;
}

.article-body strong { color: var(--text-dark); font-weight: 700; }

.article-tags {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.article-tags span { font-size: 0.88rem; color: var(--text-light); font-weight: 600; }

.tag {
  padding: 0.3rem 0.9rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.82rem;
  color: var(--text-mid);
  transition: all var(--transition);
}
.tag:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* Share Bar */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.share-bar span { font-size: 0.88rem; color: var(--text-light); font-weight: 600; }

.share-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.83rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
}
.share-btn:hover { transform: translateY(-2px); opacity: 0.9; }
.share-btn.twitter { background: #1da1f2; color: #fff; }
.share-btn.facebook { background: #1877f2; color: #fff; }
.share-btn.copy { background: var(--bg); border: 1.5px solid var(--border); color: var(--text-mid); }

/* Related Articles */
.related-section { margin-top: 3.5rem; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.4rem;
  margin-top: 1.5rem;
}

/* Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--border);
  z-index: 200;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(to left, var(--primary), #8b5cf6);
  width: 0%;
  transition: width 0.1s linear;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 46px;
  height: 46px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  font-size: 1.1rem;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-3px); }

/* =============================================
   LOADING SPINNER
   ============================================= */
.spinner-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeInUp 0.5s ease forwards;
}

.stagger-1 { animation-delay: 0.05s; opacity: 0; }
.stagger-2 { animation-delay: 0.12s; opacity: 0; }
.stagger-3 { animation-delay: 0.19s; opacity: 0; }
.stagger-4 { animation-delay: 0.26s; opacity: 0; }
.stagger-5 { animation-delay: 0.33s; opacity: 0; }
.stagger-6 { animation-delay: 0.40s; opacity: 0; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .top-articles { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .hero-card { height: 320px; }
  .hero-content { padding: 1.5rem; }
  .hero-title { font-size: 1.35rem; }
  .nav-links { display: none; }
  .footer-top { grid-template-columns: 1fr; gap: 2rem; }
  .articles-grid { grid-template-columns: 1fr; }
  .newsletter-form { flex-direction: column; }
  .article-cover { height: 240px; }
  .article-main-title { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .main-content, .hero, .article-page { padding-right: 1rem; padding-left: 1rem; }
  .header { padding: 0 1rem; }
  .hero-card { height: 260px; }
}

/* =============================================
   EMPTY / ERROR STATE
   ============================================= */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-light);
}
.empty-state svg { margin: 0 auto 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1.2rem; color: var(--text-mid); margin-bottom: 0.5rem; }
