/* =========================================================
   VYEDI MOBILE BOTTOM NAVIGATION
   + MOBILE DRAWER

   File:
   css/mobilebottomnav.css

   Desktop:
   Completely hidden.

   Mobile:
   Visible below 768px.

   This file controls ONLY:
   - Mobile bottom navigation
   - Mobile cart badge
   - Mobile drawer
   - Drawer overlay
   - Drawer links
   ========================================================= */

/* =========================================================
   DESKTOP
   ========================================================= */

.mobile-bottom-nav,
#vyediMobileDrawer {
  display: none;
}

/* =========================================================
   MOBILE ONLY
   ========================================================= */

@media (max-width: 768px) {
  /* =======================================================
     BODY SPACE
     Prevent bottom navigation from covering page content
     ======================================================= */

  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  /* =======================================================
     MOBILE BOTTOM NAVIGATION
     ======================================================= */

  .mobile-bottom-nav {
    position: fixed;

    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));

    width: auto;
    height: 66px;

    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: stretch;

    background: rgba(255, 255, 255, 0.97);

    border: 1px solid #eadfd2;
    border-radius: 18px;

    box-shadow:
      0 3px 12px rgba(67, 39, 20, 0.08),
      0 10px 30px rgba(67, 39, 20, 0.14);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    overflow: hidden;

    z-index: 99990;

    padding: 3px 3px env(safe-area-inset-bottom);

    box-sizing: border-box;

    isolation: isolate;
  }

  /* =======================================================
     EACH NAV ITEM
     ======================================================= */

  .mobile-bottom-item {
    position: relative;

    min-width: 0;
    min-height: 58px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 3px;

    padding: 5px 2px;

    border: 0;
    border-radius: 14px;

    background: transparent;

    color: #5f554d;

    font-family: "Segoe UI", Arial, sans-serif;

    text-decoration: none;

    cursor: pointer;

    -webkit-tap-highlight-color: transparent;

    touch-action: manipulation;

    transition:
      background 0.2s ease,
      color 0.2s ease,
      transform 0.18s ease;
  }

  /* =======================================================
     BUTTON RESET
     ======================================================= */

  button.mobile-bottom-item {
    appearance: none;
    -webkit-appearance: none;

    outline: none;

    font: inherit;
  }

  /* =======================================================
     ICON
     ======================================================= */

  .mobile-bottom-icon {
    width: 28px;
    height: 27px;

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 20px;
    line-height: 1;

    position: relative;

    transition:
      transform 0.2s ease,
      color 0.2s ease;
  }

  /* =======================================================
     LABEL
     ======================================================= */

  .mobile-bottom-item small {
    display: block;

    font-size: 9px;
    font-weight: 600;

    line-height: 1.1;

    white-space: nowrap;

    color: inherit;
  }

  /* =======================================================
     ACTIVE ITEM
     ======================================================= */

  .mobile-bottom-item.active {
    color: #a95727;

    background: #fff8ed;
  }

  .mobile-bottom-item.active .mobile-bottom-icon {
    transform: translateY(-1px);
  }

  /* =======================================================
     TAP EFFECT
     ======================================================= */

  .mobile-bottom-item:active {
    transform: scale(0.94);

    background: #f5eadc;
  }

  /* =======================================================
     CART ICON
     ======================================================= */

  .mobile-cart-icon {
    position: relative;
  }

  /* =======================================================
     CART COUNT
     ======================================================= */

  #mobileCartCount {
    position: absolute;

    top: -7px;
    right: -10px;

    min-width: 16px;
    height: 16px;

    padding: 0 4px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #9d4b24;

    color: #ffffff;

    border: 2px solid #ffffff;

    font-size: 10px;
    font-weight: 800;

    line-height: 1;

    box-sizing: border-box;

    transition: transform 0.25s ease;
  }

  #mobileCartCount.bump {
    transform: scale(1.3);
  }

  /* =======================================================
     MOBILE DRAWER CONTAINER
     ======================================================= */

  #vyediMobileDrawer {
    display: block;

    position: fixed;

    inset: 0;

    width: 100%;
    height: 100%;

    z-index: 100000;

    visibility: hidden;
    pointer-events: none;
  }

  /* =======================================================
     OPEN DRAWER
     ======================================================= */

  #vyediMobileDrawer.open {
    visibility: visible;
    pointer-events: auto;
  }

  /* =======================================================
     OVERLAY
     ======================================================= */

  .vyedi-mobile-overlay {
    position: absolute;

    inset: 0;

    background: rgba(30, 22, 17, 0.48);

    opacity: 0;

    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);

    transition: opacity 0.28s ease;
  }

  #vyediMobileDrawer.open .vyedi-mobile-overlay {
    opacity: 1;
  }

  /* =======================================================
     DRAWER PANEL
     ======================================================= */

  .vyedi-mobile-drawer {
    position: absolute;

    top: 0;
    right: 0;

    width: min(88vw, 360px);
    height: 100%;

    display: flex;
    flex-direction: column;

    overflow-y: auto;

    background: #fffaf3;

    box-shadow: -10px 0 40px rgba(43, 33, 27, 0.2);

    transform: translateX(105%);

    transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.25, 1);

    -webkit-overflow-scrolling: touch;

    box-sizing: border-box;
  }

  #vyediMobileDrawer.open .vyedi-mobile-drawer {
    transform: translateX(0);
  }

  /* =======================================================
     DRAWER HEADER
     ======================================================= */

  .vyedi-mobile-drawer-header {
    min-height: 76px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 12px 18px;

    background: #ffffff;

    border-bottom: 1px solid #eadfd2;

    box-sizing: border-box;
  }

  /* =======================================================
     DRAWER BRAND
     ======================================================= */

  .vyedi-mobile-drawer-brand {
    display: flex;

    align-items: center;

    gap: 10px;

    min-width: 0;
  }

  .vyedi-mobile-drawer-brand img {
    width: 60px;
    height: 60px;

    object-fit: contain;

    flex-shrink: 0;
  }

  .vyedi-mobile-drawer-brand strong {
    display: block;

    color: #8d481f;

    font-family: Georgia, serif;

    font-size: 22px;

    line-height: 1.1;
  }

  .vyedi-mobile-drawer-brand span {
    display: block;

    margin-top: 3px;

    color: #88776a;

    font-size: 9px;

    line-height: 1.2;
  }

  /* =======================================================
     CLOSE BUTTON
     ======================================================= */

  .vyedi-mobile-close {
    width: 40px;
    height: 40px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 8px;

    border: 1px solid #eadfd2;

    border-radius: 50%;

    background: #fffaf3;

    color: #40291f;

    cursor: pointer;

    transition:
      background 0.2s ease,
      transform 0.2s ease;
  }

  .vyedi-mobile-close:hover {
    background: #f5eadc;
  }

  .vyedi-mobile-close:active {
    transform: scale(0.92);
  }

  .vyedi-mobile-close svg {
    width: 100%;
    height: 100%;

    display: block;
  }

  /* =======================================================
     MENU TITLE
     ======================================================= */

  .vyedi-mobile-menu-title {
    margin: 18px;

    padding: 15px;

    border-radius: 14px;

    background: linear-gradient(135deg, #fff5df, #f8e4c2);

    display: flex;

    align-items: center;

    gap: 12px;

    box-sizing: border-box;
  }

  .vyedi-mobile-menu-title > span {
    width: 36px;
    height: 36px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #ffffff;

    color: #bd762e;

    font-size: 17px;
  }

  .vyedi-mobile-menu-title strong {
    display: block;

    color: #3b2921;

    font-size: 15px;

    line-height: 1.2;
  }

  .vyedi-mobile-menu-title small {
    display: block;

    margin-top: 3px;

    color: #927b68;

    font-size: 10px;

    line-height: 1.2;
  }

  /* =======================================================
     MAIN DRAWER NAVIGATION
     ======================================================= */

  .vyedi-mobile-nav {
    padding: 0 18px;

    box-sizing: border-box;
  }

  .vyedi-mobile-nav a {
    min-height: 56px;

    display: flex;

    align-items: center;

    gap: 13px;

    padding: 0 12px;

    color: #3f322b;

    text-decoration: none;

    border-bottom: 1px solid #eee3d8;

    font-size: 14px;
    font-weight: 600;

    box-sizing: border-box;

    transition:
      background 0.2s ease,
      padding-left 0.2s ease;
  }

  .vyedi-mobile-nav a:active {
    background: #f8eee3;

    padding-left: 16px;
  }

  /* =======================================================
     DRAWER NAV ICON
     ======================================================= */

  .vyedi-mobile-nav .mobile-nav-icon {
    width: 32px;
    height: 32px;

    min-width: 32px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #f9ead5;

    color: #8b6b3f;

    font-size: 16px;
  }

  /* =======================================================
     DRAWER ARROW
     ======================================================= */

  .vyedi-mobile-nav .mobile-nav-arrow {
    margin-left: auto;

    color: #b77a3d;

    font-size: 22px;

    line-height: 1;

    transition: transform 0.2s ease;
  }

  .vyedi-mobile-nav a:active .mobile-nav-arrow {
    transform: translateX(4px);
  }

  /* =======================================================
     QUICK ACCESS
     ======================================================= */

  .vyedi-mobile-quick {
    margin: 22px 18px 0;

    padding-top: 17px;

    border-top: 1px solid #eadfd2;
  }

  .vyedi-mobile-quick-title {
    margin-bottom: 8px;

    color: #9c582d;

    font-size: 11px;

    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: 0.08em;
  }

  .vyedi-mobile-quick a {
    min-height: 46px;

    display: flex;

    align-items: center;

    gap: 12px;

    color: #59483d;

    text-decoration: none;

    font-size: 13px;

    border-bottom: 1px solid #f0e8df;

    box-sizing: border-box;
  }

  .vyedi-mobile-quick a:active {
    background: #f8eee3;
  }

  .vyedi-mobile-quick a > span:first-child {
    width: 28px;

    min-width: 28px;

    display: flex;

    align-items: center;
    justify-content: center;

    text-align: center;
  }

  /* =======================================================
     DRAWER CART COUNT
     ======================================================= */

  .mobile-drawer-cart-count {
    margin-left: auto;

    min-width: 21px;
    height: 21px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0 4px;

    border-radius: 50%;

    background: #c89532;

    color: #ffffff;

    font-size: 10px;

    font-weight: 800;

    box-sizing: border-box;
  }

  /* =======================================================
     DRAWER FOOTER
     ======================================================= */

  .vyedi-mobile-drawer-footer {
    margin-top: auto;

    padding: 25px 20px 35px;

    text-align: center;

    color: #9a8878;

    font-size: 10px;

    line-height: 1.6;
  }

  .vyedi-mobile-drawer-footer span {
    color: #c89532;

    margin: 0 5px;
  }

  /* =======================================================
     PREVENT BODY SCROLL WHEN DRAWER IS OPEN
     ======================================================= */

  body.vyedi-menu-open {
    overflow: hidden;
  }

  /* =======================================================
     EXTRA SMALL PHONES
     ======================================================= */

  @media (max-width: 380px) {
    .mobile-bottom-nav {
      left: 5px;
      right: 5px;

      height: 62px;

      border-radius: 16px;
    }

    .mobile-bottom-item {
      min-height: 54px;

      padding: 4px 1px;
    }

    .mobile-bottom-icon {
      width: 25px;
      height: 24px;

      font-size: 18px;
    }

    .mobile-bottom-item small {
      font-size: 8px;
    }

    .vyedi-mobile-drawer {
      width: 92vw;
    }

    .vyedi-mobile-drawer-brand img {
      width: 54px;
      height: 54px;
    }

    .vyedi-mobile-drawer-brand strong {
      font-size: 20px;
    }
  }

  /* =======================================================
     REDUCED MOTION
     ======================================================= */

  @media (prefers-reduced-motion: reduce) {
    .mobile-bottom-item,
    .mobile-bottom-icon,
    .vyedi-mobile-drawer,
    .vyedi-mobile-overlay,
    .vyedi-mobile-close {
      transition: none !important;
    }
  }
}

/* =========================================================
   ABSOLUTE DESKTOP SAFETY
   ========================================================= */

@media (min-width: 769px) {
  .mobile-bottom-nav,
  #vyediMobileDrawer {
    display: none !important;
  }
}

/* =====================================================
   CART BADGE
   ===================================================== */

.vyedi-cart-item {
  position: relative;
}

.vyedi-cart-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vyedi-cart-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* Product count bubble */

.vyedi-mobile-cart-badge {
  position: absolute;

  top: -8px;
  right: -10px;

  min-width: 17px;
  height: 17px;

  padding: 0 4px;

  display: flex;
  align-items: center;
  justify-content: center;

  box-sizing: border-box;

  border-radius: 50%;

  background: #c9983e;
  color: #ffffff;

  border: 2px solid #ffffff;

  font-family: Arial, sans-serif;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;

  z-index: 10;
}

/* Bigger numbers */

.vyedi-mobile-cart-badge[data-count="10"],
.vyedi-mobile-cart-badge[data-count="11"],
.vyedi-mobile-cart-badge[data-count="12"] {
  border-radius: 10px;
  min-width: 21px;
}

/* Hide badge when cart is empty */

.vyedi-mobile-cart-badge.empty {
  display: none;
}

/* Small animation when quantity changes */

.vyedi-mobile-cart-badge.bump {
  animation: vyediCartBadgeBump 0.3s ease;
}

@keyframes vyediCartBadgeBump {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}
