/* =========================================================
   MSB – msb_product_group (Desktop + Mobile polish per UI)
   - Product title: 18px
   - Subtitle/bullets: 16px
   - CTA buttons: 16px
   - Compare icon: support SVG/PNG via <img>
   ========================================================= */

.msb-product-group {
  max-width: 1366px;
  margin: 0 auto;
  padding: 10px 24px 24px; 
}

@media (max-width: 1280px) {
  .msb-product-group {
    padding: 10px 24px 24px;
  }
}

@media (max-width: 1024px) {
  .msb-product-group {
    padding: 10px 20px 24px;
  }
}

@media (max-width: 768px) {
  .msb-product-group {
    padding: 10px 16px 20px;
  }
}

@media (max-width: 480px) {
  .msb-product-group {
    padding: 8px 12px 16px;
  }
}

.msb-product-group__title {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  color: #1f2a37;
}

.msb-product-group__empty {
  padding: 14px;
  border: 1px dashed rgba(0, 0, 0, .25);
  border-radius: 12px;
  background: #fff;
  color: rgba(0, 0, 0, .65);
}

/* Grid */
.msb-product-group__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

/* =========================================================
   MSB Product Group – Align CTA to bottom & equal height cards per row
   ========================================================= */

/* 1) Ensure grid items stretch to the same row height */
.msb-product-group__grid {
  align-items: stretch;
  /* make all grid items in the row same height */
}

/* 2) Make card a column flex container and fill the grid cell height */
.msb-product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 3) Let body take remaining space so actions can stick to bottom */
.msb-product-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  /* fill available height inside card */
  min-height: 0;
  /* prevent overflow issues in flex children */
}

/* 4) Push CTA row to the bottom regardless of bullet length */
.msb-product-card__actions {
  margin-top: auto;
  /* key: keeps CTA at the bottom */
}

@media (max-width: 991px) {
  .msb-product-group__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575px) {
  .msb-product-group__grid {
    grid-template-columns: 1fr;
  }
}

/* Card */
.msb-product-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(31, 42, 55, 0.10);
  box-shadow: 0 6px 18px rgba(31, 42, 55, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.msb-product-card.is-hidden {
  display: none;
}

/* Slide-in animation khi xem thêm */
@keyframes msb-card-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide-out animation khi rút gọn */
@keyframes msb-card-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(18px);
  }
}

.msb-product-card.is-animating-in {
  animation: msb-card-in 320ms ease forwards;
}

.msb-product-card.is-animating-out {
  animation: msb-card-out 220ms ease forwards;
  pointer-events: none;
}

.msb-product-card:hover {
  border-color: #ff6a00;
  box-shadow: 0 14px 34px rgba(31, 42, 55, 0.14);
  transform: translateY(-2px);
}

/* Thumb */
.msb-product-card__thumb {
  display: block;
  background: #fff;
  overflow: hidden;
  position: relative;
}

.msb-product-card__thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  transform: scale(1);
  transition: transform 220ms ease;
  will-change: transform;
}

.msb-product-card:hover .msb-product-card__thumb img {
  transform: scale(1.06);
}

.msb-product-card__thumb--placeholder {
  height: 170px;
}

.msb-product-card__body {
  padding: 14px 14px 16px;
}

/* Name */
.msb-product-card__name {
  margin: 0 0 10px;
  font-size: 18px;
  /* per UI */
  line-height: 1.25;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.1px;
}

.msb-product-card__name a {
  color: inherit;
  text-decoration: none;
  font-size: 18px;
}

/* Features */
.msb-product-card__features {
  margin: 0 0 14px;
  padding-left: 18px;
  color: #334155;
  font-size: 16px;
  /* per UI */
  line-height: 1.5;
  font-weight: 400;
}

.msb-product-card__features li {
  margin: 6px 0;
}

/* Actions row */
.msb-product-card__actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
}

/* Primary button pushes right */
.msb-product-card__actions .msb-btn--primary {
  flex: 0 0 50%;
}

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.msb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 16px;
  /* per UI */
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

/* Compare button */
.msb-btn--ghost {
  border-color: transparent;
  background: transparent;
  padding: 0;
  height: 44px;
  color: #F4600C;
  font-weight: 500;
  gap: 10px;
  text-transform: unset;
}

/* NEW: Icon as <img> (supports SVG/PNG) */
.msb-btn__icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  object-fit: contain;
}

/* Compare hover -> orange */
.msb-btn--ghost:hover {
  color: #ff6a00;
}

/* Primary button */
.msb-btn--primary {
  min-width: 150px;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  background: linear-gradient(324.32deg, #E45F35 20.9%, #FFA95A 110.29%);
  border-color: transparent;
  color: #fff;
  font-weight: 500;
  min-width: 50%;
  transition: .4s all;
}

.msb-btn--primary:hover {
  background: #E45F35;
  color: #fff;
}

/* =========================================================
   MSB Product Group – Xem thêm (final UI)
   - Orange caret
   - Two horizontal orange lines
   ========================================================= */

.msb-product-group__more {
  position: relative;
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

/* two orange lines – center perfectly */
.msb-product-group__more::before,
.msb-product-group__more::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 1px;
  background: rgba(255, 106, 0, 0.35);
}

/* left line */
.msb-product-group__more::before {
  left: 0;
  right: 50%;
  margin-right: 86px;
  /* half of button visual width */
}

/* right line */
.msb-product-group__more::after {
  left: 50%;
  right: 0;
  margin-left: 82px;
  /* half of button visual width */
}

/* button itself */
.msb-more-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1.5px solid #ff6a00;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #ff6a00;
  transition: background-color 160ms ease, box-shadow 160ms ease;
  left: 6px;
  top: 6px;
  text-transform: none;
}

/* icon upload – img tag */
.msb-more-btn__icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  object-fit: contain;
  flex-shrink: 0;
}

/* hover */
.msb-more-btn:hover {
  background: #fff4ec;
  box-shadow: 0 4px 12px rgba(255, 106, 0, 0.18);
}

/* mobile tweak */
@media (max-width: 575px) {

  .msb-product-group__more::before,
  .msb-product-group__more::after {
    width: calc(50% - 80px);
  }
}

/* =========================================================
   MSB Product Card – Tag badge (position + style like UI)
   ========================================================= */

.msb-product-card__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 12px;
  position: relative;
}

.msb-tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f6e7bf;
  /* light yellow */
  color: #1f2a37;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: filter 160ms ease, transform 120ms ease;
}

.msb-tag:hover {
  filter: brightness(0.98);
}

.msb-tag:active {
  transform: translateY(1px);
}

.msb-tag:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.18);
}

/* Optional: keep same look for m-first */
.msb-tag--mfirst {
  background: #f6e7bf;
  color: #1f2a37;
}

@media (prefers-reduced-motion: reduce) {

  .msb-product-card,
  .msb-product-card__thumb img,
  .msb-btn {
    transition: none;
  }

  .msb-product-card:hover {
    transform: none;
  }
}

/* Mobile fine-tuning */
@media (max-width: 575px) {
  .msb-product-card__body {
    padding: 14px 14px 16px;
  }

  .msb-product-card__name {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .msb-product-card__features {
    font-size: 16px;
    margin-bottom: 14px;
  }

  .msb-product-card__actions {
    gap: 12px;
  }

  .msb-btn--primary {
    min-width: 140px;
  }
}

/* =========================================================
   Compare Button Active State
   ========================================================= */
.msb-compare-btn__icon-success {
  display: none;
}

.msb-compare-btn.is-added {
  color: #9ca3af;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  padding: 0 16px;
  cursor: default;
  pointer-events: none;
  gap: 10px;
}

.msb-compare-btn.is-added:hover {
  color: #9ca3af;
}

/* =========================================================
   Compare Popup
   ========================================================= */
.msb-compare-popup {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.msb-compare-popup.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.msb-compare-popup__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px;
  background: #1D293999;
  border-radius: 16px;
  box-shadow: 0px 8px 20px 0px #1D29393D;
  backdrop-filter: blur(16px);
  border: 1px solid #8993A4;
}

.msb-compare-popup__header {
  flex-shrink: 0;
}

.msb-compare-popup__title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msb-compare-popup__title-text {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.msb-compare-popup__subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

.msb-compare-popup__products {
  display: flex;
  gap: 16px;
}

.msb-compare-popup__product {
  position: relative;
  width: 120px;
  text-align: center;
}

.msb-compare-popup__product.is-filled .msb-compare-popup__product-thumb {
  width: 128px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto;
}

.msb-compare-popup__product.is-filled .msb-compare-popup__product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msb-product-card__actions .msb-compare-btn {
  margin: 0;
  flex: 1;
  border: 1px solid transparent;
  transition: .4s all;
}

.msb-product-card__actions .msb-compare-btn:hover{
  border-color: #F4600C;
}

.msb-compare-popup__actions button {
  margin: 0 !important;
  text-transform: none !important;
  font-weight: 500;
}

.msb-compare-popup__product-title {
  margin-top: 8px;
  font-size: 14px;
  color: #fff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.msb-compare-popup__product-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
}

.msb-compare-popup__product-remove svg {
  display: block;
}

.msb-compare-popup__product-remove:hover svg circle {
  fill: #ef4444;
}

.msb-compare-popup__product.is-empty .msb-compare-popup__product-placeholder {
  width: 128px;
  height: 80px;
  border: 1px dashed #DEE5EF;
  border-radius: 12px;
  margin: 0 auto;
}

.msb-compare-popup__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.msb-compare-popup__btn {
  min-width: 100px;
  height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.msb-compare-popup__btn--cancel {
  background: #fff;
  color: #f4600c;
  border: 1px solid #f4600c;
}

.msb-compare-popup__btn--cancel:hover {
  background: #fff4ec;
}

.msb-compare-popup__btn--submit {
  background: linear-gradient(324.32deg, #E45F35 20.9%, #FFA95A 110.29%);
  color: #fff;
}

.msb-compare-popup__btn--submit:hover {
  opacity: 0.9;
}

.msb-compare-popup__btn--submit:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Toast notification */
.msb-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: #1f2a37;
  color: #fff;
  font-size: 14px;
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10000;
}

.msb-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Mobile responsive for popup */
@media (max-width: 768px) {
  .msb-compare-popup {
    bottom: 16px;
    left: 16px;
    right: 16px;
    transform: translateX(0) translateY(100%);
  }

  .msb-compare-popup.is-visible {
    transform: translateX(0) translateY(0);
  }

  .msb-compare-popup__inner {
    flex-wrap: wrap;
    padding: 16px;
    gap: 16px;
  }

  .msb-compare-popup__header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .msb-compare-popup__title {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .msb-compare-popup__products {
    width: 100%;
    justify-content: center;
    gap: 12px;
  }

  .msb-compare-popup__product {
    width: 90px;
  }

  .msb-compare-popup__product.is-filled .msb-compare-popup__product-thumb,
  .msb-compare-popup__product.is-empty .msb-compare-popup__product-placeholder {
    width: 80px;
    height: 56px;
  }

  .msb-compare-popup__product-title {
    font-size: 11px;
  }

  .msb-compare-popup__actions {
    width: 100%;
    flex-direction: row;
    justify-content: center;
  }

  .msb-compare-popup__btn {
    flex: 1;
    max-width: 140px;
  }

  .msb-product-group{
    padding: 0px 16px;
  }
  #col-related-products .msb-product-group{
    padding: 0;
  }
}