/* css/blog.css */
:root {
  /* ---------- Brand colors (original) ---------- */
  --blog-primary: #0056b3;
  --blog-secondary: #e6f2ff;
  --blog-accent: #d4a373; /* Warm accent for underlines etc */
  --blog-text: #2c3e50;
  --blog-muted: #888;
  --blog-border: #eaeaea;
  --blog-bg: #fdfdfd;
  --blog-white: #ffffff;

  /* ---------- Transparent variants of existing colors ---------- */
  --blog-white-glass: rgba(255, 255, 255, 0.25);
  --blog-primary-glow: rgba(0, 86, 179, 0.1);
  --blog-overlay-40: rgba(0, 0, 0, 0.4);
  --blog-overlay-50: rgba(0, 0, 0, 0.5);
  --blog-overlay-60: rgba(0, 0, 0, 0.6);
  --blog-overlay-70: rgba(0, 0, 0, 0.7);

  /* ---------- Radius ---------- */
  --blog-radius: 8px;
  --blog-radius-xs: 2px;
  --blog-radius-sm: 4px;
  --blog-radius-lg: 12px;
  --blog-radius-pill: 30px;
  --blog-radius-circle: 50%;

  /* ---------- Shadows ---------- */
  --blog-shadow: 0 5px 20px rgba(0, 0, 0, 0.06);
  --blog-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.1);
  --blog-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.06);
  --blog-shadow-xs: 0 2px 10px rgba(0, 0, 0, 0.02);

  /* ---------- Typography ---------- */
  --blog-font-heading: "Georgia", "Cairo", serif;
  --blog-font-body: "Cairo", sans-serif;

  /* ---------- Misc ---------- */
  --blog-transition: 0.3s ease;
  --blog-hero-image: url("/img/blog/blog-bg.webp");
  --blog-single-hero-image: url("/img/blog/blog-bg.webp");
}

body {
  background-color: var(--blog-bg);
}

/* ==================== HERO SECTION (NEW DESIGN) ==================== */

/* ========================= */
.blog-hero-new {
  background-image: linear-gradient(
    var(--blog-overlay-50),
    var(--blog-overlay-60)
  );
  background-size: cover;
  background-position: center;
  color: var(--blog-white);
  text-align: center;
  padding: 100px 20px;
  margin-bottom: 60px;
  margin-top: 30px;
}

.blog-hero-new h1 {
  font-size: 2rem;
  margin-bottom: 15px;
  font-family: var(--blog-font-heading);
  font-weight: 700;
}

.blog-hero-new p {
  font-style: italic;
  font-size: 1.15rem;
  margin-bottom: 30px;
  opacity: 0.9;
  font-family: var(--blog-font-heading);
}

.breadcrumb {
  display: inline-block;
  background: var(--blog-white-glass);
  padding: 8px 25px;
  border-radius: var(--blog-radius-pill);
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}

.breadcrumb a {
  color: var(--blog-white);
  text-decoration: none;
}

.breadcrumb span {
  margin: 0 8px;
  opacity: 0.7;
}

/* ==================== MAIN LAYOUT ==================== */
.blog-layout {
  display: flex;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto 80px auto;
  padding: 0 20px;
}

.blog-main-content {
  flex: 1;
}

.blog-sidebar {
  width: 320px;
  flex-shrink: 0;
}

@media (max-width: 992px) {
  .blog-layout {
    flex-direction: column;
  }
  .blog-sidebar {
    width: 100%;
  }
}

/* ==================== CATEGORIES ==================== */
.blog-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 30px;
}

.category-btn {
  background-color: var(--blog-white);
  color: var(--blog-muted);
  border: 1px solid var(--blog-border);
  padding: 8px 20px;
  border-radius: var(--blog-radius-pill);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--blog-transition);
  font-family: var(--blog-font-body);
}

.category-btn:hover,
.category-btn.active {
  border-color: var(--blog-primary);
  color: var(--blog-primary);
  box-shadow: 0 2px 8px var(--blog-primary-glow);
}

@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== CARDS GRID ==================== */
.new-blogs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

@media (max-width: 768px) {
  .new-blogs-grid {
    grid-template-columns: 1fr;
  }
}

.modern-card {
  position: relative;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  transition: transform var(--blog-transition);
}

.modern-card:hover {
  transform: translateY(-5px);
}

.modern-card-img {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.modern-card-content {
  background: var(--blog-white);
  padding: 25px;
  margin: -40px 15px 0 15px; /* Overlaps the image */
  position: relative;
  z-index: 2;
  border-radius: var(--blog-radius-sm);
  box-shadow: var(--blog-shadow);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  text-align: right;
}

.card-meta-top {
  font-size: 0.8rem;
  color: var(--blog-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  gap: 15px;
  font-weight: 600;
}

.card-meta-top .category {
  color: var(--blog-primary);
}

.modern-card h3 {
  font-size: 1.35rem;
  font-family: var(--blog-font-heading);
  color: var(--blog-text);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modern-card a {
  text-decoration: none;
  color: inherit;
}

.card-meta-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--blog-muted);
}

.card-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--blog-radius-circle);
  object-fit: cover;
  background-color: var(--blog-border);
}

/* ==================== SIDEBAR ==================== */
.sidebar-widget {
  background: var(--blog-white);
  border: 1px solid var(--blog-border);
  padding: 30px;
  margin-bottom: 30px;
  border-radius: var(--blog-radius-sm);
  box-shadow: var(--blog-shadow-xs);
}

.sidebar-title-wrap {
  text-align: center;
  margin-bottom: 25px;
}

.sidebar-title {
  font-size: 1.25rem;
  font-family: var(--blog-font-heading);
  color: var(--blog-text);
  position: relative;
  display: inline-block;
}

.sidebar-title::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 2px;
  background: var(--blog-accent);
}

/* Search Box */
.search-form {
  display: flex;
  background: var(--blog-bg);
  border-radius: var(--blog-radius-sm);
  overflow: hidden;
}

.search-form input {
  border: none;
  padding: 12px 15px;
  background: transparent;
  width: 100%;
  outline: none;
  font-family: inherit;
}

.search-form button {
  background: transparent;
  border: none;
  padding: 10px 15px;
  color: var(--blog-muted);
  cursor: pointer;
}

/* Recent Posts */
.recent-post-item {
  display: flex;
  align-items: center;
  text-align: right;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--blog-border);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}

.recent-post-item:hover {
  opacity: 0.8;
}

.recent-post-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.recent-post-img {
  width: 70px;
  height: 70px;
  border-radius: var(--blog-radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.recent-post-info h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--blog-text);
  font-family: var(--blog-font-heading);
  line-height: 1.4;
}

.recent-post-info .meta {
  font-size: 0.75rem;
  color: var(--blog-muted);
  font-style: italic;
}

/* ==================== SINGLE POST HERO ==================== */
.single-post-hero {
  position: relative;
  /* الصورة من كل مقالة، وإن لم توجد تُستخدم الصورة الاحتياطية */
  background-image: var(--hero-img, var(--blog-single-hero-image));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--blog-white);
  text-align: center;
  padding: 150px 20px;
  margin-bottom: 60px;
  overflow: hidden;
  isolation: isolate;
}

/* الـ Overlay */
.single-post-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--blog-overlay-40), var(--blog-overlay-70));
  z-index: -1;
}

.single-post-hero h1 {
  font-size: 3.5rem;
  font-family: var(--blog-font-heading);
  font-weight: 800;
  margin: 0 auto 20px;
  max-width: 900px;
  line-height: 1.3;
}

.single-post-hero .post-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  opacity: 0.95;
}

.single-post-hero .post-meta span {
  background: var(--blog-white-glass);
  backdrop-filter: blur(4px);
  padding: 6px 18px;
  border-radius: var(--blog-radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .single-post-hero {
    padding: 90px 15px;
  }
  .single-post-hero h1 {
    font-size: 2rem;
  }
}

.single-post-container {
  max-width: 850px;
  margin: 0 auto;
  padding: 0 20px 80px 20px;
}

.single-post-content {
  font-size: 1.1rem;
  color: var(--blog-text);
  line-height: 2;
  font-family: var(--blog-font-body);
}

.single-post-content p {
  margin-bottom: 30px;
}

/* Inline Images grid inside content */
.post-inline-images {
  display: flex;
  gap: 20px;
  margin: 40px 0 10px 0;
}

.post-inline-images img {
  flex: 1;
  width: 50%;
  object-fit: cover;
  border-radius: var(--blog-radius-sm);
}

.post-image-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--blog-muted);
  font-style: italic;
  margin-bottom: 40px;
}

/* Blockquote */
.post-blockquote {
  border-right: 4px solid var(--blog-accent); /* RTL right border */
  padding: 20px 30px 20px 0;
  margin: 40px 0;
  font-size: 1.4rem;
  font-style: italic;
  color: var(--blog-text);
  font-family: var(--blog-font-heading);
  background: transparent;
}

.post-blockquote .author {
  display: block;
  font-size: 0.95rem;
  color: var(--blog-muted);
  margin-top: 15px;
  font-style: normal;
}

/* Share Box */
.post-share-box {
  display: flex;
  align-items: center;
  background-color: var(--blog-bg);
  border: 1px solid var(--blog-border);
  padding: 15px 25px;
  margin: 50px 0;
  border-radius: var(--blog-radius-sm);
}

.post-share-box > span {
  font-weight: bold;
  font-family: var(--blog-font-heading);
  margin-left: 20px;
  font-style: italic;
  color: var(--blog-text);
}

.post-share-box .social-icons {
  display: flex;
  gap: 8px;
}

.post-share-box .social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background-color: var(--blog-muted);
  color: var(--blog-white);
  border-radius: var(--blog-radius-xs);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--blog-transition);
}

.post-share-box .social-icons a:hover {
  background-color: var(--blog-primary);
}

/* Author Box */
.post-author-box {
  display: flex;
  align-items: center; /* Center horizontally with the avatar */
  gap: 25px;
  padding: 40px 0;
  border-top: 1px solid var(--blog-border);
  border-bottom: 1px solid var(--blog-border);
  margin-bottom: 50px;
}

.post-author-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--blog-radius-circle);
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--blog-border);
}

.post-author-info h4 {
  font-size: 1.3rem;
  color: var(--blog-text);
  margin-bottom: 10px;
  font-family: var(--blog-font-heading);
}

.post-author-info p {
  font-size: 0.95rem;
  color: var(--blog-text);
  margin-bottom: 10px;
  line-height: 1.6;
}

.post-author-info a {
  font-size: 0.85rem;
  color: var(--blog-primary);
  text-decoration: underline;
}

/* Pagination */
.post-pagination {
  display: flex;
  justify-content: space-between;
}

.post-pagination a {
  display: inline-block;
  background-color: var(--blog-accent);
  color: var(--blog-white);
  padding: 12px 25px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: bold;
  border-radius: var(--blog-radius-sm);
  transition: background var(--blog-transition);
}

.post-pagination a:hover {
  background-color: var(--blog-primary);
}

/* ==================== COMPARISON TABLE ==================== */
.post-comparison-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--blog-radius-lg);
  box-shadow: var(--blog-shadow-sm);
}

.post-comparison-table {
  width: 100%;
  border-collapse: collapse;
  direction: rtl;
  font-family: inherit;
  font-size: 15px;
  min-width: 480px;
  background: var(--blog-white);
}

.post-comparison-table thead th {
  background: var(--blog-primary);
  color: var(--blog-white);
  font-weight: 700;
  text-align: right;
  padding: 14px 18px;
}

.post-comparison-table thead th:first-child {
  border-top-right-radius: var(--blog-radius-lg);
}

.post-comparison-table thead th:last-child {
  border-top-left-radius: var(--blog-radius-lg);
}

.post-comparison-table tbody td {
  padding: 14px 18px;
  text-align: right;
  border-bottom: 1px solid var(--blog-border);
  color: var(--blog-text);
}

.post-comparison-table tbody td:first-child {
  font-weight: 700;
  color: var(--blog-primary);
  white-space: nowrap;
}

.post-comparison-table tbody tr:nth-child(even) {
  background: var(--blog-secondary);
}

.post-comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.post-comparison-table tbody tr:last-child td:first-child {
  border-bottom-right-radius: var(--blog-radius-lg);
}

.post-comparison-table tbody tr:last-child td:last-child {
  border-bottom-left-radius: var(--blog-radius-lg);
}

@media (max-width: 480px) {
  .post-comparison-table {
    font-size: 13.5px;
  }
  .post-comparison-table thead th,
  .post-comparison-table tbody td {
    padding: 10px 12px;
  }
}
