/**
 * Humanity Takaful (تكافل الإنسانية)
 * الأزرق #345faa والأخضر #208334 — مزامنة مع متغيرات قالب TemplateMo
 */
:root {
  --ht-blue: #345faa;
  --ht-green: #208334;

  /* يعيد تعريف متغيرات templatemo-kind-heart-charity.css بالكامل */
  --primary-color: #345faa;
  --secondary-color: #208334;
  --custom-btn-bg-color: #208334;
  --custom-btn-bg-hover-color: #345faa;
  --section-bg-color: #eef3fb;
  --site-footer-bg-color: #2b4c84;
  --p-bg-color: #4a5e8c;
}

.text-brand-blue {
  color: var(--ht-blue) !important;
}

.text-brand-green {
  color: var(--ht-green) !important;
}

.bg-brand-blue {
  background-color: var(--ht-blue) !important;
}

.bg-brand-green {
  background-color: var(--ht-green) !important;
}

/* شعار أكبر (طلب المستخدم) */
nav.navbar .navbar-brand.navbar-brand-logo .logo {
  width: auto;
  max-width: min(340px, 62vw);
  max-height: 88px;
  height: auto;
}

/* قوائم رئيسية/فرعية: عرض مناسب للعناصر الكثيرة */
.ht-submenu {
  min-width: 16rem;
  max-height: 70vh;
  overflow-y: auto;
}

.ht-submenu .dropdown-item {
  white-space: normal;
  line-height: 1.35;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

@media (min-width: 992px) {
  .ht-main-nav .nav-link {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 991.98px) {
  nav.navbar[dir='rtl'] > .container {
    flex-wrap: wrap;
    align-items: center;
  }

  nav.navbar[dir='rtl'] .navbar-toggler {
    flex-shrink: 0;
  }

  nav.navbar[dir='rtl'] .navbar-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  nav.navbar[dir='rtl'] .navbar-collapse {
    flex-basis: 100%;
    flex-grow: 1;
  }

  /* Mobile offcanvas nav (Bootstrap 5) */
  #siteNavOffcanvas.offcanvas {
    width: min(86vw, 380px);
  }

  #siteNavOffcanvas .offcanvas-header {
    padding-top: 1rem;
    padding-bottom: 0.75rem;
  }

  #siteNavOffcanvas .nav-link,
  #siteNavOffcanvas .dropdown-item {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

/* تصميم الهمبرجر والسايد بار مثل لوحة التحكم */
.sidebar-toggle-btn {
  width: 42px;
  height: 42px;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background: white;
  color: var(--primary-color);
  font-size: 1.5rem;
  transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
  background: #f8f9fa;
  color: var(--ht-green);
}

.site-sidebar.offcanvas {
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
  color: white;
}

.site-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
}

.site-sidebar .nav-link:hover,
.site-sidebar .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: white !important;
}

.site-sidebar .dropdown-menu {
  background: rgba(0, 0, 0, 0.15);
  border: none;
  margin: 0 0.5rem;
}

.site-sidebar .dropdown-item {
  color: rgba(255, 255, 255, 0.8) !important;
}

.site-sidebar .dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white !important;
}

.logo-inverted {
  filter: brightness(0) invert(1);
}

  #siteNavOffcanvas .nav-item.ms-lg-3 {
    margin-right: 0 !important;
  }

  #siteNavOffcanvas .custom-border-btn.btn {
    width: 100%;
    justify-content: center;
  }

  /* Make dropdowns usable inside offcanvas on mobile */
  #siteNavOffcanvas .dropdown-menu {
    position: static !important;
    float: none !important;
    transform: none !important;
    width: 100%;
    border: 0;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
    box-shadow: none;
  }

  #siteNavOffcanvas .dropdown-menu .dropdown-item {
    border-radius: 10px;
  }
}

/* Mobile typography & media safety */
@media (max-width: 991.98px) {
  img,
  svg,
  video {
    max-width: 100%;
    height: auto;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .form-control,
  .form-select {
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive > .table {
    margin-bottom: 0;
  }

  .table-responsive .table th,
  .table-responsive .table td {
    white-space: nowrap;
  }

  /* Compact counters (icon next to number, text under) */
  .counter-thumb {
    margin: 10px;
    padding: 0.85rem 0.9rem;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  }

  .counter-thumb > .d-flex {
    align-items: center;
    gap: 0.6rem;
  }

  .counter-thumb .counter-icon {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(52, 95, 170, 0.12);
    color: var(--ht-blue);
    font-size: 1.1rem;
    flex: 0 0 44px;
  }

  .counter-thumb .counter-number,
  .counter-thumb .counter-number-text {
    font-size: 1.5rem;
    line-height: 1.1;
  }

  .counter-thumb .counter-text {
    display: block;
    margin-top: 0.4rem;
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.35;
  }
}

/* أزرار الـ nav «تبرع لنا» تبقى حسب القالب؛ نضمن وضوح الحدود مع المتغيرات */
.navbar-expand-lg .navbar-nav .nav-link.custom-border-btn {
  border-color: var(--ht-green) !important;
  color: var(--ht-blue) !important;
}

.navbar-expand-lg .navbar-nav .nav-link.custom-border-btn:hover {
  background: var(--ht-green) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* عناوين التذييل: لون العلامة الثانوي */
.site-footer-title {
  color: var(--ht-green) !important;
}

a.category-block-link:hover,
a.tags-block-link:hover,
a.news-block-title-link:hover {
  color: var(--ht-blue) !important;
}

/* شريط التذييل السفلي: لون hover أقرب لمنظومة العلامة بدل الأصفر الافتراضي */
.site-footer-bottom a:hover {
  color: #c5d7f7 !important;
}

/* RTL dropdown menus: align from right to left */
nav.navbar[dir='rtl'] .dropdown-menu {
  right: 0;
  left: auto;
}

nav.navbar[dir='rtl'] .dropdown-menu.dropdown-menu-end {
  right: auto;
  left: 0;
}

nav.navbar[dir='rtl'] .dropdown-toggle::after {
  margin-right: 0.255em;
  margin-left: 0;
}

/* RTL hover effects for dropdown items */
nav.navbar[dir='rtl'] .ht-submenu .dropdown-item:hover {
  background-color: var(--ht-blue);
  color: #fff !important;
  padding-right: 1rem;
  transition: all 0.3s ease;
}

/* Force RTL dropdown positioning */
nav.navbar[dir='rtl'] .dropdown-menu {
  right: 0 !important;
  left: auto !important;
  text-align: right !important;
}

nav.navbar[dir='rtl'] .nav-item.dropdown {
  position: relative;
}

nav.navbar[dir='rtl'] .dropdown-menu.ht-submenu {
  right: 0 !important;
  left: auto !important;
  transform: none !important;
}

/* Fix Arabic text alignment for RTL (avoid breaking Bootstrap flex layouts) */
[dir="rtl"] {
  text-align: right !important;
}

[dir="rtl"] .text-center {
  text-align: center !important;
}

[dir="rtl"] .text-start {
  text-align: end !important;
}

[dir="rtl"] .text-end {
  text-align: start !important;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6,
[dir="rtl"] p,
[dir="rtl"] .carousel-caption,
[dir="rtl"] .featured-block-text,
[dir="rtl"] .custom-text-box,
[dir="rtl"] .custom-text-block,
[dir="rtl"] .news-block-info,
[dir="rtl"] .news-block-title,
[dir="rtl"] .news-block-body {
  text-align: right !important;
  direction: rtl !important;
}

[dir="rtl"] .text-center h1,
[dir="rtl"] .text-center h2,
[dir="rtl"] .text-center h3,
[dir="rtl"] .text-center h4,
[dir="rtl"] .text-center h5,
[dir="rtl"] .text-center h6,
[dir="rtl"] .text-center p {
  text-align: center !important;
}

/* Fix carousel caption alignment */
[dir="rtl"] .carousel-caption {
  text-align: right !important;
  padding-right: 15% !important;
  padding-left: 15% !important;
}

/* Fix form inputs and buttons */
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] button,
[dir="rtl"] .form-control {
  text-align: right !important;
}

[dir="rtl"] .btn {
  text-align: center !important;
}

/* Fix news and content blocks */
[dir="rtl"] .news-block,
[dir="rtl"] .custom-block,
[dir="rtl"] .featured-block {
  text-align: right !important;
}

/*
 * IMPORTANT:
 * Do NOT override `.d-flex` globally in RTL.
 * Bootstrap relies on flex utilities for layout; forcing `justify-content` here
 * breaks navbars/offcanvas/forms/cards on mobile.
 */

/* Fix counter and stats */
[dir="rtl"] .counter-thumb {
  text-align: right !important;
}

[dir="rtl"] .progress {
  text-align: right !important;
}

/* Contact icon-box style (Elementor-like) */
.contact-info .ht-icon-box {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: flex-start !important;
  gap: 0.9rem;
  background: #fff;
  border-radius: 16px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.contact-info .ht-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(52, 95, 170, 0.12);
  color: var(--ht-blue);
  flex: 0 0 44px;
}

.contact-info .ht-icon-circle i {
  font-size: 1.15rem;
  line-height: 1;
}

.contact-info .ht-icon-box-title {
  font-weight: 700;
  margin: 0;
}

.contact-info .ht-icon-box-desc {
  color: #4a4a4a;
  margin: 0;
}

.contact-info .ht-icon-box-desc a {
  color: inherit;
  text-decoration: none;
}

.contact-info .ht-icon-box-desc a:hover {
  color: var(--ht-blue);
  text-decoration: underline;
}
