/* MSA Frontend v1.4 - Professional Style */
/* ========================================
   Multi Sites Frontend - Professional Style
   ======================================== */

:root {
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #0ea5e9;
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.1);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Noto Sans Arabic', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========== Header ========== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.4px;
}

.site-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 4px 10px rgba(30, 64, 175, 0.25);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feed-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  transition: all var(--transition);
}

.feed-link:hover {
  color: #c2410c;
  border-color: #fed7aa;
  background: #fff7ed;
}

/* ========== Container ========== */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

main {
  flex: 1;
  padding-bottom: 3.5rem;
}

/* ========== Section Title ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 1.15em;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 3px;
}

/* ========== Articles Grid ========== */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 960px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1.15rem;
  }
}

/* ========== Article Card ========== */
.article-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.8);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.article-card > a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}

.card-image {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #e2e8f0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.article-card:hover .card-image img {
  transform: scale(1.06);
}

.card-image .no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #dbeafe, #e0e7ff);
  color: var(--primary);
  font-size: 2.4rem;
}

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.card-body {
  padding: 1.15rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.55rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition);
}

.article-card:hover .card-title {
  color: var(--primary);
}

.card-excerpt {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.read-more {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.82rem;
}

/* ========== Single Post ========== */
.single-wrapper {
  max-width: 780px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
  padding: 0.4rem 0;
}

.back-link:hover {
  color: var(--primary-hover);
}

.post-header {
  margin-bottom: 1.75rem;
}

.post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.cat-badge {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.post-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .post-title {
    font-size: 1.5rem;
  }
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.post-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.post-featured {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  background: #e2e8f0;
}

.post-featured img {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
}

.post-content {
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--text-secondary);
}

.post-content p {
  margin-bottom: 1.3rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 2rem 0 0.9rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
}

.post-content h2 { font-size: 1.4rem; }
.post-content h3 { font-size: 1.2rem; }

.post-content img {
  border-radius: var(--radius-sm);
  margin: 1.6rem 0;
  box-shadow: var(--shadow-sm);
}

.post-content ul,
.post-content ol {
  margin: 1.1rem 0 1.4rem;
  padding-right: 1.4rem;
}

.post-content li {
  margin-bottom: 0.45rem;
}

.post-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content blockquote {
  border-right: 4px solid var(--primary);
  padding: 1rem 1.35rem;
  margin: 1.6rem 0;
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.4rem 0;
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}

/* ========== Related ========== */
.related-section {
  margin-top: 3.5rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== Loading / Error ========== */
.loading-state,
.error-state {
  text-align: center;
  padding: 4.5rem 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 1.15rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-state {
  color: #b91c1c;
}

.retry-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.65rem 1.5rem;
  background: var(--primary);
  color: #fff !important;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}

.retry-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* ========== Skeleton ========== */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card .card-image {
  background: #e2e8f0;
}

.skeleton-card .skeleton-title {
  height: 18px;
  width: 88%;
  margin-bottom: 10px;
}

.skeleton-card .skeleton-text {
  height: 13px;
  width: 100%;
  margin-bottom: 7px;
}

.skeleton-card .skeleton-text.short {
  width: 55%;
}

/* ========== Footer ========== */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding-top: 2.75rem;
  margin-top: auto;
}

.footer-top {
  text-align: center;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid #1e293b;
}

.footer-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #fff;
}

.footer-copyright {
  font-size: 0.9rem;
}

.footer-copyright strong {
  color: #e2e8f0;
}

.friendly-sites {
  padding: 1.6rem 0 2.1rem;
}

.friendly-sites h3 {
  text-align: center;
  font-size: 0.95rem;
  color: #cbd5e1;
  margin-bottom: 1rem;
  font-weight: 600;
}

.friendly-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 0.7rem;
  list-style: none;
}

.friendly-list a {
  color: #94a3b8;
  font-size: 0.84rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  transition: all var(--transition);
}

.friendly-list a:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
