/* ===== TripTea — Хіти продажів block ====================================== */

.tt-bestsellers {
  background: #FFFFFF;
  padding: 24px 0 32px;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "case", "cpsp";
  color: #2B2B2B;
}

/* Match other home blocks: 1704 wide on desktop, full viewport on smaller */
.tt-bestsellers--breakout {
  position: relative;
  width: min(1704px, 100vw);
  max-width: 100vw;
  left: 50%;
  transform: translateX(-50%);
}

.tt-bestsellers *,
.tt-bestsellers *::before,
.tt-bestsellers *::after {
  box-sizing: border-box;
}

.tt-bestsellers__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 24px;
  padding: 0;
}

.tt-bestsellers__title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 28px;
  line-height: 120%;
  margin: 0;
  color: #4A3426;
}

.tt-bestsellers__nav {
  display: flex;
  gap: 8px;
}

.tt-bestsellers__nav--bottom {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
}

.tt-bestsellers__dots {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-start;
  margin-right: auto;
}

.tt-bestsellers__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E7D7C8;
  cursor: pointer;
  transition: background-color 0.2s ease, width 0.2s ease;
}

.tt-bestsellers__dot:hover {
  background: #B7A695;
}

.tt-bestsellers__dot--active {
  background: #8B5E3C;
  width: 24px;
  border-radius: 4px;
}

/* Default = active state per Figma (next): outline brown 1px, transparent bg */
.tt-bestsellers__nav-btn {
  width: 56px;
  height: 56px;
  border: 1px solid #4A3426;
  border-radius: 16px;
  background: transparent;
  color: #4A3426;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.tt-bestsellers__nav-btn:hover {
  background: #FAF7F2;
}

/* Disabled state per Figma (prev when at start, next when at end):
   light beige fill, lighter border, sand-coloured icon, 0.4 alpha */
.tt-bestsellers__nav-btn--disabled,
.tt-bestsellers__nav-btn:disabled {
  background: #FAF7F2;
  border-color: #F5EFE7;
  color: #E7D7C8;
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.tt-bestsellers__viewport {
  position: relative;
}

.tt-bestsellers__strip {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 8px;
  /* keep card shadow visible above the scrollbar area */
}

.tt-bestsellers__fade {
  position: absolute;
  top: 0;
  bottom: 8px; /* match scroll padding */
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.tt-bestsellers__fade--right {
  right: 0;
  width: 108px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
}

.tt-bestsellers__fade--hidden {
  opacity: 0;
}

.tt-bestsellers__strip::-webkit-scrollbar { display: none; }

.tt-bestsellers__strip > .tt-product-card {
  flex: 0 0 calc((100% - 4 * 24px) / 5);
  scroll-snap-align: start;
}

.tt-bestsellers__nav-btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== Card ============================================================== */

.tt-product-card {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #EAEAEA;
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(63, 28, 4, 0.16);
  overflow: hidden;
  font-family: 'Poppins', sans-serif;
  color: #2B2B2B;
  height: 100%;
  isolation: isolate;
}

.tt-product-card__media {
  position: relative;
  display: block;
  height: 270px;
  background-color: #FAF7F2;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid #EAEAEA;
  text-decoration: none;
  padding: 16px;
}

.tt-product-card__badge {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 150%;
  white-space: nowrap;
}

.tt-product-card__badge--popular {
  background: #E7D7C8;
  color: #8B5E3C;
}

.tt-product-card__badge--new {
  background: #8B5E3C;
  color: #FAF7F2;
}

.tt-product-card__badge--triptea_choice {
  background: #2B2B2B;
  color: #FAF7F2;
}

.tt-product-card__heart {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  padding: 0;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tt-product-card__heart:hover {
  color: #FAF7F2;
}

.tt-product-card__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  flex: 1;
}

.tt-product-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tt-product-card__sku {
  font-size: 12px;
  font-weight: 400;
  line-height: 140%;
  color: #4A3426;
}

.tt-product-card__stock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 140%;
}

.tt-product-card__stock--in_stock {
  color: #4A3426;
}

/* Tea Brown circle-check matches Figma */
.tt-product-card__stock--in_stock svg {
  color: #8B5E3C;
}

.tt-product-card__stock--pre_order,
.tt-product-card__stock--out_of_stock {
  color: #6B6B6B;
  opacity: 0.5;
}

.tt-product-card__stock--pre_order svg,
.tt-product-card__stock--out_of_stock svg {
  color: #6B6B6B;
}

.tt-product-card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 140%;
  color: #8B5E3C;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(16px * 1.4 * 2);
}

.tt-product-card__title a {
  color: inherit;
  text-decoration: none;
}

.tt-product-card__title a:hover {
  text-decoration: underline;
}

.tt-product-card__gramming {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.tt-product-card__gramming::-webkit-scrollbar { display: none; }

.tt-product-card__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  min-width: 40px;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  background: #FFFFFF;
  color: #6B6B6B;
  font-size: 14px;
  font-weight: 700;
  line-height: 140%;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.tt-product-card__chip:hover {
  border-color: #8B5E3C;
  color: #8B5E3C;
}

.tt-product-card__chip--active {
  background: #F5EFE7;
  border-color: #8B5E3C;
  color: #8B5E3C;
}

.tt-product-card__price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tt-product-card__price {
  font-size: 22px;
  font-weight: 700;
  line-height: 130%;
  color: #2B2B2B;
}

.tt-product-card__rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tt-product-card__cart-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
}

.tt-product-card__counter {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  flex: 1;
  max-width: 50%;
}

.tt-product-card__counter-btn {
  flex: 0 0 36px;
  height: 100%;
  border: none;
  background: transparent;
  color: #4A3426;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tt-product-card__counter-btn:hover {
  color: #8B5E3C;
}

.tt-product-card__counter-input {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 150%;
  color: #4A3426;
  width: 32px;
  padding: 0;
  outline: none;
}

.tt-product-card__cart {
  flex: 0 0 56px;
  height: 48px;
  border: none;
  border-radius: 8px;
  background: #8B5E3C;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.tt-product-card__cart:hover {
  background: #6B4528;
}

.tt-product-card__cart:disabled {
  background: #EAEAEA;
  color: #FFFFFF;
  cursor: not-allowed;
}

/* ===== Disabled state — pre-order / out of stock ========================== */

.tt-product-card--disabled .tt-product-card__media {
  filter: grayscale(1);
}

.tt-product-card--disabled .tt-product-card__title {
  color: #6B6B6B;
}

.tt-product-card--disabled .tt-product-card__price {
  color: #6B6B6B;
}

.tt-product-card--disabled .tt-product-card__rating svg path {
  fill: none !important;
  stroke: #B7A695 !important;
}

/* ===== Responsive ========================================================= */

@media (max-width: 1720px) {
  .tt-bestsellers__head {
    padding: 0 16px;
  }
  .tt-bestsellers__strip {
    padding: 0 16px 8px;
  }
}

/* On viewports below the desktop hero we step the visible cards down */
@media (max-width: 1300px) {
  .tt-bestsellers__strip > .tt-product-card {
    flex: 0 0 calc((100% - 3 * 24px) / 4);
  }
}

@media (max-width: 992px) {
  .tt-bestsellers__strip > .tt-product-card {
    flex: 0 0 calc((100% - 2 * 20px) / 3);
  }
  .tt-bestsellers__strip { gap: 20px; }
}

/* ===== Mobile (Figma frame 744:49772 — Хіти продажів) =================== */
@media (max-width: 768px) {
  .tt-bestsellers--breakout {
    width: 100vw;
    max-width: 100vw;
  }
  .tt-bestsellers {
    padding: 24px 0 24px;
  }

  /* Title 28px Dark Tea per Figma H3, no top-arrows */
  .tt-bestsellers__head {
    margin-bottom: 24px;
    padding: 0 24px;
  }
  .tt-bestsellers__title {
    font-size: 28px;
    line-height: 120%;
    color: #4A3426;
  }
  .tt-bestsellers__nav--top {
    display: none;
  }
  .tt-bestsellers__nav--bottom {
    display: flex;
    padding: 0 24px;
    margin-top: 24px;
  }
  .tt-bestsellers__nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  /* No fade on mobile — design uses dots/arrows instead */
  .tt-bestsellers__fade {
    display: none;
  }

  /* 320px fixed cards, gap 16, viewport-edge padding 24 */
  .tt-bestsellers__strip {
    gap: 16px;
    padding: 0 24px 8px;
    /* allow last card to scroll past with the right gap restored */
    scroll-padding: 0 24px;
  }
  .tt-bestsellers__strip > .tt-product-card {
    flex: 0 0 320px;
  }

  .tt-product-card__media {
    height: 270px;
  }
  .tt-product-card__title {
    font-size: 16px;
    line-height: 140%;
  }
  .tt-product-card__price {
    font-size: 22px;
    line-height: 130%;
  }
}

/* On very narrow phones (<360) keep card slightly wider than viewport so it reads as scrollable */
@media (max-width: 359px) {
  .tt-bestsellers__strip > .tt-product-card {
    flex: 0 0 280px;
  }
}
