/* ================================================================
   TitiArt - mobile sticky buy bar (price + one action)
   Used by: catalog/view/theme/default/template/product/product.twig
   Replaces the old floating "Персонализирай" pill.
   Bump the ?v= number in the <link> in product.twig after every edit.
   ================================================================ */

.titi-buybar {
  display: none;
}

@media (max-width: 991px) {
  .titi-buybar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    box-sizing: border-box;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fdf8ef;
    border-top: 1px solid #e6dcc6;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .10);
    transform: translateY(100%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
  }

  .titi-buybar.is-visible {
    transform: none;
    visibility: visible;
    transition: transform .22s ease, visibility 0s;
  }

  .titi-buybar__price {
    flex: 1 1 auto;
    min-width: 0;
    color: #333;
    line-height: 1.1;
    white-space: nowrap;
  }

  .titi-buybar__price strong {
    font-size: 20px;
    font-weight: 700;
  }

  .titi-buybar__from {
    margin-right: 2px;
    font-size: 13px;
    color: #666;
  }

  .titi-buybar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 170px;
    height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 23px;
    background: #5c8001;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
  }

  .titi-buybar__btn:hover,
  .titi-buybar__btn:focus {
    background: #4a6801;
    color: #fff;
    outline: none;
  }

  .titi-buybar__btn:focus-visible {
    box-shadow: 0 0 0 3px #c8e531;
  }

  .titi-buybar__btn:disabled {
    opacity: .65;
    cursor: default;
  }

  /* Viber button (fixed, 50x50) moves up while the bar is visible */
  body.titi-buybar-on .titi-viber-float {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    transition: bottom .22s ease;
  }

  body.lightbox-open .titi-buybar {
    display: none;
  }

  /* Field scrolled into view must not hide under the fixed header */
  #product .form-group {
    scroll-margin-top: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .titi-buybar,
  .titi-buybar.is-visible,
  body.titi-buybar-on .titi-viber-float {
    transition: none;
  }
}
