/* 
  ========================================================================
  BrightAI Unified Premium Header System
  Role: Senior UI/UX & Frontend Architect
  Saudi Market AI Safety Platform - High-Performance Responsive Navigation
  ========================================================================
*/

/* حماية أيقونات Font Awesome من تداخل خطوط الموقع */
.fa, .fa-solid, .fas {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
  display: inline-block;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}
.fa-brands, .fab {
  font-family: "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
  display: inline-block;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

/* المتغيرات الأساسية لنظام التصميم الفخم */
:root {
  --bheader-bg: rgba(8, 14, 28, 0.82);
  --bheader-blur: 18px;
  --bheader-border: rgba(255, 255, 255, 0.05);
  --bdropdown-bg: rgba(6, 10, 20, 0.98);
  --bdropdown-border: rgba(255, 255, 255, 0.08);
  --bdropdown-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.8), 0 0 40px 2px rgba(0, 212, 255, 0.06);
  --baccent-glow: linear-gradient(135deg, #00d4ff, #7c5cff);
  --bwa-gradient: linear-gradient(135deg, #25D366, #128C7E);
  --btext-primary: #ffffff;
  --btext-secondary: rgba(255, 255, 255, 0.7);
  --btext-muted: rgba(255, 255, 255, 0.45);
  --brightai-page-gutter: clamp(16px, 3vw, 32px);
}

/* تنسيق الهيدر الرئيسي الملتصق */
.brightai-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--bheader-bg);
  backdrop-filter: blur(var(--bheader-blur));
  -webkit-backdrop-filter: blur(var(--bheader-blur));
  border-bottom: 1px solid var(--bheader-border);
  transition: all 0.3s ease;
  width: 100%;
}

.brightai-header-nav {
  max-width: 85rem;
  margin-inline: auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* الشعار والروابط */
.brightai-logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--btext-primary);
  transition: opacity 0.25s ease;
}
.brightai-logo-link:hover {
  opacity: 0.92;
}

.brightai-logo-box {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.2);
  box-shadow: 0 8px 24px -6px rgba(0, 212, 255, 0.25);
  transition: transform 0.3s ease;
}
.brightai-logo-link:hover .brightai-logo-box {
  transform: scale(1.05);
}

.brightai-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brightai-logo-text {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--btext-primary);
}

.brightai-logo-text-gradient {
  background: var(--baccent-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brightai-logo-badge {
  display: none !important;
}
@media (min-width: 768px) {
  .brightai-logo-badge {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--btext-muted);
    border-inline-start: 1px solid rgba(255, 255, 255, 0.1);
    padding-inline-start: 0.75rem;
    margin-inline-start: 0.25rem;
  }
}

/* روابط الديسكتوب للتصفح */
.brightai-desktop-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .brightai-desktop-menu {
    display: flex;
  }
}

.brightai-menu-item {
  position: relative;
}

.brightai-menu-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--btext-secondary);
  text-decoration: none;
  padding: 0.5rem 0.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.25s ease;
}
.brightai-menu-link:hover,
.brightai-menu-link.is-active {
  color: #00d4ff;
}

.brightai-menu-link .fa-chevron-down {
  font-size: 0.65rem;
  opacity: 0.6;
  transition: transform 0.25s ease;
}
.brightai-menu-item:hover .brightai-menu-link .fa-chevron-down,
.brightai-menu-item:focus-within .brightai-menu-link .fa-chevron-down,
.brightai-menu-item.is-open .brightai-menu-link .fa-chevron-down {
  transform: rotate(180deg);
}

/* القوائم المنسدلة العملاقة Mega Dropdown و العادية */
.brightai-dropdown {
  position: absolute;
  display: none !important;
  top: calc(100% + 0.75rem);
  inset-inline-start: 50%;
  transform: translateX(-50%) translateY(10px);
  background: linear-gradient(145deg, rgba(7, 13, 26, 0.98), rgba(10, 18, 35, 0.94));
  border: 1px solid var(--bdropdown-border);
  box-shadow: 0 24px 58px -28px rgba(0, 0, 0, 0.92), 0 18px 42px -30px rgba(0, 212, 255, 0.35);
  border-radius: 1.25rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1000;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

/* إظهار القائمة المنسدلة عند الحوم (Hover) */
.brightai-menu-item:hover > .brightai-dropdown,
.brightai-menu-item:focus-within > .brightai-dropdown,
.brightai-menu-item.is-open > .brightai-dropdown {
  display: block !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.brightai-menu-item:hover > .brightai-dropdown-solutions,
.brightai-menu-item:focus-within > .brightai-dropdown-solutions,
.brightai-menu-item.is-open > .brightai-dropdown-solutions,
.brightai-menu-item:hover > .brightai-dropdown-resources,
.brightai-menu-item:focus-within > .brightai-dropdown-resources,
.brightai-menu-item.is-open > .brightai-dropdown-resources {
  display: grid !important;
}

.brightai-menu-item:hover > .brightai-dropdown-kernel,
.brightai-menu-item:focus-within > .brightai-dropdown-kernel,
.brightai-menu-item.is-open > .brightai-dropdown-kernel {
  display: flex !important;
}

/* سهم القائمة العلوي التزييني */
.brightai-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  inset-inline-start: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(7, 13, 26, 0.98);
  border-top: 1px solid var(--bdropdown-border);
  border-inline-start: 1px solid var(--bdropdown-border);
  z-index: -1;
}

/* قائمة الحلول العملاقة */
.brightai-dropdown-solutions {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 1.125rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.35) transparent;
}

.brightai-dropdown-solutions::-webkit-scrollbar {
  width: 8px;
}

.brightai-dropdown-solutions::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.28);
  border-radius: 999px;
}

.brightai-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.75rem;
  border-radius: 0.875rem;
  color: var(--btext-secondary);
  text-decoration: none;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}
.brightai-dropdown-item:hover {
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.08) 0%, rgba(124, 92, 255, 0.08) 100%);
  border-color: rgba(0, 212, 255, 0.15);
  color: var(--btext-primary);
}

.brightai-dropdown-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  font-size: 1.25rem;
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.05);
  padding: 0;
  border-radius: 0.65rem;
  border: 1px solid rgba(0, 212, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s ease;
}
.brightai-dropdown-item:hover .brightai-dropdown-icon {
  background: #00d4ff;
  color: #060a14;
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

.brightai-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  text-align: start;
}

.brightai-dropdown-title {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--btext-primary);
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.brightai-dropdown-desc {
  font-size: 0.75rem;
  color: var(--btext-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.brightai-dropdown-cta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding: 0.8rem 0.95rem;
  border-radius: 0.9rem;
  color: var(--btext-primary);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.86rem;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.brightai-dropdown-cta:hover {
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.18);
  color: #00d4ff;
}

.brightai-dropdown-cta i {
  font-size: 0.8rem;
}

/* قائمة الموارد العملاقة (3 أعمدة) */
.brightai-dropdown-resources {
  width: 52rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1.75rem;
}

.brightai-resource-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brightai-column-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--btext-muted);
  letter-spacing: 0.05em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 0.25rem;
  text-align: start;
}

.brightai-resource-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--btext-secondary);
  text-decoration: none;
  padding: 0.45rem 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.25s ease;
  text-align: start;
}
.brightai-resource-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #00d4ff;
  padding-inline-start: 0.85rem;
}

.brightai-resource-link i {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.3);
  transition: color 0.25s ease;
}
.brightai-resource-link:hover i {
  color: #00d4ff;
}

/* قائمة لوحة النواة KERNEL */
.brightai-dropdown-kernel {
  width: 17.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
}

.brightai-dropdown-kernel .brightai-dropdown-item {
  align-items: center;
  padding: 0.65rem 0.85rem;
}
.brightai-dropdown-kernel .brightai-dropdown-icon {
  font-size: 1rem;
  padding: 0.45rem;
  border-radius: 0.5rem;
}
.brightai-dropdown-kernel .brightai-dropdown-title {
  font-size: 0.88rem;
}

@media (min-width: 1024px) {
  .brightai-dropdown {
    position: fixed;
    top: calc(var(--brightai-header-height, 74px) + 0.65rem);
    left: 50%;
    right: auto;
    inset-inline-start: auto;
    transform: translateX(-50%) translateY(10px);
    max-width: calc(100vw - (var(--brightai-page-gutter) * 2));
  }

  .brightai-menu-item:hover > .brightai-dropdown,
  .brightai-menu-item:focus-within > .brightai-dropdown,
  .brightai-menu-item.is-open > .brightai-dropdown {
    transform: translateX(-50%) translateY(0);
  }

  .brightai-dropdown::before {
    left: 50%;
    inset-inline-start: 50%;
    transform: translateX(-50%) rotate(45deg);
  }

  .brightai-dropdown-solutions {
    width: min(720px, calc(100vw - (var(--brightai-page-gutter) * 2)));
    max-height: calc(100vh - var(--brightai-header-height, 74px) - 2rem);
  }

  .brightai-dropdown-resources {
    width: min(52rem, calc(100vw - (var(--brightai-page-gutter) * 2)));
    max-height: calc(100vh - var(--brightai-header-height, 74px) - 2rem);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .brightai-dropdown-kernel {
    width: min(18rem, calc(100vw - (var(--brightai-page-gutter) * 2)));
    max-height: calc(100vh - var(--brightai-header-height, 74px) - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .brightai-dropdown-resources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(42rem, calc(100vw - (var(--brightai-page-gutter) * 2)));
  }
}

/* أزرار الإجراءات والـ CTA */
.brightai-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brightai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1.1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
}

/* زر واتساب */
.brightai-btn-wa {
  background: var(--bwa-gradient);
  color: #ffffff !important;
  box-shadow: 0 8px 24px -8px rgba(37, 211, 102, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.brightai-btn-wa:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px -6px rgba(37, 211, 102, 0.65);
}

/* زر الديمو التفاعلي المتوهج */
.brightai-btn-demo {
  background: var(--baccent-glow);
  color: #ffffff !important;
  box-shadow: 0 10px 30px -10px rgba(0, 212, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brightai-btn-demo:hover {
  filter: brightness(1.1) saturate(1.1);
  transform: translateY(-1px);
  box-shadow: 0 15px 35px -8px rgba(0, 212, 255, 0.6);
}

/* زر همبرغر للجوال */
.brightai-hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.25s ease;
}
@media (min-width: 1024px) {
  .brightai-hamburger-btn {
    display: none;
  }
}
.brightai-hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.3);
}

/* 
  =========================================
  درج الجوال الجانبي الفاخر (Mobile Drawer)
  =========================================
*/
.brightai-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 16, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  z-index: 9998;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.brightai-drawer-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.brightai-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 85%;
  max-width: 23.5rem;
  background: rgba(6, 10, 20, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
  z-index: 9999;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

/* تحديد اتجاه فتح الدرج بناء على RTL و LTR */
[dir="rtl"] .brightai-drawer {
  right: -100%;
}
[dir="rtl"] .brightai-drawer.is-active {
  right: 0;
}
[dir="ltr"] .brightai-drawer {
  left: -100%;
}
[dir="ltr"] .brightai-drawer.is-active {
  left: 0;
}

.brightai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brightai-drawer-close {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.25s ease;
}
.brightai-drawer-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ff5ca7;
}

.brightai-drawer-content {
  flex: 1;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.brightai-drawer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.brightai-drawer-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  color: var(--btext-secondary);
  font-size: 0.95rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.25s ease;
}
.brightai-drawer-link:hover,
.brightai-drawer-link.is-active {
  background: rgba(255, 255, 255, 0.03);
  color: #00d4ff;
  padding-inline-start: 1.25rem;
}

.brightai-drawer-link i {
  width: 1.25rem;
  font-size: 1.05rem;
  color: #00d4ff;
  text-align: center;
}

/* تنسيق الأكورديون للجوال */
.brightai-drawer-accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  color: var(--btext-secondary);
  font-size: 0.95rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.25s ease;
}
.brightai-drawer-accordion-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #00d4ff;
}

.brightai-drawer-accordion-btn i.fa-chevron-down {
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.3s ease;
}
.brightai-drawer-accordion-btn.is-open i.fa-chevron-down {
  transform: rotate(180deg);
}

.brightai-drawer-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding-inline-start: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.brightai-drawer-accordion-content.is-open {
  max-height: 50rem; /* ارتفاع كبير بما يكفي لاحتواء العناصر */
}

.brightai-drawer-sublink {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.65rem;
  color: var(--btext-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.25s ease;
}
.brightai-drawer-sublink:hover {
  background: rgba(0, 212, 255, 0.03);
  color: #00d4ff;
}

.brightai-drawer-sublink i {
  font-size: 0.95rem;
  color: #00d4ff;
  margin-top: 0.2rem;
}

.brightai-drawer-subtitle {
  font-weight: 700;
  color: var(--btext-primary);
  display: block;
}

.brightai-drawer-subdesc {
  font-size: 0.75rem;
  color: var(--btext-muted);
  display: block;
  margin-top: 0.15rem;
}

/* قسم الأزرار والتواصل في الدرج الجانبي */
.brightai-drawer-footer {
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brightai-drawer-footer .brightai-btn {
  width: 100%;
  padding: 0.8rem;
  font-size: 0.9rem;
}

/* تفعيل وضع إيقاف تمرير الـ Body */
body.brightai-no-scroll {
  overflow: hidden !important;
}

/* تكييف التباعد العلوي التلقائي لصفحات الموقع لتفادي تغطية المحتوى */
body {
  padding-top: 0 !important; /* الهيدر فوق كل شيء */
}

/* تحسين الاستجابة للشاشات الكبيرة والتنقل السلس */
@media (max-width: 1023px) {
  .brightai-desktop-menu {
    display: none;
  }

  .brightai-dropdown {
    display: none;
  }

  .brightai-actions .brightai-btn-wa {
    display: none; /* إخفاء واتساب من الديسكتوب في الشاشات الصغيرة لتوفير المساحة */
  }
}

@media (max-width: 1180px) and (min-width: 1024px) {
  .brightai-dropdown-solutions {
    width: min(640px, calc(100vw - 24px));
    padding: 1rem;
  }
}
@media (max-width: 639px) {
  .brightai-actions .brightai-btn-demo {
    display: none; /* إخفاء الديمو أيضاً والاكتفاء بزر الموبايل */
  }
}
