/* MaxTopDeals custom styles (deal cards, coupon codes, live search) */

/* ---------- Deal grid ---------- */
.deal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 12px;
}
@media (min-width: 768px) {
  .deal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 20px; }
}
@media (min-width: 1150px) {
  .deal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 30px; }
}

/* ---------- Deal card ---------- */
.deal-card { display: flex; flex-direction: column; min-width: 0; }
.deal-card .card-product-wrapper { position: relative; }
.deal-card .product-img {
  display: block;
  aspect-ratio: 720 / 1005;
  border: 1px solid rgba(75, 75, 75, 0.3);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.deal-card .product-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  background: #fff;
  transition: opacity .35s ease, transform .5s ease;
}
/* Hover: keep the photo visible and still (no zoom). If a second photo exists, crossfade to it. */
.deal-card .card-product-wrapper .product-img img,
.deal-card .card-product-wrapper:hover .product-img img { transform: none !important; }
.deal-card .card-product-wrapper:hover .product-img .img-product { opacity: 1; }
.deal-card .product-img .img-hover { opacity: 0; }
@media (hover: hover) {
  .deal-card .card-product-wrapper:hover .product-img.has-hover .img-product { opacity: 0; }
  .deal-card .card-product-wrapper:hover .product-img.has-hover .img-hover { opacity: 1; }
}
.deal-card.is-unavailable .product-img img { opacity: .55; }

.deal-badges { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.deal-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  background: var(--primary);
}
.deal-badge-drop { background: #0b7a3e; }

.deal-card .card-product-info { padding-top: 12px; gap: 6px; display: flex; flex-direction: column; }
.deal-card .card-product-info .title {
  font-size: 16px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.deal-card .card-product-info .price { font-size: 15px; font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.deal-card .card-product-info .price del { font-weight: 700; color: var(--main); }
.deal-card .deal-sale-price { font-size: 16px; }
.deal-card .deal-price-check { font-weight: 600; color: var(--text); font-size: 14px; }
.deal-asof { font-size: 11px; line-height: 1.3; color: var(--text-2); cursor: help; }

.deal-coupon { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.deal-coupon .text-to-copy {
  font-family: inherit;
  font-size: 15px;
  color: var(--main);
  letter-spacing: .02em;
  word-break: break-all;
  background: none;
  padding: 0;
}
.copy-btn {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1.5px solid #6b6b6b;
  border-radius: 4px;
  background: #efefef;
  color: var(--main);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.copy-btn:hover { background: var(--main); color: #fff; border-color: var(--main); }
.copy-btn.is-copied { background: #E12E78; border-color: #E12E78; color: #fff; }

@media (max-width: 575px) {
  .deal-card .card-product-info .title { font-size: 14px; }
  .deal-card .card-product-info .price { font-size: 14px; }
  .deal-coupon .text-to-copy { font-size: 13px; }
  .copy-btn { font-size: 14px; }
}

.deal-empty { text-align: center; padding: 48px 16px; color: var(--text); }
.deal-empty p { margin-bottom: 20px; }
.deal-result-count { color: var(--text); margin: 20px 0; }

.deal-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 40px; }
.deal-pagination a {
  min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 4px;
}
.deal-pagination a.active { background: var(--main); color: #fff; border-color: var(--main); }

.flat-title h1.title { margin: 0; font-weight: inherit; color: inherit; letter-spacing: inherit; }
.tf-page-title h1.heading { margin: 0; }

.legal-content h6 { margin: 18px 0 8px; }
.legal-content ul { list-style: disc; padding-left: 22px; margin-bottom: 12px; }
.legal-content p { margin-bottom: 10px; }

.price-disclaimer { font-size: 12px; opacity: .75; max-width: 640px; }

/* ---------- Search ---------- */
.canvas-search .tf-search-head { padding-top: env(safe-area-inset-top); }
@media (max-width: 767px) {
  .canvas-search { padding-top: 24px; }
  .canvas-search .tf-search-head .title { font-size: 22px; margin-bottom: 14px; }
}
.search-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 8px; }
.search-chips a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  background: #fff;
}
.search-chips a:hover, .search-chips a.is-active { border-color: var(--main); }
.search-chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }

.search-suggestions { padding-bottom: 16px; }
.search-suggestions.is-loading { opacity: .6; }
.suggest-group-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 4px 0 10px; }
.suggest-list { list-style: none; padding: 0; margin: 0 0 12px; }
.suggest-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
  margin: 0 -8px;
  border-radius: 6px;
  color: var(--main);
}
.suggest-item:hover, .suggest-item.is-active { background: var(--bg-11); }
.suggest-img { flex: 0 0 56px; width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 4px; background: #fff; overflow: hidden; }
.suggest-img img { width: 100%; height: 100%; object-fit: contain; }
.suggest-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.suggest-title { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.suggest-title mark, .search-chips mark, .suggest-code mark { background: #fff3a3; padding: 0; color: inherit; }
.suggest-price { font-size: 13px; }
.suggest-price del { color: var(--text-2); }
.suggest-code { display: inline-block; margin-left: 4px; padding: 0 6px; border: 1px dashed var(--text-2); border-radius: 3px; font-size: 12px; }
.suggest-all { display: block; padding: 10px 0; font-weight: 600; text-decoration: underline; }
.suggest-all.is-active { background: var(--bg-11); }
.suggest-option.is-active { outline: none; }
.suggest-empty { color: var(--text); padding: 8px 0; }

.deal-search-page { max-width: 640px; margin: 0 auto; position: relative; }
.deal-search-page input { height: 50px; border-radius: 4px; }
.search-suggestions-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
  padding: 12px 16px;
}
.mb-search { margin: 0 0 16px; }

/* Keep content clear of the mobile bottom toolbar */
@media (max-width: 1149px) {
  #footer { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* ---------- Homepage filter ---------- */
.deal-filter { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 28px; }
.filter-group {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin: 0 -15px; padding: 2px 15px;
}
.filter-group::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .filter-group { flex-wrap: wrap; justify-content: center; overflow: visible; margin: 0; padding: 0; } }
.filter-chip { position: relative; flex: none; cursor: pointer; margin: 0; }
.filter-chip input { position: absolute; opacity: 0; pointer-events: none; }
.filter-chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; font-size: 14px; font-weight: 500; white-space: nowrap; transition: border-color .15s, background-color .15s, color .15s;
}
.filter-chip:hover span { border-color: var(--main); }
.filter-chip input:checked + span { background: var(--main); border-color: var(--main); color: #fff; }
.filter-chip input:focus-visible + span { outline: 2px solid var(--main); outline-offset: 2px; }
.filter-check span::before { content: ""; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; margin-right: 8px; }
.filter-check input:checked + span::before { background: #fff; box-shadow: inset 0 0 0 3px var(--main); border-color: #fff; }
.filter-bottom { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; }
.filter-sort { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.filter-sort select {
  min-height: 40px; padding: 6px 34px 6px 14px; border: 1px solid var(--line); border-radius: 999px; background-color: #fff; font-size: 14px;
  -webkit-appearance: none; appearance: none; width: auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23000' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.filter-reset { font-size: 14px; text-decoration: underline; }
.deal-results { transition: opacity .2s; min-height: 200px; }
.deal-results.is-loading { opacity: .45; pointer-events: none; }

/* Heart visit counter: let the badge grow with bigger numbers */
.tf-toolbar-bottom .toolbar-item a .toolbar-icon .toolbar-count {
  width: auto; min-width: 18px; padding: 0 5px; border-radius: 999px; right: auto; left: 60%; white-space: nowrap;
}
#header .nav-icon .count-box { overflow: visible; }

/* Scrolling strip links */
.tf-marquee .marquee-link { display: block; color: inherit; text-decoration: none; }
.tf-marquee .marquee-link:hover .text { text-decoration: underline; text-underline-offset: 3px; }
/* Scroll the full list: the strip is as wide as all texts (repeated twice), and moves exactly one copy. */
.mtd-marquee .wrap-marquee {
  width: max-content;
  -webkit-animation: mtd-marquee var(--marquee-duration, 40s) linear infinite;
  animation: mtd-marquee var(--marquee-duration, 40s) linear infinite;
}
.mtd-marquee .wrap-marquee:hover,
.mtd-marquee .wrap-marquee:active { animation-play-state: paused; }
@keyframes mtd-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .mtd-marquee .wrap-marquee { animation-duration: calc(var(--marquee-duration, 40s) * 2); }
}

/* Mobile bottom bar: equal columns, icons on one line, labels on one line */
.tf-toolbar-bottom { padding: 0 4px env(safe-area-inset-bottom); overflow-x: hidden; }
.tf-toolbar-bottom .toolbar-item { flex: 1 1 0; min-width: 0; }
.tf-toolbar-bottom .toolbar-item a {
  height: 64px; padding: 12px 2px 0; gap: 8px; justify-content: flex-start;
}
.tf-toolbar-bottom .toolbar-item a .toolbar-icon {
  height: 22px; width: 22px; display: flex; align-items: center; justify-content: center; flex: none;
}
.tf-toolbar-bottom .toolbar-item a .toolbar-icon i { font-size: 20px; line-height: 1; }
.tf-toolbar-bottom .toolbar-item a .toolbar-label {
  display: block; max-width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 11px; line-height: 14px;
}
@media (max-width: 359px) {
  .tf-toolbar-bottom .toolbar-item a .toolbar-label { font-size: 10px; }
}
