/* M2 ECO — Recently viewed popup (higher specificity vs m2_tools/style.css) */
#m2-groups #popup-recent.popup-recent .popup-small {
  max-width: 620px;
  width: calc(100vw - 32px);
  border-radius: 12px;
  overflow: hidden;
}

#m2-groups #popup-recent .popup-header {
  background: var(--m2-brand-ink, #05141F) !important;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px !important;
  border-radius: 0;
  position: relative;
}

#m2-groups #popup-recent .popup-header > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  flex: 1 1 auto;
  min-width: 0;
}

#m2-groups #popup-recent .popup-header .popup-close {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  margin: 0 !important;
  transform: none !important;
  color: #fff !important;
  opacity: 0.9;
  width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  border-radius: 8px;
  flex: 0 0 36px;
  font-size: 22px;
  font-weight: 400;
  text-decoration: none;
}

#m2-groups #popup-recent .popup-header .popup-close:hover {
  opacity: 1;
  background: rgba(85, 200, 232, 0.2);
}

#m2-groups #popup-recent .popup-content {
  max-height: min(70vh, 520px);
  padding: 16px !important;
  background: #f5f7f9;
}

#m2-groups #popup-recent .m2-recent-grid.row.space {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px;
  justify-content: center;
}

#m2-groups #popup-recent .m2-recent-grid .m2-recent-col,
#m2-groups #popup-recent .m2-recent-grid .col-sm-4 {
  float: none;
  clear: none !important;
  padding: 0 8px;
  margin-bottom: 16px;
  display: flex;
}

#m2-groups #popup-recent .form-content .form-box.m2-recent-card {
  width: 100%;
  margin-bottom: 0 !important;
  background: #fff;
  border: 1px solid #e8ecef;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(5, 20, 31, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#m2-groups #popup-recent .form-content .form-box.m2-recent-card:hover {
  border-color: rgba(85, 200, 232, 0.55);
  box-shadow: 0 6px 18px rgba(5, 20, 31, 0.08);
}

#m2-groups #popup-recent .form-content .form-box .product-thumb.m2-recent-thumb {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  text-align: center;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 0 10px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: #f8fafb;
  overflow: hidden;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .image a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

#m2-groups #popup-recent .m2-recent-badges {
  position: absolute;
  z-index: 4;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: space-between;
  pointer-events: none;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .image .bt-sale,
#m2-groups #popup-recent .form-content .form-box .product-thumb .image .bt-new {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-width: 0 !important;
  height: 22px !important;
  padding: 0 8px !important;
  border-radius: 999px !important;
  line-height: 22px !important;
  font-size: 11px !important;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .image .bt-sale {
  background-color: #e53935 !important;
  margin-inline-start: auto;
  order: 2;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .image .bt-new {
  background: var(--m2-brand-primary, #55C8E8) !important;
  color: var(--m2-brand-ink, #05141F) !important;
  order: 1;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .caption {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 2px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .caption h4 {
  margin: 0 0 0 !important;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .caption h4 a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 13px !important;
  line-height: 1.35;
  font-weight: 500 !important;
  color: var(--m2-brand-ink, #05141F) !important;
  text-transform: none !important;
  text-decoration: none !important;
  text-align: center;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .caption h4 a:hover {
  color: var(--m2-brand-primary, #55C8E8) !important;
  text-decoration: none !important;
}

#m2-groups #popup-recent .form-content .form-box .price {
  margin: 0 !important;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 6px 12px;
  line-height: 1.2;
  color: var(--m2-brand-ink, #05141F);
  font-size: 14px;
  font-weight: 700;
}

#m2-groups #popup-recent .form-content .form-box .price .price-new,
#m2-groups #popup-recent .form-content .form-box .price span.price {
  color: var(--m2-brand-ink, #05141F) !important;
  font-size: 14px !important;
  font-weight: 700;
}

#m2-groups #popup-recent .form-content .form-box .price .price-sale {
  color: #e53935 !important;
}

#m2-groups #popup-recent .form-content .form-box .price .price-old {
  padding: 0 !important;
  color: #9aa3ab !important;
  font-size: 12px !important;
  font-weight: 400;
  text-decoration: line-through;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .button-group {
  margin-top: 10px;
  border: 0;
  background: transparent;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .button-group button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100% !important;
  min-width: 0 !important;
  height: 40px !important;
  min-height: 40px;
  padding: 0 10px !important;
  border: 0;
  border-radius: 10px !important;
  background: var(--m2-brand-primary, #55C8E8) !important;
  color: var(--m2-brand-ink, #05141F) !important;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  float: none;
  text-transform: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .button-group button:hover {
  background: var(--m2-brand-ink, #05141F) !important;
  color: #fff !important;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .button-group button i {
  display: inline-block !important;
  font-size: 13px;
  line-height: 1;
}

#m2-groups #popup-recent .form-content .form-box .product-thumb .button-group button span {
  display: inline !important;
}

#m2-groups #popup-recent .m2-recent-empty {
  padding: 28px 12px;
  text-align: center;
  color: #6b7780;
  font-size: 14px;
}

@media (max-width: 575px) {
  #m2-groups #popup-recent.popup-recent .popup-small {
    max-width: 100%;
  }

  #m2-groups #popup-recent .m2-recent-grid .m2-recent-col.col-xs-6 {
    width: 50%;
  }

  #m2-groups #popup-recent .form-content .form-box .product-thumb .button-group button span {
    font-size: 11px;
  }
}
