/*
Theme Name: Thanh Lý Đồ Cá Nhân
Theme URI: https://nuoigiang.io.vn
Author: Dev
Description: Theme thanh lý đồ cá nhân minh bạch độ mới, lỗi kỹ thuật, video và liên hệ Zalo.
Version: 1.0
*/
:root {
  --dur: 3s;
  --c-blue: #2563eb;
  --c-lime: #10b981;
  --c-coral: #f97316;
  --c-ink: #6366f1;
  --c-ghost: #e2e8f0;
}

/* ============================================================
   TYPOGRAPHY - Be Vietnam Pro (toàn site)
   ============================================================ */
html, body {
  font-family: 'Be Vietnam Pro', sans-serif;
}

body {
  line-height: 1.5; /* mặc định thoải mái cho mô tả tình trạng máy */
}

p, .tl-body-text, .thanhly-desc {
  line-height: 1.6;
}

/* Type scale — Mobile (mặc định) */
.thanhly-card-title { font-size: 14px; line-height: 1.45; }
.thanhly-price      { font-size: 16px; line-height: 1.3; }
.thanhly-badge-pct  { font-size: 11px; line-height: 1.3; }
.thanhly-page-title { font-size: 20px; line-height: 1.3; }
.thanhly-price-lg   { font-size: 22px; line-height: 1.25; } /* Giá lớn ở trang chi tiết sản phẩm */
.thanhly-cta         { font-size: 13px; }

/* Type scale — Desktop / Tablet lớn */
@media (min-width: 1024px) {
  .thanhly-card-title { font-size: 15px; }
  .thanhly-price      { font-size: 18px; }
  .thanhly-price-lg   { font-size: 26px; }
  .thanhly-page-title { font-size: 26px; }
  .thanhly-cta         { font-size: 15px; }
}

/* ============================================================
   DANH MỤC - Thanh trượt ngang có snap trên mobile
   ============================================================ */
.thanhly-cat-scroll {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  padding-bottom: 4px;
}
.thanhly-cat-scroll::-webkit-scrollbar { display: none; }
.thanhly-cat-scroll { -ms-overflow-style: none; scrollbar-width: none; }
.thanhly-cat-scroll > a {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 68px;
}
@media (min-width: 640px) {
  /* Từ tablet trở lên: chuyển sang lưới, bỏ trượt ngang */
  .thanhly-cat-scroll {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow-x: visible;
  }
  .thanhly-cat-scroll > a { width: auto; }
}
@media (min-width: 1024px) {
  .thanhly-cat-scroll { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

/* Icon danh mục dạng TRÒN (kiểu Chợ Tốt) */
.thanhly-cat-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  text-align: center;
}
.thanhly-cat-circle-icon {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: transform .15s ease;
  overflow: hidden;
}
.thanhly-cat-circle:hover .thanhly-cat-circle-icon { transform: translateY(-3px); }
.thanhly-cat-circle-icon img { width: 100%; height: 100%; object-fit: cover; }
.thanhly-cat-circle.is-active .thanhly-cat-circle-icon {
  box-shadow: 0 0 0 3px var(--tl-yellow, #ffba00);
}
.thanhly-cat-circle-name {
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thanhly-cat-circle-count {
  font-size: 10px;
  color: #94a3b8;
}

/* ============================================================
   STICKY BOTTOM ACTION BAR - Trang chi tiết sản phẩm (mobile)
   ============================================================ */
.thanhly-sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
}
@media (min-width: 1024px) {
  .thanhly-sticky-bar { display: none; } /* Desktop đã có cụm nút cố định ở cột phải */
}
.thanhly-sticky-bar a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  border-radius: 12px;
  padding: 12px 10px;
}
.thanhly-sticky-bar .thanhly-btn-zalo {
  background: #0068ff; /* xanh Zalo */
  color: #fff;
}
.thanhly-sticky-bar .thanhly-btn-telegram {
  background: #229ed9;
  color: #fff;
}
.thanhly-sticky-bar .thanhly-btn-call {
  background: #0f172a;
  color: #fff;
}
/* Đệm để nội dung cuối trang không bị thanh sticky che mất trên mobile */
.thanhly-has-sticky-bar { padding-bottom: 78px; }
@media (min-width: 1024px) {
  .thanhly-has-sticky-bar { padding-bottom: 0; }
}

/* ============================================================
   HEADER VÀNG CHỢ TỐT + THANH TÌM KIẾM
   ============================================================ */
:root {
  --tl-yellow: #ffba00;
  --tl-yellow-dark: #ffc200;
  --tl-red: #d0021b;
}
.thanhly-header {
  background: var(--tl-yellow);
}
.thanhly-searchbar {
  background: #fff;
  border-radius: 999px;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.thanhly-searchbar input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  min-width: 0;
  padding: 10px 4px 10px 14px;
  font-size: 13px;
}
.thanhly-searchbar button {
  background: #eb9a00;
  color: #1e293b;
  font-weight: 700;
  font-size: 12px;
  border-radius: 999px;
  padding: 9px 16px;
  margin: 3px;
  white-space: nowrap;
}
.thanhly-header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  position: relative;
  flex-shrink: 0;
}
.thanhly-header-icon-btn .thanhly-cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--tl-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* Ô gợi ý live search */
.thanhly-search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  overflow: hidden;
  z-index: 60;
  display: none;
}
.thanhly-search-suggest.is-open { display: block; }
.thanhly-search-suggest a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: #1e293b;
}
.thanhly-search-suggest a:hover { background: #fafafa; }
.thanhly-search-suggest img {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.thanhly-search-suggest .name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.thanhly-search-suggest .price { font-size: 11px; color: var(--tl-red); font-weight: 700; }

/* ============================================================
   TAB LỌC NHANH (Dành cho bạn / Mới nhất / Video)
   ============================================================ */
.thanhly-filter-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid #e2e8f0;
}
.thanhly-filter-tabs a {
  padding: 10px 2px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.thanhly-filter-tabs a.is-active {
  color: #1e293b;
  border-bottom-color: var(--tl-yellow);
}

/* ============================================================
   THẺ SẢN PHẨM - Badge số ảnh / video / wishlist
   ============================================================ */
.thanhly-badge-photo, .thanhly-badge-video {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(15,23,42,0.65);
  border-radius: 6px;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.thanhly-badge-photo { bottom: 8px; right: 8px; }
.thanhly-badge-video { top: 8px; right: 8px; background: var(--tl-red); }

.thanhly-wishlist-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.thanhly-wishlist-btn.is-active { color: var(--tl-red); }

.thanhly-price-red { color: var(--tl-red); }

.thanhly-addcart-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--tl-yellow);
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: transform .12s ease;
  flex-shrink: 0;
}
.thanhly-addcart-btn:active { transform: scale(0.9); }
.thanhly-addcart-btn.is-loading { opacity: 0.6; pointer-events: none; }

/* ============================================================
   OFF-CANVAS CART DRAWER
   ============================================================ */
.thanhly-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.thanhly-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

.thanhly-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 380px;
  background: #fff;
  z-index: 91;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
}
.thanhly-drawer.is-open { transform: translateX(0); }

.thanhly-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
}
.thanhly-drawer-header h3 { font-size: 15px; font-weight: 800; }
.thanhly-drawer-close { font-size: 18px; color: #94a3b8; padding: 4px; }

.thanhly-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}
.thanhly-drawer-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.thanhly-drawer-item img {
  width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: #f1f5f9;
}
.thanhly-drawer-item-info { flex: 1; min-width: 0; }
.thanhly-drawer-item-title {
  font-size: 12.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thanhly-drawer-item-row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.thanhly-drawer-item-price { font-size: 12px; color: var(--tl-red); font-weight: 700; }
.thanhly-drawer-remove { color: #cbd5e1; font-size: 13px; padding: 4px; }
.thanhly-drawer-remove:hover { color: var(--tl-red); }

.thanhly-drawer-footer {
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid #e2e8f0;
  background: #fafafa;
}
.thanhly-drawer-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}
.thanhly-drawer-total span:last-child { color: var(--tl-red); font-size: 16px; }
.thanhly-drawer-footer .thanhly-drawer-send {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
  color: #fff;
}
.thanhly-drawer-send.zalo { background: #0068ff; }
.thanhly-drawer-send.telegram { background: #229ed9; }

/* Khung bọc logo */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

/* Kích thước & Origin của Icon Mark */
.mark {
  width: 42px;
  height: 42px;
  overflow: visible;
  flex-shrink: 0;
}
.mark .rot {
  transform-box: fill-box;
  transform-origin: 100px 100px;
  animation: mark-spin calc(var(--dur) * 4) linear infinite;
}
.mark .blade {
  transform-box: fill-box;
  transform-origin: center;
}

/* Gán màu theo từng arm data-role */
[data-role="blue"]  { --ac: var(--c-blue); }
[data-role="lime"]  { --ac: var(--c-lime); }
[data-role="coral"] { --ac: var(--c-coral); }
[data-role="ink"]   { --ac: var(--c-ink); }
[data-role="ghost"] { --ac: var(--c-ghost); }

/* Hiệu ứng vẽ nét chạy vòng lặp */
[data-anim="trace"] .blade {
  fill: none;
  stroke: var(--ac, currentColor);
  stroke-width: 4;
  stroke-dasharray: var(--p);
  animation: ss-trace var(--dur) cubic-bezier(0.5, 0, 0.2, 1) infinite;
  animation-delay: calc(var(--i) * var(--dur) / 24);
}

@keyframes ss-trace {
  0%       { stroke-dashoffset: var(--p); }
  38%, 62% { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: calc(var(--p) * -1); }
}

@keyframes mark-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Hiệu ứng vẽ viền rồi fill màu chữ nuoigiang */
.brand-text {
  height: 32px;
  width: auto;
  overflow: visible;
}
.brand-name {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -2px;
  stroke-width: 2;
  stroke: url(#textGrad);
  fill: url(#textGrad);
  stroke-dasharray: 450;
  stroke-dashoffset: 450;
  animation: text-reveal var(--dur) cubic-bezier(0.5, 0, 0.2, 1) infinite;
}

@keyframes text-reveal {
  0% {
    stroke-dashoffset: 450;
    fill-opacity: 0;
  }
  40% {
    stroke-dashoffset: 0;
    fill-opacity: 0.1;
  }
  60%, 85% {
    stroke-dashoffset: 0;
    fill-opacity: 1;
  }
  100% {
    stroke-dashoffset: -450;
    fill-opacity: 0;
  }
}

.brand-logo:hover {
  --dur: 1.5s;
}