/**
 * FBT Styles - Frequently Bought Together
 * YayBoost plugin. Minimal e-commerce styling (matches sample).
 */

/* ============================================
   Variables
   ============================================ */
:root {
  --fbt-black: #111111;
  --fbt-gray-900: #1a1a1a;
  --fbt-gray-600: #666666;
  --fbt-gray-400: #999999;
  --fbt-gray-200: #e5e5e5;
  --fbt-gray-100: #f5f5f5;
  --fbt-white: #ffffff;
  --fbt-green: #16a34a;
  --fbt-radius: 8px;
}

/* ============================================
   Section Container (scoped for theme safety)
   ============================================ */
.yayboost-fbt.fbt-section {
  padding: 32px 0;
  border-top: 1px solid var(--fbt-gray-200);
}

.yayboost-fbt .fbt-section__title,
.yayboost-fbt .yayboost-fbt__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fbt-black);
  margin: 0 0 24px 0;
  letter-spacing: -0.01em;
}

/* ============================================
   Products Display
   ============================================ */
.yayboost-fbt .fbt-products {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* Scrollable row: only product images + plus signs */
.yayboost-fbt .fbt-products-scroll {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--fbt-gray-400) transparent;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
}

.yayboost-fbt .fbt-products-scroll::-webkit-scrollbar {
  height: 6px;
}

.yayboost-fbt .fbt-products-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.yayboost-fbt .fbt-products-scroll::-webkit-scrollbar-thumb {
  background-color: var(--fbt-gray-400);
  border-radius: 3px;
}

.yayboost-fbt .fbt-products-scroll::-webkit-scrollbar-thumb:hover {
  background-color: var(--fbt-gray-600);
}

.yayboost-fbt .fbt-product-image {
  width: 100px;
  height: 100px;
  background: var(--fbt-gray-100);
  border-radius: var(--fbt-radius);
  overflow: hidden;
  flex-shrink: 0;
  min-width: 100px;
}

.yayboost-fbt .fbt-plus {
  flex-shrink: 0;
}

.yayboost-fbt .fbt-product-image a {
  display: block;
  width: 100%;
  height: 100%;
}

.yayboost-fbt .fbt-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

/* ============================================
   Summary Box
   ============================================ */
.yayboost-fbt .fbt-summary {
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
}

.yayboost-fbt .fbt-summary__total {
  font-size: 13px;
  color: var(--fbt-gray-600);
  margin: 0 0 4px 0;
}

.yayboost-fbt .fbt-summary__price,
.yayboost-fbt .yayboost-fbt__total-price {
  font-size: 22px;
  font-weight: 600;
  color: var(--fbt-black);
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

/* ============================================
   Add Button
   ============================================ */
.yayboost-fbt .fbt-add-btn,
.yayboost-fbt .yayboost-fbt__add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fbt-white);
  background: var(--fbt-black);
  border: none;
  border-radius: var(--fbt-radius);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.yayboost-fbt .fbt-add-btn:hover,
.yayboost-fbt .yayboost-fbt__add-btn:hover {
  opacity: 0.85;
}

.yayboost-fbt .fbt-add-btn:active,
.yayboost-fbt .yayboost-fbt__add-btn:active {
  opacity: 0.7;
}

.yayboost-fbt .fbt-add-btn:disabled,
.yayboost-fbt .yayboost-fbt__add-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================
   Product List
   ============================================ */
.yayboost-fbt .fbt-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.yayboost-fbt .fbt-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--fbt-gray-200);
  cursor: pointer;
  transition: background 0.15s ease;
  margin: 0;
}

.yayboost-fbt .fbt-item:first-child {
  border-top: 1px solid var(--fbt-gray-200);
}

.yayboost-fbt .fbt-item:hover {
  background: var(--fbt-gray-100);
}

/* ============================================
   Checkbox - Minimal Circle
   ============================================ */
.yayboost-fbt .fbt-checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.yayboost-fbt .fbt-checkbox input {
  position: absolute !important;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.yayboost-fbt .fbt-checkbox__box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--fbt-gray-400);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.yayboost-fbt .fbt-checkbox input:checked + .fbt-checkbox__box {
  background: var(--fbt-black);
  border-color: var(--fbt-black);
}

.yayboost-fbt .fbt-checkbox__icon {
  width: 10px;
  height: 10px;
  color: var(--fbt-white);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s ease;
}

.yayboost-fbt
  .fbt-checkbox
  input:checked
  + .fbt-checkbox__box
  .fbt-checkbox__icon {
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   Item Content
   ============================================ */
.yayboost-fbt .fbt-item__content {
  flex: 1;
  min-width: 0;
}

.yayboost-fbt .fbt-item__name {
  font-size: 14px;
  font-weight: 400;
  color: var(--fbt-black);
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.yayboost-fbt .fbt-item__name a {
  color: inherit;
  text-decoration: none;
}

.yayboost-fbt .fbt-item__name a:hover {
  text-decoration: underline;
}

.yayboost-fbt .fbt-item__badge {
  display: inline;
  font-size: 12px;
  font-weight: 500;
  color: var(--fbt-gray-600);
  margin-right: 6px;
}

.yayboost-fbt .fbt-item__price {
  font-size: 14px;
  font-weight: 500;
  color: var(--fbt-black);
}

.yayboost-fbt .fbt-item__price del {
  color: var(--fbt-gray-400);
  font-weight: 400;
  margin-right: 0.25em;
}

.yayboost-fbt .fbt-item__price ins {
  text-decoration: none;
}

.yayboost-fbt .fbt-item__stock {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
  display: block;
}

/* ============================================
   Info Note
   ============================================ */
.yayboost-fbt .fbt-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fbt-gray-600);
  margin-bottom: 16px;
}

.yayboost-fbt .fbt-info__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.yayboost-fbt .fbt-info a {
  color: var(--fbt-black);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  .yayboost-fbt .fbt-product-image {
    width: 72px;
    height: 72px;
    min-width: 72px;
  }

  .yayboost-fbt .fbt-summary {
    width: 100%;
    margin-left: auto;
    margin-top: 0;
    text-align: right;
    display: block;
    padding-left: 12px;
  }

  .yayboost-fbt .fbt-summary__price,
  .yayboost-fbt .yayboost-fbt__total-price {
    margin: 0;
    font-size: 20px;
  }

  .yayboost-fbt .fbt-summary .fbt-summary__total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .yayboost-fbt .fbt-add-btn,
  .yayboost-fbt .yayboost-fbt__add-btn {
    width: 100%;
  }

  .yayboost-fbt .fbt-item:hover {
    margin: 0;
    padding: 16px 0;
    background: transparent;
  }

  .yayboost-fbt .fbt-products {
    flex-direction: column;
  }

  .yayboost-fbt .fbt-products-scroll {
    width: 100%;
  }
}

/* ============================================
   Loading & Success States (sample + JS compat)
   ============================================ */
.yayboost-fbt .fbt-add-btn--loading,
.yayboost-fbt .yayboost-fbt__add-btn.is-loading {
  color: transparent;
  position: relative;
  pointer-events: none;
}

.yayboost-fbt .fbt-add-btn--loading::after,
.yayboost-fbt .yayboost-fbt__add-btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--fbt-white);
  border-top-color: transparent;
  border-radius: 50%;
  animation: fbt-spin 0.6s linear infinite;
}

@keyframes fbt-spin {
  to {
    transform: rotate(360deg);
  }
}

.yayboost-fbt .fbt-add-btn--success,
.yayboost-fbt .yayboost-fbt__add-btn.fbt-add-btn--success {
  background: var(--fbt-green);
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .yayboost-fbt * {
    transition: none !important;
    animation: none !important;
  }
}
