/* سايدبار الصفحات + صفحات ذات صلة — أسماء معزولة حتى لا تصطدم بـ .sidebar */
.page-rail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "main"
    "related"
    "rail";
  gap: 1.5rem;
  align-items: start;
  overflow: visible;
}

.page-rail-layout__main,
.page-rail-layout > .article-content-main {
  min-width: 0;
  grid-area: main;
}

.page-rail {
  min-width: 0;
  grid-area: rail;
}

.page-rail-layout > .related-pages-rail {
  grid-area: related;
  margin: 0;
}

.page-rail-layout > .related-pages-rail .related-pages-rail__inner {
  max-width: none;
  padding: 0;
}

.page-rail-layout .article-content-main {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.page-rail-layout .description-content {
  max-width: none;
  margin: 0;
}

.page-rail__widget {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.page-rail__widget:last-child {
  margin-bottom: 0;
}

.page-rail__cta {
  background: linear-gradient(160deg, #B45309 0%, #92400E 100%);
  border: none;
  color: #fff;
  padding: 1.15rem 1.1rem 1.25rem;
}

.page-rail__cta-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  line-height: 1.45;
}

.page-rail__cta-text {
  font-size: 0.88rem;
  line-height: 1.7;
  margin: 0 0 1rem;
  opacity: 0.95;
}

.page-rail__cta-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.page-rail__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.page-rail__btn--whatsapp {
  background: #25d366;
  color: #fff;
}

.page-rail__btn--whatsapp:hover {
  background: #1ebe57;
  color: #fff;
}

.page-rail__btn--phone {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.page-rail__btn--phone:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.page-rail__heading {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: #1a1a1a;
  background: #f8f5f0;
  border-bottom: 2px solid #B45309;
}

.page-rail__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.page-rail__item {
  border-bottom: 1px solid #f1f3f5;
}

.page-rail__item:last-child {
  border-bottom: none;
}

.page-rail__link {
  display: block;
  padding: 0.7rem 1rem;
  color: #2c3e50;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  transition: background 0.15s ease, color 0.15s ease;
}

.page-rail__link:hover {
  background: #fff8f1;
  color: #B45309;
}

.page-rail__link.is-current {
  background: #fff8f1;
  color: #B45309;
  font-weight: 700;
}

.page-rail__meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: #888;
  font-weight: 500;
}

.page-rail__link--service {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.page-rail__count {
  color: #888;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.page-rail__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.85rem 1rem 1rem;
}

.page-rail__tag {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #374151;
  font-size: 0.8rem;
  text-decoration: none;
  background: #fff;
  line-height: 1.4;
}

.page-rail__tag:hover {
  border-color: #B45309;
  color: #B45309;
  background: #fff8f1;
}

.page-rail__sticky {
  position: static;
}

.related-pages-rail {
  margin: 2rem 0 1rem;
  min-width: 0;
  overflow-x: hidden;
}

.related-pages-rail__inner {
  max-width: 1460px;
  margin: 0 auto;
  padding: 0 20px;
}

.related-pages-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.related-pages-rail__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a1a;
}

.related-pages-rail__nav {
  display: flex;
  gap: 0.4rem;
}

.related-pages-rail__btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  color: #B45309;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.related-pages-rail__btn:hover {
  background: #fff8f1;
  border-color: #B45309;
}

.related-pages-rail__track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.related-pages-rail__card {
  flex: 0 0 min(260px, 80vw);
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-pages-rail__card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  color: inherit;
}

.related-pages-rail__image {
  height: 140px;
  overflow: hidden;
  background: #f3f4f6;
}

.related-pages-rail__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-pages-rail__body {
  padding: 0.85rem 0.95rem 1rem;
}

.related-pages-rail__kind {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #B45309;
  margin-bottom: 0.35rem;
}

.related-pages-rail__card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
  color: #1f2937;
  overflow-wrap: anywhere;
}

@media (min-width: 1100px) {
  .page-rail-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
      "main rail"
      "related related";
  }

  .page-rail__sticky {
    position: sticky;
    top: 140px;
  }
}

@media (max-width: 1099px) {
  .page-rail-layout .article-content-main {
    margin-bottom: 0;
  }
}
