/* PDP mobile sticky bar: TOTAL + цена + cashback | корзина | чат (≤768px) */

@media (min-width: 769px) {
  #ec-pdp-mobile-buy-bar {
    display: none !important;
  }

  html.ec-pdp-mbb-active {
    padding-bottom: 0 !important;
  }
}

@media (max-width: 768px) {
  html.ec-pdp-mbb-active #product-product .ec-pdp-back-top {
    display: none !important;
  }

  html.ec-pdp-mbb-active:not(.ec-pdp-keycrm-unmask) [id^="keycrm-"],
  html.ec-pdp-mbb-active:not(.ec-pdp-keycrm-unmask) #keycrm-widget {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  html.ec-pdp-keycrm-unmask [id^="keycrm-"],
  html.ec-pdp-keycrm-unmask #keycrm-widget {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  html.ec-pdp-mbb-active {
    padding-bottom: calc(102px + env(safe-area-inset-bottom, 0px));
  }

  #ec-pdp-mobile-buy-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10060;
    box-sizing: border-box;
    padding: 0;
    background: #0f0f1e;
    border-top: 1px solid rgba(139, 92, 246, 0.28);
    box-shadow:
      0 -10px 36px rgba(0, 0, 0, 0.55),
      0 -1px 0 rgba(139, 92, 246, 0.12) inset;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease, visibility 0.22s ease;
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    -webkit-tap-highlight-color: transparent;
  }

  #ec-pdp-mobile-buy-bar .ec-pdp-mobile-buy-bar__glass {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(22, 19, 38, 0.97) 0%, rgba(15, 15, 30, 0.99) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: none;
  }

  #ec-pdp-mobile-buy-bar.ec-pdp-mobile-buy-bar--hidden {
    transform: translateY(110%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .ec-pdp-mobile-buy-bar__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
    padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    min-height: 56px;
  }

  .ec-pdp-mobile-buy-bar__price-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 0 1 auto;
    min-width: 68px;
    max-width: 36%;
    gap: 0;
  }

  .ec-pdp-mobile-buy-bar__label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .ec-pdp-mobile-buy-bar__price {
    margin-top: 2px;
    font-weight: 800;
    font-size: clamp(1.15rem, 4.8vw, 1.28rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #fff;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ec-pdp-mobile-buy-bar__cashback {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    color: #a78bfa;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ec-pdp-mobile-buy-bar__divider {
    width: 1px;
    height: 40px;
    flex-shrink: 0;
    align-self: center;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 1px;
  }

  .ec-pdp-mobile-buy-bar__cart {
    flex: 1 1 0;
    min-width: 0;
    border: none;
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
    background: #8b5cf6;
    color: #fff;
    box-shadow:
      0 4px 18px rgba(139, 92, 246, 0.45),
      0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    transition: filter 0.2s ease, transform 0.15s ease;
  }

  .ec-pdp-mobile-buy-bar__cart:active {
    filter: brightness(1.06);
    transform: scale(0.988);
  }

  .ec-pdp-mobile-buy-bar__cart-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 12px 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .ec-pdp-mobile-buy-bar__cart .fa-shopping-cart {
    font-size: 1rem;
    opacity: 0.95;
    flex-shrink: 0;
  }

  .ec-pdp-mobile-buy-bar__cart-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .ec-pdp-mobile-buy-bar__chat {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 14px;
    cursor: pointer;
    flex-shrink: 0;
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  }

  .ec-pdp-mobile-buy-bar__chat:active {
    transform: scale(0.97);
    background: rgba(139, 92, 246, 0.22);
  }

  .ec-pdp-mobile-buy-bar__chat-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: inherit;
  }

  .ec-pdp-mobile-buy-bar__chat-icon {
    font-size: 1.15rem;
    color: #c4b5fd;
  }
}
