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

body {
  font-family: "Cairo", sans-serif;
  background: hsl(220 25% 8% / 1);
  color: #fff;
  overflow-x: hidden;
  line-height: 1.8;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 5%;
  position: fixed;
  width: 100%;
  top: 0;
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
  background: rgba(10, 14, 39, 0.8);
}

.logo {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.logo img {
  height: 40px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
  color: #7c3aed;
}
.nav-links a.active {
  font-weight: bold;
}

.nav-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: white;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.3s;
}

.nav-btn:hover {
  transform: translateY(-2px);
}

/* Mobile nav: shared pieces with blog.css */
.nav-start-lang {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile Menu button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1001;
  padding: 0.5rem;
}

/* Mobile-only items (Settings, Logout) */
.mobile-only {
  display: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a i {
  width: 20px;
  text-align: center;
}

/* Hamburger icon */
.hamburger {
  width: 25px;
  height: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-line {
  width: 25px;
  height: 3px;
  background: white;
  border-radius: 999px;
  transition: all 0.3s;
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.container {
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  overflow-x: hidden; /* Prevent horizontal overflow */
}

.blog-content img,
.featured-image img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain; /* Maintain aspect ratio */
}



/* Layout wrapper to host side ads and main content */
.page-layout {
    margin-top: 5rem;
    padding: 3rem 5%;
    display: grid;
    grid-template-columns: 320px 1fr; /* Always 320px for ads on desktop */
    gap: 24px;
    align-items: start;
    direction: ltr;
}

/* keep Arabic content RTL and align it to the right within the grid */
.page-layout .container {
    direction: rtl;
    width: 100%; /* Fill the available space */
}

.side-col {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}


.side-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(124, 58, 237, 0.4);
    border-radius: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    min-height: 250px;
}
.side-box.small {
    min-height: 250px;
}

.side-box.tall {
    min-height: 600px;
}

@media (max-width: 1200px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .side-col {
    display: none;
  }

}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: #94a3b8;
}

.breadcrumb a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.3s;
}

.breadcrumb a:hover {
  color: #7c3aed;
}

.blog-header {
  margin-bottom: 3rem;
}

.blog-category {
  display: inline-block;
  background: rgba(124, 58, 237, 0.2);
  color: #a855f7;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.blog-title {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.3;
  color: #fff;
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #94a3b8;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.blog-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #cbd5e1;
}

.featured-image {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 3rem;
  overflow: hidden;
  background: rgba(124, 58, 237, 0.1);
}

.featured-image img {
  width: 100%;
  height: auto;
  display: block;
}

.blog-content {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 12px;
  padding: 3rem;
  backdrop-filter: blur(10px);
  margin-bottom: 3rem;
  max-width: 100%;
  overflow-x: hidden; /* Prevent horizontal scroll */
  word-wrap: break-word; /* Break long words */
}

.blog-article {
  max-width: 100%;
  overflow-x: hidden; /* Prevent overflow */
}

.blog-content h2 {
  font-size: 2rem;
  margin: 2rem 0 1rem;
  color: #fff;
  font-weight: 700;
}

.blog-content h3 {
  font-size: 1.5rem;
  margin: 1.5rem 0 0.8rem;
  color: #fff;
  font-weight: 600;
}

.blog-content p {
  margin-bottom: 1.2rem;
  color: #cbd5e1;
  line-height: 1.8;
}

.blog-content strong {
  color: #fff;
  font-weight: 600;
}

.blog-content em {
  color: #94a3b8;
  font-style: italic;
}

.blog-content code {
  background: rgba(124, 58, 237, 0.2);
  color: #a855f7;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  direction: ltr;
  overflow: auto;
}

.blog-content pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(124, 58, 237, 0.3);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto; /* Allow horizontal scroll for code */
  margin: 1.5rem 0;
  max-width: 100%;
}

.blog-content pre code {
  background: transparent;
  padding: 0;
  display: block;
  line-height: 1.6;
}


.blog-content ul,
.blog-content ol {
  margin: 1rem 0 1rem 2rem;
}

.blog-content li {
  margin-bottom: 0.5rem;
  color: #cbd5e1;
}

.blog-content a {
  color: #a855f7;
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 85, 247, 0.3);
  transition: all 0.3s;
}

.blog-content a:hover {
  border-bottom-color: #a855f7;
}

.blog-content blockquote {
  border-right: 3px solid #7c3aed;
  padding-right: 1.5rem;
  margin: 1.5rem 0;
  color: #94a3b8;
  font-style: italic;
}

.blog-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag {
  background: rgba(124, 58, 237, 0.2);
  color: #a855f7;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.share-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 12px;
  padding: 2rem;
  backdrop-filter: blur(10px);
  text-align: center;
}

.share-title {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #a855f7;
}

.share-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: #a855f7;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.share-btn:hover {
  background: rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
}

.loading {
  text-align: center;
  padding: 4rem 2rem;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(124, 58, 237, 0.2);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.error-message {
  text-align: center;
  padding: 4rem 2rem;
  color: #ef4444;
}

.error-message h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.error-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 1rem;
}

footer {
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  padding: 3rem 5%;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-section h4 {
  margin-bottom: 1rem;
  color: #a855f7;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-section a:hover {
  color: #7c3aed;
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  color: #94a3b8;
}

@media (max-width: 768px) {
  .logo img {
    height: 32px;
    max-width: 120px;
  }

  .blog-title {
    font-size: 1.8rem;
  }

  .blog-content {
    padding: 1.5rem;
  }

  .container {
    padding: 0rem 3%;
  }

main.container {
  min-width: 0; /* Allow flexbox/grid to shrink below content size */
  overflow: hidden; /* Hide overflow */
}

  .blog-meta {
    font-size: 0.85rem;
  }

  .mobile-menu-btn {
    display: block;
  }

  .mobile-only {
    display: block;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    width: 70%;
    max-width: 300px;
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    gap: 1.5rem;
    transition: left 0.3s ease;
    border-right: 1px solid rgba(124, 58, 237, 0.2);
    z-index: 999;
  }

  .nav-links.active {
    left: 0;
  }

  /* Side menu link size on mobile (match blog.css) */
  .nav-links a {
    font-size: 1.2rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-btn {
    display: none;
  }
}
