/* Frontend Styles */

:root {
    --brand-blue: #2b4596;
    --brand-orange: #e9640a;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

.document-content img,
.post-content img,
.content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.navbar {
    background: linear-gradient(135deg, #2b4596 0%, #1f2f6b 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1030;
    
}
.navbar-brand img {
    max-height: 60px;
    transition: max-height 0.3s ease;
}

.sticky-top {
    position: sticky !important;
    top: 0;
    z-index: 1030;
}

/* تعديل z-index للعمود الجانبي في صفحة الوثائق */
.col-lg-4 .sticky-top {
    z-index: 1020;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

/* Breadcrumb Styles */
.breadcrumb {
    background-color: #f8f9fa;
    border-radius: 0;
    padding: 0.75rem 0;
    margin-bottom: 0;
}

.breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-item.active {
    color: #6c757d;
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: var(--bs-breadcrumb-divider, "/");
    float: left;
    padding-right: var(--bs-breadcrumb-item-padding-x, 0.5rem);
    color: #6c757d;
}

/* RTL Support for Breadcrumb */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: var(--bs-breadcrumb-item-padding-x, 0.5rem);
    padding-right: 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: #333;
}

.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

/* .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
} */

.card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}



.cardhome {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    background-color: white;
}

.cardhome:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.cardhome-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cardhome:hover .cardhome-img-top {
    transform: scale(1.05);
}


.btn-primary {
    background-color: #6f8ea8;
    border: 1px solid #6f8ea8;
    border-radius: 25px;
    padding: 10px 25px;
    font-weight: 600;
    color: #fff;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #5f7e96;
    border-color: #5f7e96;
    color: #fff;
    box-shadow: none;
}

/* توحيد نص الهيدر ولونه */
.navbar .nav-link,
.navbar .navbar-brand,
.navbar .dropdown-item,
.lang-switch {
  color: #2b4596;
}

/* هوفر الهيدر */
.navbar .nav-link:hover,
.navbar .navbar-brand:hover,
.navbar .dropdown-item:hover,
.lang-switch:hover {
  color: #e9640a;
}

.footer {
    background: linear-gradient(135deg, #1f2f6b 0%, #2b3e6b 100%);
    color: white;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer h5 {
    color: #ecf0f1;
    margin-bottom: 20px;
}

.footer a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #ecf0f1;
}

.category-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: none;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #2b4596 0%, #e9640a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: none;
}

.stats-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2b4596;
    margin-bottom: 10px;
}

.stats-label {
    color: #6c757d;
    font-weight: 500;
}

.post-meta {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.post-meta i {
    margin-right: 5px;
    color: #2b4596;
}

.badge-category {
    background: linear-gradient(135deg, #2b4596 0%, #e9640a 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.language-switcher {
    margin-left: 15px;
}

.language-switcher .btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    margin: 0 2px;
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 0.9rem;
}

.language-switcher .btn:hover,
.language-switcher .btn.active {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    color: white;
}

/* Dropdown Styles */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 10px 0;
    margin-top: 5px;
}

.dropdown-item {
    padding: 8px 20px;
    transition: all 0.3s ease;
    border-radius: 5px;
    margin: 2px 10px;
}

.dropdown-item:hover {
    background-color: rgba(233, 100, 10, 0.12);
    color: #e9640a;
    transform: translateX(5px);
}

.dropdown-toggle::after {
    margin-left: 0.5em;
    transition: transform 0.3s ease;
}

.dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* Navbar Dropdown Specific */
.navbar .dropdown-menu {
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
}

.navbar .dropdown-item {
    color: #2b4596;
    font-weight: 700;
    display: flex;
    font-size: 14px;
}

.navbar .dropdown-item:hover {
    background-color: rgba(233, 100, 10, 0.12);
    color: #e9640a;
}

/* Header Layout Improvements */
.navbar .container {
    padding-left: 15px;
    padding-right: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Keep current desktop alignment, but fix mobile/tablet layout */
@media (max-width: 992px) {
    .navbar .container {
        justify-content: space-between !important; /* logo right, toggler left in RTL */
        width: 100%;
    }
    .navbar-brand {
        margin-right: 0 !important;
    }
    .navbar-toggler {
        margin-inline-start: auto; /* push toggler to the opposite edge */
    }
}

.navbar-brand {
    margin-right: 1rem !important;
}

.navbar-nav {
    margin-right: 0.5rem !important;
}

.navbar .d-flex {
    margin-left: 0 !important;
}

.navbar-collapse {
    flex-grow: 0;
}

@media (max-width: 768px) {
    .navbar-brand img {
        max-height: 42px;
    }

    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .category-icon {
        font-size: 2rem;
    }
    
    .stats-number {
        font-size: 2rem;
    }

    .document-content img,
    .post-content img {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
    }
}

/* Sidebar Related Posts: consistent thumbnail + text layout (applies site-wide) */
/* ----------------------------------------------- */
.related-posts {
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  padding: 30px;
}

.related-post-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 15px;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  margin-bottom: 15px;
}

.related-post-card:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  color: inherit;
  text-decoration: none;
}

.related-thumb {
  width: 110px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.related-post-body {
  flex: 1;
  min-width: 0; /* allow text truncation without overflow */
}

.related-post-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.related-post-meta {
  font-size: 0.8rem;
  color: #666;
}

/* RTL: place thumbnail to the right and align text accordingly */
[dir="rtl"] .related-post-card {
  flex-direction: row; /* keep natural order */
}
[dir="rtl"] .related-thumb {
  order: 2; /* move image to the right */
}
[dir="rtl"] .related-post-body {
  order: 1;
  text-align: right;
}

@media (max-width: 576px) {
  .related-thumb {
    width: 95px;
    height: 62px;
  }
}

/* Header text: bold + 14px */
.navbar .nav-link,
.navbar .navbar-brand {
  font-weight: 700;
  font-size: 14px;
}

/* Dropdown items in header */
.navbar .dropdown-item {
  font-weight: 700;
  font-size: 14px;
}

/* Language switch button in header */
.lang-switch {
  font-weight: 700;
  font-size: 14px;
}

/* Unify all buttons site-wide to single calm color */
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info,
.btn-light,
.btn-dark {
  background-color: #6f8ea8;
  border-color: #6f8ea8;
  color: #fff;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info,
.btn-outline-light,
.btn-outline-dark {
  background-color: transparent;
  border-color: #6f8ea8;
  color: #6f8ea8;
}

/* Hover/focus unified behavior */
.btn-secondary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-info:hover,
.btn-light:hover,
.btn-dark:hover,
.btn-secondary:focus,
.btn-success:focus,
.btn-danger:focus,
.btn-warning:focus,
.btn-info:focus,
.btn-light:focus,
.btn-dark:focus {
  background-color: #5f7e96;
  border-color: #5f7e96;
  color: #fff;
  box-shadow: none;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover,
.btn-outline-warning:hover,
.btn-outline-info:hover,
.btn-outline-light:hover,
.btn-outline-dark:hover,
.btn-outline-primary:focus,
.btn-outline-secondary:focus,
.btn-outline-success:focus,
.btn-outline-danger:focus,
.btn-outline-warning:focus,
.btn-outline-info:focus,
.btn-outline-light:focus,
.btn-outline-dark:focus {
  background-color: #5f7e96;
  border-color: #5f7e96;
  color: #fff;
  box-shadow: none;
}

/* محتوى غني — تضمينات iframe (YouTube, Google Drive, ...) */
.rich-content iframe,
.content-text iframe,
.post-content iframe,
.document-content iframe {
  max-width: 100%;
  width: 100%;
  min-height: 400px;
  border: 0;
  border-radius: 8px;
  margin: 1rem 0;
}

.rich-content .embed-responsive-wrapper,
.content-text .embed-responsive-wrapper {
  position: relative;
  width: 100%;
  margin: 1rem 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* اختصارات الكلمات المفتاحية — شريط أفقي مضغوط فوق النتائج */
.section-keyword-strip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.section-keyword-strip__label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  padding-inline-end: 0.35rem;
  border-inline-end: 1px solid #dbe3ef;
}

.section-keyword-strip__scroll {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  padding-bottom: 1px;
}

.section-keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
  transition: all 0.15s ease;
}

.section-keyword-chip:hover {
  border-color: #93b4f6;
  background: #eff6ff;
  color: #1d4ed8;
}

.section-keyword-chip.is-active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.section-keyword-chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
}

.section-keyword-chip.is-active .section-keyword-chip__count {
  background: rgba(255, 255, 255, 0.22);
}

.section-keyword-results__list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.section-kw-doc-card {
  border: 2px solid var(--brand-blue);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: #fff;
  box-shadow: 0 4px 14px rgba(43, 69, 150, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.section-kw-doc-link:hover .section-kw-doc-card {
  border-color: var(--brand-orange);
  box-shadow: 0 10px 24px rgba(233, 100, 10, 0.12);
  transform: translateY(-4px);
}

.section-kw-doc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-orange);
  margin: 0 0 0.75rem;
  line-height: 1.5;
  transition: color 0.25s ease;
}

.section-kw-doc-link:hover .section-kw-doc-title {
  color: var(--brand-blue);
}

.section-kw-doc-section {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-blue);
  background: rgba(43, 69, 150, 0.08);
  border: 1px solid rgba(43, 69, 150, 0.18);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin-bottom: 0.65rem;
}

.section-kw-doc-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem 1rem;
  margin: 0 0 0.75rem;
}

.section-kw-doc-field dt {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0 0 0.15rem;
  font-weight: 600;
}

.section-kw-doc-field dd {
  margin: 0;
  font-size: 0.9rem;
  color: #0f172a;
  font-weight: 600;
}

.section-kw-doc-excerpt {
  color: #475569;
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
}

.section-kw-doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.8rem;
  color: #64748b;
  border-top: 1px solid #eef2f7;
  padding-top: 0.65rem;
}

/* بطاقات الوثائق — الهوية البصرية */
.doc-card,
.document-card.doc-card {
  border: 2px solid var(--brand-blue) !important;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(43, 69, 150, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}

.doc-card .card-title,
.document-card.doc-card .card-title {
  color: var(--brand-orange);
  font-weight: 700;
  transition: color 0.25s ease;
}

.doc-card:hover,
.document-card.doc-card:hover,
a:hover .doc-card {
  transform: translateY(-4px);
  border-color: var(--brand-orange) !important;
  box-shadow: 0 10px 24px rgba(233, 100, 10, 0.12);
}

.doc-card:hover .card-title,
.document-card.doc-card:hover .card-title,
a:hover .doc-card .card-title {
  color: var(--brand-blue);
}

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

.doc-attached-files-list {
  max-height: 420px;
  overflow-y: auto;
}

@media (max-width: 575.98px) {
  .section-keyword-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .section-keyword-strip__label {
    border-inline-end: none;
    padding-inline-end: 0;
    padding-bottom: 0.25rem;
  }
}