/* =============================================
   MOBILE NAV - Hamburger + Drawer
   barghfani.ir
   ============================================= */

/* === Hamburger Button === */
#bf-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(225,29,72,0.08);
  border: 1px solid rgba(225,29,72,0.2);
  border-radius: 10px;
  cursor: pointer;
  z-index: 200;
  flex-shrink: 0;
  transition: background 0.2s;
}
#bf-hamburger:hover {
  background: rgba(225,29,72,0.15);
}
#bf-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #e11d48;
  border-radius: 2px;
  transition: all 0.3s;
}
#bf-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
#bf-hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
#bf-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === Mobile Drawer ===
   IMPORTANT: default state uses display:none (not max-height trick),
   so the element is fully removed from hit-testing and layout when closed.
   No fixed/absolute positioning trick is relied on for "invisibility". */
#bf-mobile-drawer {
  display: none;
  position: fixed;
  top: 56px;
  right: 0;
  left: 0;
  z-index: 150;
  background: #fffaf9;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(43,16,19,0.08);
  box-shadow: 0 12px 30px rgba(43,16,19,0.12);
  padding: 16px 0 20px;
  direction: rtl;
  max-height: 80vh;
  overflow-y: auto;
}
#bf-mobile-drawer.open {
  display: block;
}

/* Nav Links inside drawer */
#bf-mobile-drawer .bf-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 16px;
}
#bf-mobile-drawer .bf-nav-links a {
  display: block;
  padding: 13px 16px;
  color: #2b1013;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s;
  border: 1px solid transparent;
}
#bf-mobile-drawer .bf-nav-links a:hover,
#bf-mobile-drawer .bf-nav-links a.active {
  color: #e11d48;
  background: rgba(225,29,72,0.08);
  border-color: rgba(225,29,72,0.2);
}

/* Divider */
#bf-mobile-drawer .bf-drawer-divider {
  height: 1px;
  background: rgba(43,16,19,0.08);
  margin: 12px 16px;
}

/* Action buttons row */
#bf-mobile-drawer .bf-drawer-actions {
  display: flex;
  gap: 10px;
  padding: 0 16px;
}
#bf-mobile-drawer .bf-drawer-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
#bf-mobile-drawer .bf-btn-login {
  background: transparent;
  color: #2b1013;
  border: 1px solid rgba(43,16,19,0.15);
}
#bf-mobile-drawer .bf-btn-login:hover {
  color: #e11d48;
  border-color: rgba(225,29,72,0.3);
}
#bf-mobile-drawer .bf-btn-register {
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff;
  border: none;
}
#bf-mobile-drawer .bf-btn-register:hover {
  opacity: 0.9;
}

/* Overlay - default display:none, NOT just opacity:0.
   This guarantees zero hit-testing footprint when closed,
   regardless of opacity/transition timing. */
#bf-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 140;
}
#bf-overlay.open {
  display: block;
}

/* === Mobile Breakpoint === */
@media (max-width: 768px) {
  /* Show hamburger */
  #bf-hamburger {
    display: flex;
  }

  /* Nav layout */
  nav {
    padding: 0 14px !important;
    height: 56px !important;
  }

  /* Hide center links */
  nav > div:nth-child(2) {
    display: none !important;
  }

  /* Right side: hide phone, shrink/hide buttons */
  nav > div:last-child > span {
    display: none !important;
  }

  /* Hide all nav buttons — we show them in drawer or re-show below */
  nav > div:last-child > button {
    display: none !important;
  }

  /* Re-show first TWO buttons using :nth-of-type so the phone-number
     <span> that precedes them (which is not a <button>) doesn't break
     the count. On the logged-in navbar this is [cart, profile];
     on the guest navbar this is [login, register]. */
  nav > div:last-child > button:nth-of-type(1) {
    display: flex !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
  nav > div:last-child > button:nth-of-type(2) {
    display: flex !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  /* Subtext of logo hidden */
  nav > div:first-child > div > div:last-child {
    display: none !important;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 0 12px !important;
  }
}