/* ============================================================================
   MOBILE BOTTOM NAVIGATION — dailyxedien.vn
   File riêng, không ảnh hưởng custom.css
   ============================================================================ */

/* ── Chỉ hiện trên mobile ── */
@media (max-width: 768px) {

  /* Body padding để content không bị che */
  body {
    padding-bottom: 60px !important;
  }

  /* ── Bottom Nav Bar ── */
  .dxd-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.04), 0 -4px 16px rgba(0, 0, 0, 0.06);
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    margin: 0;
  }

  /* ── Nav Item ── */
  .dxd-bottom-nav__item {
    flex: 1 1 0;
    width: 20%;
    min-width: 0;
    max-width: 20%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none !important;
    color: #8b95a5;
    font-size: 10px;
    font-weight: 500;
    font-family: "Be Vietnam Pro", sans-serif;
    letter-spacing: 0.2px;
    padding: 6px 0 4px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.25s ease;
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
    box-sizing: border-box;
    text-align: center;
  }

  /* Tap feedback */
  .dxd-bottom-nav__item:active {
    transform: scale(0.92);
  }

  .dxd-bottom-nav__item:hover,
  .dxd-bottom-nav__item:focus {
    color: #1e73be;
    text-decoration: none !important;
  }

  .dxd-bottom-nav__item.is-active {
    color: #1e73be;
  }

  /* Active indicator line (thay dot bằng line) */
  .dxd-bottom-nav__item.is-active::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2.5px;
    border-radius: 0 0 3px 3px;
    background: #1e73be;
  }

  .dxd-bottom-nav__icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border-radius: 8px;
    transition: background 0.25s ease;
  }

  /* Active icon: nhẹ highlight background */
  .dxd-bottom-nav__item.is-active .dxd-bottom-nav__icon {
    background: rgba(30, 115, 190, 0.1);
  }

  .dxd-bottom-nav__icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
    transition: transform 0.2s ease;
  }

  /* Active icon scale nhẹ */
  .dxd-bottom-nav__item.is-active .dxd-bottom-nav__icon svg {
    stroke-width: 2.2;
  }

  .dxd-bottom-nav__label {
    display: block;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    width: 100%;
    font-size: 10px;
    transition: font-weight 0.2s ease;
  }

  .dxd-bottom-nav__item.is-active .dxd-bottom-nav__label {
    font-weight: 600;
  }

  /* ── More Popup Overlay ── */
  .dxd-more-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .dxd-more-overlay.is-active {
    opacity: 1;
    visibility: visible;
  }

  /* ── Bottom Sheet ── */
  .dxd-more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dxd-more-overlay.is-active + .dxd-more-sheet,
  .dxd-more-sheet.is-active {
    transform: translateY(0);
  }

  /* Handle bar */
  .dxd-more-sheet__handle {
    display: flex;
    justify-content: center;
    padding: 12px 0 4px;
  }

  .dxd-more-sheet__handle span {
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: #d0d5dd;
  }

  /* Sheet header */
  .dxd-more-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px 12px;
    border-bottom: 1px solid #f0f2f5;
  }

  .dxd-more-sheet__title {
    font-family: "Be Vietnam Pro", sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
  }

  .dxd-more-sheet__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f0f2f5;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .dxd-more-sheet__close:hover {
    background: #e2e5ea;
    color: #1e293b;
  }

  /* Sheet grid */
  .dxd-more-sheet__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 16px 16px 28px;
  }

  .dxd-more-sheet__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 14px;
    background: #f7f8fb;
    text-decoration: none !important;
    color: #334155;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .dxd-more-sheet__item:hover,
  .dxd-more-sheet__item:focus {
    background: #eef2ff;
    color: #1e73be;
    transform: scale(1.03);
    text-decoration: none !important;
  }

  .dxd-more-sheet__item.is-active {
    background: #e8f0fe;
    color: #1e73be;
    box-shadow: inset 0 0 0 1.5px rgba(30, 115, 190, 0.25);
  }

  .dxd-more-sheet__item-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  }

  .dxd-more-sheet__item-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .dxd-more-sheet__item-label {
    font-family: "Be Vietnam Pro", sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
  }

  /* ── Adjust existing elements ── */

  /* Nâng Flatsome sticky ATC lên trên bottom nav */
  .sticky-add-to-cart-wrapper {
    bottom: 60px !important;
  }

  /* ── Subiz widget: chuyển sang PHẢI, nâng lên trên bottom nav ── */
  #cprlrysxdtvqrmyvjxncx,
  #cprlrysxdtvqrmyvjxncx .mobile .widget-layout,
  #cprlrysxdtvqrmyvjxncx .widget-layout {
    bottom: 80px !important;
    right: 8px !important;
    left: auto !important;
    z-index: 99997 !important; /* dưới popup overlay (99999) */
  }

  /* ── Phone button fixed: giữ vị trí cũ (trái), chỉ nâng lên ── */
  .contact-sidebar,
  a[href^="tel"].hotline-phone-ring-wrap,
  .hotline-phone-ring-wrap,
  .hotline-bar,
  .btn-call,
  .call-now-button,
  .phone-fixed,
  div[class*="hotline"],
  div[class*="phone-ring"],
  a.call-button {
    bottom: 70px !important;
    z-index: 99997 !important; /* dưới popup overlay */
  }

  /* ── Zalo / Messenger fixed widgets ── */
  .zalo-chat-widget,
  [class*="zalo"] {
    right: 8px !important;
    left: auto !important;
    bottom: 70px !important;
    z-index: 99997 !important;
  }

  /* ── Khi popup "Thêm" mở: ẩn Subiz + phone để không khuất menu ── */
  .dxd-more-overlay.is-active ~ #cprlrysxdtvqrmyvjxncx,
  .dxd-more-sheet.is-active ~ #cprlrysxdtvqrmyvjxncx {
    z-index: 1 !important;
  }

  /* Ẩn absolute footer (đã ẩn nhưng đề phòng) */
  .absolute-footer {
    margin-bottom: 60px;
  }

}

/* Desktop: ẩn hoàn toàn */
@media (min-width: 769px) {
  .dxd-bottom-nav,
  .dxd-more-overlay,
  .dxd-more-sheet {
    display: none !important;
  }
}
