/* =========================================================
   Al-Ekhwa Navbar — header.css
   Brand accent: #0B7239 | Active/hover bg: #f0fdf4
   RTL Arabic interface, 3 breakpoints: 1200px+ / 768px / 375px
   ========================================================= */

:root {
  --aek-accent: #0B7239;
  --aek-accent-soft: #f0fdf4;
  --aek-text: #1f2a24;
  --aek-muted: #5b6b62;
  --aek-white: #ffffff;
  --aek-header-h: 88px;
  --aek-header-h-compact: 68px;
}

/* Reset the default Frappe/Bootstrap navbar so it doesn't fight ours */
.aek-header * { box-sizing: border-box; }
.aek-header a { text-decoration: none; color: inherit; }
.aek-header ul { list-style: none; margin: 0; padding: 0; }
.aek-header button { font-family: inherit; cursor: pointer; }

.aek-header {
  direction: rtl;
  background: var(--aek-white);
  border-bottom: 3px solid var(--aek-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
  font-family: "Tajawal", "Cairo", "Segoe UI", Tahoma, sans-serif;
}

.aek-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  height: var(--aek-header-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* ---------- Brand / Logo ---------- */
.aek-brand { display: flex; align-items: center; flex-shrink: 0; order: 1; }
.aek-brand-logo { height: 56px; width: auto; display: block; }
.aek-brand-text { font-size: 22px; font-weight: 800; color: var(--aek-accent); }

/* ---------- Desktop center nav ---------- */
.aek-nav-links {
  order: 2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aek-nav-link {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--aek-text);
  border-bottom: 3px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.aek-nav-link:hover {
  background: var(--aek-accent-soft);
  color: var(--aek-accent);
}

.aek-nav-link.is-active {
  color: var(--aek-accent);
  background: var(--aek-accent-soft);
  border-bottom-color: var(--aek-accent);
}

/* ---------- Desktop actions (search + account + cart) ---------- */
.aek-actions {
  order: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.aek-search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.aek-search-input {
  width: 260px;
  height: 42px;
  border: 1px solid #e5e9e7;
  background: #f7f9f8;
  border-radius: 10px;
  padding: 0 42px 0 14px;
  font-size: 14px;
  color: var(--aek-text);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.aek-search-input:focus {
  outline: none;
  border-color: var(--aek-accent);
  background: var(--aek-white);
}

.aek-search-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--aek-muted);
  font-size: 15px;
  display: flex;
}

.aek-icon-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 46px;
  height: 46px;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: var(--aek-text);
  font-size: 17px;
  transition: background 0.2s ease, color 0.2s ease;
}

.aek-icon-btn:hover { background: var(--aek-accent-soft); color: var(--aek-accent); }
.aek-icon-label { font-size: 10px; font-weight: 600; }

.aek-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  background: var(--aek-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Toggle visibility helpers */
.aek-mobile-only { display: none; }
.aek-desktop-only { display: flex; }

/* ---------- Drawer (mobile/tablet) — hidden by default ---------- */
.aek-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 19, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1001;
}

.aek-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--aek-white);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  z-index: 1002;
  max-height: 90vh;
  overflow-y: auto;
  padding-bottom: 8px;
}

.aek-drawer.is-open,
.aek-drawer-overlay.is-open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.aek-drawer-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #eef2f0;
}

.aek-drawer-search { position: relative; flex: 1; }
.aek-drawer-search-input {
  width: 100%;
  height: 44px;
  border: 1px solid #e5e9e7;
  background: #f7f9f8;
  border-radius: 10px;
  padding: 0 40px 0 14px;
  font-size: 14px;
}
.aek-drawer-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--aek-accent);
  font-size: 14px;
}

.aek-drawer-close {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: #f7f9f8;
  color: var(--aek-text);
  font-size: 16px;
  flex-shrink: 0;
}
.aek-drawer-close:hover { background: var(--aek-accent-soft); color: var(--aek-accent); }

.aek-drawer-list { padding: 6px 10px; }

.aek-drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--aek-text);
}
.aek-drawer-link:hover,
.aek-drawer-link:active { background: var(--aek-accent-soft); color: var(--aek-accent); }

.aek-drawer-link-label { display: flex; align-items: center; gap: 10px; }
.aek-drawer-icon { color: var(--aek-accent); width: 20px; text-align: center; }
.aek-badge-inline { position: static; }

.aek-drawer-footer {
  border-top: 1px solid #eef2f0;
  padding: 10px 16px 16px;
}

.aek-drawer-account {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--aek-accent-soft);
  color: var(--aek-accent);
  font-weight: 700;
}
.aek-drawer-account-icon { font-size: 15px; }

/* =========================================================
   Shared rule for anything below desktop (< 1200px):
   center nav links disappear, hamburger + drawer take over.
   ========================================================= */
@media (max-width: 1199.98px) {
  .aek-header-inner { height: var(--aek-header-h-compact); padding: 0 20px; }
  .aek-nav-links { display: none; }
  .aek-desktop-only { display: none; }
  .aek-mobile-only { display: flex; }
  .aek-actions { flex: 1; justify-content: flex-end; }
}

/* =========================================================
   TABLET — 768px to 1199px
   Logo right · full search bar centered/flexed · cart + account
   icons (no labels) · hamburger on the left
   ========================================================= */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .aek-header-inner { gap: 16px; }
  .aek-search-toggle { display: none; }      /* tablet uses a real bar, not a toggle */
  .aek-search-form {
    display: flex;
    flex: 1;
    max-width: 420px;
  }
  .aek-search-form .aek-search-input { width: 100%; }
}

/* =========================================================
   MOBILE — up to 767px
   Logo right · cart / account / search / hamburger as icons only
   ========================================================= */
@media (max-width: 767.98px) {
  .aek-header-inner { padding: 0 14px; gap: 6px; }
  .aek-search-form { display: none; }        /* replaced by aek-search-toggle icon */
  .aek-brand-logo { height: 40px; }
  .aek-icon-btn { width: 40px; height: 40px; font-size: 16px; }
  .aek-actions { gap: 2px; }
  .aek-drawer { border-radius: 0 0 14px 14px; }
}

/* --- إصلاح: الأيقونة جنب النص في الديسك توب بدل فوق بعض --- */
.aek-desktop-only.aek-icon-btn {
  flex-direction: row;
  width: auto;
  height: 42px;
  padding: 0 12px;
  gap: 8px;
}
.aek-desktop-only.aek-icon-btn .aek-icon-label {
  font-size: 13px;
}

/* --- إصلاح: خانة البحث في الهيدر (حالة القائمة المقفولة) أكبر ومتمركزة --- */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .aek-search-form {
    max-width: 520px;
    margin: 0 auto;
  }
  .aek-search-form .aek-search-input {
    height: 48px;
    font-size: 15px;
    border-radius: 12px;
  }
}

/* توحيد محاذاة كل عناصر القائمة المنسدلة (نفس شكل السلة) */
.aek-drawer-link {
  justify-content: flex-start;
}
.aek-drawer-link-label {
  width: 100%;
  justify-content: space-between;
  flex-direction: row-reverse;
}

/* --- إصلاح: الأيقونة والنص مجموعين جنب بعض في نفس الاتجاه --- */
.aek-drawer-link-label {
  width: auto;
  justify-content: flex-start;
  flex-direction: row;
  gap: 10px;
}

/* --- تكبير حقل البحث في كل المقاسات (زي شكله في القائمة المفتوحة) --- */
@media (max-width: 1199.98px) {
  .aek-search-form {
    display: flex;
    max-width: 90%;
    width: 100%;
    margin: 14px auto;
  }
  .aek-search-form .aek-search-input {
    width: 100%;
    height: 48px;
    font-size: 15px;
    border-radius: 12px;
  }
  .aek-search-toggle {
    display: none;
  }
}

/* ============ Account dropdown (added) ============ */
.aek-account-dropdown { position: relative; }
.aek-account-toggle { cursor: pointer; background: none; border: none; }
.aek-account-caret { font-size: 10px; margin-inline-start: 2px; transition: transform .2s ease; }
.aek-account-dropdown.is-open .aek-account-caret { transform: rotate(180deg); }
.aek-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,.12);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
  z-index: 200;
}
.aek-account-dropdown.is-open .aek-account-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.aek-account-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: #1f2937; text-decoration: none; font-size: 14px;
}
.aek-account-menu-item:hover { background: #f0fdf4; color: #0B7239; }
.aek-account-menu-item.is-disabled { color: #9ca3af; cursor: not-allowed; opacity: .65; }
.aek-account-menu-item.is-disabled:hover { background: none; color: #9ca3af; }

.aek-drawer-footer { display: flex; flex-direction: column; gap: 6px; }
.aek-drawer-account.is-disabled { color: #9ca3af; opacity: .65; cursor: not-allowed; }

/* ============ Cart shake animation (added) ============ */
@keyframes aek-cart-shake {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(-14deg); }
  30%  { transform: rotate(11deg); }
  45%  { transform: rotate(-8deg); }
  60%  { transform: rotate(6deg); }
  75%  { transform: rotate(-3deg); }
  100% { transform: rotate(0deg); }
}
.aek-cart-shake { animation: aek-cart-shake .4s ease-in-out; transform-origin: 50% 0%; }

/* ============ Remove default page-builder section padding from our
   custom Navbar/Footer Web Templates (root cause of the top/bottom gap) ============ */
section.section[data-section-template="Al Ekhwa Navbar"],
section.section[data-section-template="Al Ekhwa Footer"] {
  padding: 0 !important;
  margin: 0 !important;
}

/* ============ Prevent horizontal scrollbar from full-bleed sections ============ */
html, body {
  overflow-x: hidden;
}

/* Hide the search bar/icon from the mobile header only; still available inside the drawer menu */
@media (max-width: 767.98px) {
  .aek-search-form {
    display: none !important;
  }
}


/* Al-Ekhwa: زر طلب عرض سعر عبر واتساب في صفحة المنتج */
.aek-whatsapp-quote-btn {
  background-color: #25D366;
  border-color: #25D366;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.aek-whatsapp-quote-btn:hover,
.aek-whatsapp-quote-btn:focus {
  background-color: #1DA851;
  border-color: #1DA851;
  color: #fff;
}


/* AEK_MOBILE_SIDEBAR_TOGGLE_BLOCK */
.aek-sidebar-toggle-btn {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: fit-content;
  min-width: 140px;
  background: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 14px;
  margin: 10px 0;
  font-size: 14px;
  cursor: pointer;
}

.aek-sidebar-toggle-btn .aek-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 12px;
}

.aek-sidebar-toggle-btn.aek-open .aek-arrow {
  transform: rotate(180deg);
}

@media (max-width: 991px) {
  .aek-sidebar-toggle-btn {
    display: inline-flex;
  }

  .sidebar-column.aek-force-show {
    display: block !important;
    width: 100% !important;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 6px 18px;
    margin-bottom: 18px;
  }

  .sidebar-column.aek-force-show .sidebar-items > ul {
    margin: 0;
    padding: 0;
  }

  .sidebar-column.aek-force-show .sidebar-item {
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
  }

  .sidebar-column.aek-force-show .sidebar-item:last-child {
    border-bottom: none;
  }

  .sidebar-column.aek-force-show .sidebar-item a {
    display: block;
  }
}

/* AEK_FULL_WIDTH_STANDARD_PAGES */
.web-footer .container,
.page_content > .container,
.website-container .container {
  max-width: 100% !important;
  width: 100% !important;
}

/* AEK_FULL_WIDTH_FIX_V2 */
.page-content-wrapper > main.container {
  max-width: 100% !important;
  width: 100% !important;
}
