/* ================================================================
   شركة المهر السريع — Premium Header CSS
   Standalone · No Bootstrap dependency · Full RTL
   ================================================================ */

:root {
  --ah-navy:    #0D1B2A;
  --ah-gold:    #C28A3A;
  --ah-gold-h:  #D4A050;
  --ah-cream:   #F7F4EE;
  --ah-dark:    #2B2B2B;
  --ah-gray:    #E6E6E6;
  --ah-border:  rgba(194, 138, 58, 0.22);
  --ah-h-top:   40px;
  --ah-h-nav:   74px;
}

/* ── Scope reset ── */
.almahr-header *,
.almahr-header *::before,
.almahr-header *::after,
.almahr-drawer *,
.almahr-drawer *::before,
.almahr-drawer *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ================================================================
   TOPBAR
   ================================================================ */
.almahr-topbar {
  background: #0a1520;
  border-bottom: 1px solid var(--ah-border);
  height: var(--ah-h-top);
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: height 0.3s ease, opacity 0.3s ease;
}

.almahr-topbar.ah-hidden {
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.almahr-topbar-inner {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.almahr-topbar-info {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
}

.almahr-topbar-info a,
.almahr-topbar-info > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: rgba(247, 244, 238, 0.82);
  text-decoration: none;
  white-space: nowrap;
  font-family: 'Fustat', 'Harmattan', sans-serif;
  transition: color 0.2s;
}

.almahr-topbar-info a:hover {
  color: var(--ah-gold);
}

.almahr-topbar-info a i,
.almahr-topbar-info > span i {
  color: var(--ah-gold);
  font-size: 11px;
}

.ah-sep {
  width: 1px;
  height: 13px;
  background: rgba(255, 255, 255, 0.15);
  display: inline-block;
  flex-shrink: 0;
}

.almahr-topbar-social {
  display: flex;
  align-items: center;
  gap: 6px;
}

.almahr-topbar-social a {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(247, 244, 238, 0.55);
  font-size: 11px;
  text-decoration: none;
  transition: all 0.2s;
}

.almahr-topbar-social a:hover {
  border-color: var(--ah-gold);
  color: var(--ah-gold);
  transform: translateY(-1px);
}

/* ================================================================
   NAVBAR
   ================================================================ */
.almahr-navbar {
  position: sticky;
  top: 0;
  z-index: 1050;
  background: var(--ah-navy);
  border-bottom: 2px solid var(--ah-gold);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

.almahr-navbar.ah-scrolled {
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.45);
}

/* Admin bar offset */
body.admin-bar .almahr-navbar { top: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar .almahr-navbar { top: 46px; }
}

.almahr-navbar-inner {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 28px;
  height: var(--ah-h-nav);
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ── Logo ── */
.almahr-logo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  outline-offset: 4px;
}

.almahr-logo img {
  height: 50px;
  width: 175px;
  display: block;
  transition: opacity 0.2s;
  object-fit: cover;
}

.almahr-logo:hover img { opacity: 0.85; }

/* ── Desktop nav ── */
.almahr-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fustat', 'Harmattan', sans-serif;
}

.almahr-nav > ul,
.almahr-nav > ul ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.almahr-nav > ul {
  display: flex;
  align-items: center;
  gap: 2px;
}

.almahr-nav > ul > li {
  position: relative;
}

.almahr-nav > ul > li > a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 15px;
  color: var(--ah-cream);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 7px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
  position: relative;
}

/* Underline accent */
.almahr-nav > ul > li > a::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 15px;
  left: 15px;
  height: 2px;
  background: var(--ah-gold);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.25s ease;
}

.almahr-nav > ul > li > a:hover,
.almahr-nav > ul > li.current-menu-item > a,
.almahr-nav > ul > li.current-menu-ancestor > a,
.almahr-nav > ul > li.current_page_item > a {
  color: var(--ah-gold);
}

.almahr-nav > ul > li > a:hover::after,
.almahr-nav > ul > li.current-menu-item > a::after,
.almahr-nav > ul > li.current-menu-ancestor > a::after,
.almahr-nav > ul > li.current_page_item > a::after {
  transform: scaleX(1);
}

/* Dropdown caret */
.almahr-nav > ul > li.menu-item-has-children > a::before {
  content: '▾';
  font-size: 10px;
  opacity: 0.6;
  order: -1;
  margin-left: 0;
}

/* Sub-menu */
.almahr-nav .sub-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  background: var(--ah-navy);
  border: 1px solid var(--ah-border);
  border-top: 2px solid var(--ah-gold);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.38);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 200;
  pointer-events: none;
}

.almahr-nav ul li:hover > .sub-menu,
.almahr-nav ul li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.almahr-nav .sub-menu li a {
  display: block;
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(247, 244, 238, 0.82);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.18s, padding-right 0.18s;
}

.almahr-nav .sub-menu li:last-child a { border-bottom: none; }

.almahr-nav .sub-menu li a:hover {
  color: var(--ah-gold);
  padding-right: 24px;
}

/* ── CTA buttons ── */
.almahr-ctas {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.almahr-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'Fustat', 'Harmattan', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.22s ease;
  letter-spacing: 0.01em;
}

.almahr-btn i { font-size: 13px; }

/* Ghost / phone */
.almahr-btn-phone {
  background: transparent;
  border-color: rgba(247, 244, 238, 0.28);
  color: var(--ah-cream);
}

.almahr-btn-phone:hover {
  border-color: rgba(247, 244, 238, 0.65);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ah-cream);
}

/* Gold / WhatsApp */
.almahr-btn-gold {
  background: var(--ah-gold);
  border-color: var(--ah-gold);
  color: #fff;
}

.almahr-btn-gold:hover {
  background: var(--ah-gold-h);
  border-color: var(--ah-gold-h);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(194, 138, 58, 0.38);
}

/* ── Hamburger ── */
.almahr-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1.5px solid rgba(247, 244, 238, 0.22);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: auto; /* push to left on RTL → right side */
  transition: border-color 0.2s;
}

.almahr-toggle:hover { border-color: var(--ah-gold); }

.almahr-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ah-cream);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.25s ease, width 0.25s ease;
}

.almahr-toggle.ah-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.almahr-toggle.ah-open span:nth-child(2) { opacity: 0; width: 0; }
.almahr-toggle.ah-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Gold accent line at bottom of header */
.almahr-header::after {
  content: '';
  display: block;
  height: 0;
}

/* ================================================================
   MOBILE DRAWER
   ================================================================ */
.almahr-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.almahr-drawer-overlay.ah-open {
  opacity: 1;
  visibility: visible;
}

.almahr-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(320px, 88vw);
  height: 100%;
  height: 100dvh;
  background: var(--ah-navy);
  z-index: 1999;
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--ah-gold);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  font-family: 'Fustat', 'Harmattan', sans-serif;
  overscroll-behavior: contain;
}

.almahr-drawer.ah-open { right: 0; }

/* Drawer head */
.almahr-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ah-border);
  flex-shrink: 0;
}

.almahr-drawer-logo img {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}

.almahr-drawer-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--ah-cream);
  line-height: 1;
  transition: background 0.2s;
}

.almahr-drawer-close:hover { background: rgba(194, 138, 58, 0.22); }

/* Drawer nav */
.almahr-drawer-nav {
  flex: 1;
  overflow-y: auto;
}

.almahr-drawer-nav > ul,
.almahr-drawer-nav ul ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.almahr-drawer-nav > ul > li > a {
  display: block;
  padding: 14px 22px;
  color: var(--ah-cream);
  font-size: 15.5px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.18s, background 0.18s;
}

.almahr-drawer-nav > ul > li > a:hover,
.almahr-drawer-nav > ul > li.current-menu-item > a,
.almahr-drawer-nav > ul > li.current_page_item > a {
  color: var(--ah-gold);
  background: rgba(194, 138, 58, 0.07);
}

/* Items with children: add arrow */
.almahr-drawer-nav .menu-item-has-children > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.almahr-drawer-nav .menu-item-has-children > a::after {
  content: '▾';
  font-size: 12px;
  opacity: 0.55;
  transition: transform 0.25s;
  flex-shrink: 0;
}

.almahr-drawer-nav .menu-item-has-children.ah-sub-open > a::after {
  transform: rotate(-180deg);
  opacity: 1;
  color: var(--ah-gold);
}

/* Mobile sub-menu */
.almahr-drawer-nav .sub-menu {
  max-height: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
  transition: max-height 0.3s ease;
}

.almahr-drawer-nav .sub-menu.ah-sub-open {
  max-height: 600px;
}

.almahr-drawer-nav .sub-menu li a {
  display: block;
  padding: 11px 34px;
  font-size: 14px;
  color: rgba(247, 244, 238, 0.72);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: color 0.18s;
}

.almahr-drawer-nav .sub-menu li a:hover { color: var(--ah-gold); }

/* Drawer CTAs */
.almahr-drawer-ctas {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--ah-border);
  flex-shrink: 0;
}

.almahr-drawer-ctas .almahr-btn {
  width: 100%;
  justify-content: center;
  padding: 13px 18px;
  font-size: 14.5px;
}

/* Drawer info strip */
.almahr-drawer-info {
  padding: 14px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.almahr-drawer-info span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: rgba(247, 244, 238, 0.5);
}

.almahr-drawer-info span i { color: var(--ah-gold); font-size: 11px; }

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* ≥ 1024px — full desktop mode */
@media (min-width: 1024px) {
  .almahr-toggle  { display: none !important; }
  .almahr-nav     { display: flex; }
  .almahr-ctas    { display: flex; }
}

/* < 1024px — mobile/tablet */
@media (max-width: 1023px) {
  .almahr-toggle { display: flex; }
  .almahr-nav    { display: none; }
  .almahr-ctas   { display: none; }

  .almahr-topbar-info > span:last-of-type { display: none; }
  .almahr-navbar-inner { padding: 0 18px; }
}

/* < 640px */
@media (max-width: 640px) {
  :root {
    --ah-h-nav: 64px;
    --ah-h-top: 36px;
  }

  .almahr-topbar-info { gap: 10px; }
  .almahr-topbar-info .ah-sep { display: none; }
  .almahr-topbar-info a:last-of-type { display: none; }
  .almahr-topbar-social { display: none; }

  .almahr-logo img { height: 42px; }
  .almahr-navbar-inner { padding: 0 14px; }
}

/* < 420px */
@media (max-width: 420px) {
  .almahr-topbar { display: none; }
}

/* ================================================================
   BODY OFFSET  (so sticky header doesn't cover anchors)
   ================================================================ */
html { scroll-padding-top: calc(var(--ah-h-nav) + 16px); }

/* ================================================================
   BOOTSTRAP RESET — prevent global Bootstrap from breaking header
   ================================================================ */

/* WP default walker outputs <ul> with no class at root — target by parent */
.almahr-nav > ul { list-style: none !important; }

/* Sub-menus from WP default walker */
.almahr-nav .sub-menu {
  display: block !important; /* override any Bootstrap d-none */
  flex-direction: unset !important;
}

/* Bootstrap .navbar might add padding to .navbar-brand / nav links globally */
.almahr-header .almahr-logo,
.almahr-header .almahr-btn {
  all: unset; /* clean slate, re-applied via class */
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

/* Re-apply logo styles after all: unset */
.almahr-logo {
  text-decoration: none;
  cursor: pointer;
  outline-offset: 4px;
  flex-shrink: 0;
}
.almahr-logo img {
  height: 50px;
  width: auto;
  display: block;
  transition: opacity 0.2s;
  object-fit: contain;
}
.almahr-logo:hover img { opacity: 0.85; }

/* Re-apply btn styles after all: unset */
.almahr-btn {
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'Fustat', 'Harmattan', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.22s ease;
  letter-spacing: 0.01em;
}
.almahr-btn i { font-size: 13px; }

.almahr-btn-phone {
  background: transparent !important;
  border-color: rgba(247,244,238,0.28) !important;
  color: var(--ah-cream) !important;
}
.almahr-btn-phone:hover {
  border-color: rgba(247,244,238,0.65) !important;
  background: rgba(255,255,255,0.06) !important;
  color: var(--ah-cream) !important;
}
.almahr-btn-gold {
  background: var(--ah-gold) !important;
  border-color: var(--ah-gold) !important;
  color: #fff !important;
}
.almahr-btn-gold:hover {
  background: var(--ah-gold-h) !important;
  border-color: var(--ah-gold-h) !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(194,138,58,0.38);
}

/* Drawer btn width override */
.almahr-drawer-ctas .almahr-btn {
  width: 100%;
  justify-content: center;
  padding: 13px 18px;
  font-size: 14.5px;
}
