/**
 * Mobile bottom bar – theme colors, stylish icons. Visible only ≤768px.
 */
.bg-mobile-bar {
  --bg-bar-accent: #c8ff00;
  --bg-bar-bg: #fff;
  --bg-bar-border: #e8e8e8;
  --bg-bar-text: #111;
  --bg-bar-muted: #666;
}

@media (min-width: 769px) {
  .bg-mobile-bar {
    display: none !important;
  }
}

@media (max-width: 768px) {
  body.bg-has-mobile-bar {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0));
  }

  .bg-mobile-bar {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99990;
    background: var(--bg-bar-bg);
    border-top: 1px solid var(--bg-bar-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bg-mobile-bar__nav {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    min-height: 56px;
    padding: 6px 0 8px;
  }

  .bg-mobile-bar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    text-decoration: none;
    color: var(--bg-bar-text);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
    min-width: 0;
  }

  .bg-mobile-bar__item:hover,
  .bg-mobile-bar__item:focus {
    color: #7fb23b;
    outline: none;
  }

  .bg-mobile-bar__item--menu:hover,
  .bg-mobile-bar__item--menu:focus,
  .bg-mobile-bar__item.active {
    color: var(--bg-bar-accent);
  }

  .bg-mobile-bar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
  }

  .bg-mobile-bar__icon svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .bg-mobile-bar__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .bg-mobile-bar__item--cart {
    position: relative;
  }

  .bg-mobile-bar__badge {
    position: absolute;
    top: 2px;
    right: 50%;
    margin-right: -18px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-bar-accent);
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1;
  }

  /* Drawer */
  .bg-mobile-bar__drawer {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0.25s ease;
  }

  .bg-mobile-bar__drawer.is-open {
    pointer-events: auto;
    visibility: visible;
  }

  .bg-mobile-bar__drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .bg-mobile-bar__drawer.is-open .bg-mobile-bar__drawer-backdrop {
    opacity: 1;
  }

  .bg-mobile-bar__drawer-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 75vh;
    background: var(--bg-bar-bg);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bg-mobile-bar__drawer.is-open .bg-mobile-bar__drawer-panel {
    transform: translateY(0);
  }

  .bg-mobile-bar__drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-bar-border);
  }

  .bg-mobile-bar__drawer-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--bg-bar-text);
  }

  .bg-mobile-bar__drawer-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--bg-bar-muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 8px;
  }

  .bg-mobile-bar__drawer-close:hover {
    color: var(--bg-bar-text);
    background: rgba(0, 0, 0, 0.05);
  }

  .bg-mobile-bar__drawer-content {
    overflow-y: auto;
    max-height: calc(75vh - 60px);
    padding: 12px 0;
  }

  .bg-mobile-bar__menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .bg-mobile-bar__menu-list li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

  .bg-mobile-bar__menu-list a {
    display: block;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--bg-bar-text);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
  }

  .bg-mobile-bar__menu-list a:hover {
    background: rgba(127, 178, 59, 0.08);
    color: #7fb23b;
  }
}
