:root {
  --embn-height: 64px;
  --embn-total-height: calc(var(--embn-height) + env(safe-area-inset-bottom, 0px));
  --embn-accent: var(--ast-global-color-1, #1c7a3d);
}

.embn-mobile-nav {
  position: fixed;
  z-index: 99990;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: var(--embn-height);
  padding: 5px 4px calc(5px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(15, 23, 42, .1);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, .08);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  contain: layout style paint;
}

.embn-mobile-nav__item,
button.embn-mobile-nav__item {
  appearance: none;
  display: flex;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 3px 2px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: #5f6368;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.embn-mobile-nav__item span { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.embn-mobile-nav__item svg { width: 24px; height: 24px; flex: 0 0 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.embn-mobile-nav__item:active { background: rgba(28, 122, 61, .08); background: color-mix(in srgb, var(--embn-accent) 9%, white); }
.embn-mobile-nav__item.is-active { color: var(--embn-accent); font-weight: 700; }
.embn-mobile-nav__item:focus-visible { outline: 2px solid var(--embn-accent); outline-offset: -2px; }

.embn-mobile-nav__toast {
  position: fixed;
  z-index: 99999;
  right: 16px;
  bottom: calc(var(--embn-total-height) + 12px);
  left: 16px;
  visibility: hidden;
  max-width: 420px;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(17, 24, 39, .94);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  pointer-events: none;
}

.embn-mobile-nav__toast.is-visible { visibility: visible; opacity: 1; transform: translateY(0); }

/* Nâng các nút nổi phổ biến lên trên thanh điều hướng, không sửa mã của plugin khác. */
body.embn-enabled #ast-scroll-top,
body.embn-enabled .joinchat,
body.embn-enabled .zalo-chat-widget,
body.embn-enabled #button-contact-vr,
body.embn-enabled iframe[title*="chat" i] {
  bottom: calc(var(--embn-total-height) + 12px) !important;
}

/* Giữ thanh mua hàng cố định của Astra/WooCommerce không bị che. */
body.embn-enabled .ast-sticky-add-to-cart,
body.embn-enabled .ast-sticky-add-to-cart-action-wrap,
body.embn-enabled .wc-block-components-totals-wrapper--sticky {
  bottom: var(--embn-total-height) !important;
}

body.embn-keyboard-open { padding-bottom: 0 !important; }
body.embn-keyboard-open .embn-mobile-nav,
body.embn-keyboard-open .embn-mobile-nav__toast { display: none !important; }

/* Side Cart phải được toàn quyền hiển thị các nút Xem giỏ hàng/Thanh toán. */
body.embn-side-cart-open .embn-mobile-nav,
body.embn-side-cart-open .embn-mobile-nav__toast { display: none !important; }

/* Giữ phần nội dung chat cuộn mượt trên Safari iOS và Chrome Android. */
#ease-chat-root.embn-chat-viewport-managed .ease-chat-panel {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
  .embn-mobile-nav__toast { transition: none; }
}
