/* ==================================================
   TT Loop Buttons – CSS tổng (archive shop/category/tag)
   - Card viền vàng + gap 5px
   - Title 2 dòng + ...
   - Desktop: 2 nút cân 50/50 + rút text nút trái thành "THÊM GIỎ"
   - Mobile: Thêm giỏ = ICON | Mua ngay = TEXT
   - Hỏi giá: modal form đẹp, responsive
================================================== */

/* GAP giữa sản phẩm */
body.woocommerce.archive .products{
  margin-left: -5px !important;
  margin-right: -5px !important;
}
body.woocommerce.archive .products .product-small{
  padding-left: 5px !important;
  padding-right: 5px !important;
  margin-bottom: 10px !important;
}

/* CARD viền vàng */
body.woocommerce.archive .products .product-small .col-inner,
body.woocommerce.archive .products li.product{
  border: 2px solid #d7b46a !important;
  border-radius: 18px !important;
  background: #fff !important;
  overflow: hidden !important;
  padding: 3px !important;
}

/* dọn nền */
body.woocommerce.archive .products .product-small .box{
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* ảnh bo góc */
body.woocommerce.archive .products .product-small .box-image img,
body.woocommerce.archive .products li.product a img{
  border-radius: 12px !important;
}

/* Title 2 dòng + ... */
body.woocommerce.archive .products .product-small .name.product-title a{
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  line-height: 1.28 !important;
  margin-bottom: 6px !important;
}

/* Giá gọn */
body.woocommerce.archive .products .price{
  margin: 0 0 8px !important;
  line-height: 1.2 !important;
}

/* text canh trái */
body.woocommerce.archive .products .product-small .box-text{
  text-align: left !important;
}

/* =========================
   DESKTOP/TABLET: 2 nút cân 50/50
========================= */
body.woocommerce.archive .products .tt-actions{
  display: flex !important;
  gap: 10px !important;
  align-items: stretch !important;
  width: 100% !important;
  margin-top: 8px !important;
  box-sizing: border-box !important;
}

body.woocommerce.archive .products .tt-actions .button{
  flex: 1 1 0 !important;
  width: 0 !important;              /* KEY: chia đều 50/50 */
  min-width: 0 !important;
  box-sizing: border-box !important;

  height: 34px !important;
  min-height: 34px !important;
  padding: 0 10px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  white-space: nowrap !important;
  font-size: 12px !important;
  line-height: 1 !important;

  border-radius: 8px !important;
  border: 2px solid #6b2a1f !important;
  background: transparent !important;
  color: #6b2a1f !important;
}

/* Mua ngay nổi */
body.woocommerce.archive .products .tt-actions .tt-buy-now{
  background: #6b2a1f !important;
  color: #fff !important;
  border-color: #6b2a1f !important;
}

body.woocommerce.archive .products .tt-actions .button:hover{
  filter: brightness(0.97);
}

/* Desktop: rút text nút trái "Thêm giỏ hàng" -> "THÊM GIỎ" cho cân mắt */
@media (min-width: 768px){
  body.woocommerce.archive .products .tt-actions .tt-add{
    font-size: 0 !important;
  }
  body.woocommerce.archive .products .tt-actions .tt-add::before{
    content: "THÊM GIỎ";
    font-size: 11px !important;
    font-weight: 600;
    letter-spacing: .3px;
  }
  body.woocommerce.archive .products .tt-actions .button{
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    border-width: 1.5px !important;
  }
}

/* =========================
   MOBILE: Thêm giỏ = ICON | Mua ngay = TEXT
========================= */
@media (max-width: 767px){
  body.woocommerce.archive .products .tt-actions{
    gap: 6px !important;
    margin-top: 6px !important;
    padding: 0 2px !important;
  }

  /* THÊM GIỎ: icon */
  body.woocommerce.archive .products .tt-actions .tt-add{
    flex: 0 0 44px !important;
    width: 44px !important;

    height: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;

    font-size: 0 !important; /* ẩn chữ */
    border-radius: 10px !important;
    border-width: 1.5px !important;
  }
  body.woocommerce.archive .products .tt-actions .tt-add::before{
    content: "🛒";
    font-size: 16px !important;
    line-height: 1 !important;
    display: inline-block !important;
  }

  /* MUA NGAY: text */
  body.woocommerce.archive .products .tt-actions .tt-buy-now{
    flex: 1 1 auto !important;
    width: auto !important;

    height: 34px !important;
    min-height: 34px !important;
    padding: 0 10px !important;

    font-size: 11px !important;
    border-radius: 10px !important;
    white-space: nowrap !important;
    border-width: 1.5px !important;
  }
}

/* Ẩn link "Xem giỏ hàng →" Woo tự sinh sau khi ajax add */
body.woocommerce.archive .products .tt-actions a.added_to_cart.wc-forward{
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* =========================
   Toast "Đã thêm"
========================= */
.ttlb-toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  z-index: 99999;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,.82);
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  max-width: calc(100% - 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.ttlb-toast.is-show{
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}
@media (max-width: 767px){
  .ttlb-toast{ font-size: 12.5px; bottom: 14px; }
}

/* =========================
   Nút Hỏi giá (không có giá)
========================= */
body.woocommerce.archive .products .tt-actions .tt-ask-price{
  background: #6b2a1f !important;
  color: #fff !important;
  border-color: #6b2a1f !important;
  width: 100% !important;
  flex: 1 1 100% !important;
}

/* =========================
   Modal Hỏi giá
========================= */
.ttlb-q-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99990;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.ttlb-q-modal{
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-48%) scale(.98);
  width: min(520px, calc(100% - 24px));
  background: #fff;
  border-radius: 18px;
  border: 2px solid #d7b46a;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.ttlb-q-overlay.is-open{ opacity: 1; pointer-events: auto; }
.ttlb-q-modal.is-open{
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%,-50%) scale(1);
}

.ttlb-q-close{
  position: absolute;
  right: 10px;
  top: 10px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ttlb-q-head{
  padding: 18px 18px 10px;
}
.ttlb-q-badge{
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(107,42,31,.25);
  color: #6b2a1f;
  background: rgba(107,42,31,.06);
  margin-bottom: 8px;
}
.ttlb-q-title{
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.2;
  color: #1a1a1a;
}
.ttlb-q-sub{
  font-size: 13px;
  color: rgba(0,0,0,.62);
}
.ttlb-q-form{
  padding: 0 18px 18px;
}
.ttlb-q-product{
  font-weight: 600;
  color: #6b2a1f;
  margin: 6px 0 12px;
  font-size: 14px;
}
.ttlb-q-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ttlb-q-field span{
  display: block;
  font-size: 12px;
  color: rgba(0,0,0,.68);
  margin-bottom: 6px;
}
.ttlb-q-field span b{ color:#b92323; }
.ttlb-q-field input,
.ttlb-q-field textarea{
  width: 100%;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.ttlb-q-field input:focus,
.ttlb-q-field textarea:focus{
  border-color: rgba(107,42,31,.5);
  box-shadow: 0 0 0 3px rgba(107,42,31,.10);
}
.ttlb-q-qty{ grid-column: 1 / 2; }
.ttlb-q-note{ grid-column: 1 / -1; }

.ttlb-q-submit{
  margin-top: 12px;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: #6b2a1f;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.ttlb-q-submit[disabled]{ opacity: .7; cursor: not-allowed; }

.ttlb-q-spinner{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  display: none;
  animation: ttlbSpin .7s linear infinite;
}
@keyframes ttlbSpin { to { transform: rotate(360deg); } }

.ttlb-q-msg{
  margin-top: 10px;
  font-size: 13px;
}
.ttlb-q-msg.is-ok{ color: #1b7f3b; }
.ttlb-q-msg.is-err{ color: #b92323; }

@media (max-width: 767px){
  .ttlb-q-grid{ grid-template-columns: 1fr; }
  .ttlb-q-qty{ grid-column: 1 / -1; }
}


/* Add-to-cart icon/text inside button */
.tt-actions .tt-add .tt-add-ico{display:none; font-size:16px; line-height:1;}
.tt-actions .tt-add .tt-add-txt{display:inline;}

/* Mobile: icon button for add-to-cart */
@media (max-width: 767px){
  .tt-actions .tt-add{min-width:40px; padding:0 10px !important;}
  .tt-actions .tt-add .tt-add-ico{display:inline;}
  .tt-actions .tt-add .tt-add-txt{display:none;}
}
