/* TNC Tìm kiếm sản phẩm - style.css */

/* ===== SEARCH BOX ===== */
.tnc-ps-wrap {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Ô tìm kiếm [tnc_product_search] trên máy tính: chiều rộng & căn lề theo cài đặt */
@media (min-width: 850px) {
    /* Đặt CHIỀU RỘNG THẬT (không chỉ giới hạn tối đa): khi nằm trong khung co theo nội dung
       (vd cột "Right Elements" của header Flatsome) ô vẫn rộng đúng như cài đặt */
    .tnc-ps-wrap--main {
        width: var(--tnc-ps-box-w, 600px);
        max-width: 100%;
        margin: var(--tnc-ps-box-margin, 0 auto);
    }
    /* Các khung bao ô tìm kiếm (tối đa 3 cấp) nằm trong hàng ngang (flex) của theme:
       được giãn ra lấy chỗ trống, và co lại khi màn hình hẹp thay vì tràn ra ngoài.
       Không ảnh hưởng khi ô nằm trong nội dung bài viết bình thường. */
    :has(> .tnc-ps-wrap--main),
    :has(> * > .tnc-ps-wrap--main),
    :has(> * > * > .tnc-ps-wrap--main) {
        flex-grow: 1;
        flex-shrink: 1;
        min-width: 0;
    }
    /* Hàng chứa ô (vd menu header) không đẩy các nút bên cạnh xuống dòng — ô tự co lại vừa chỗ trống */
    :has(> * > .tnc-ps-wrap--main) {
        flex-wrap: nowrap;
    }
    /* …và các nút bên cạnh (Tài khoản, Giỏ hàng…) giữ nguyên kích thước, chỉ ô tìm kiếm co lại */
    :has(> * > .tnc-ps-wrap--main) > :not(:has(.tnc-ps-wrap--main)) {
        flex-shrink: 0;
    }
}

.tnc-ps-search-box {
    display: flex;
    align-items: stretch;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
    overflow: hidden;
    height: 40px;
}

.tnc-ps-search-box:focus-within {
    box-shadow: 0 4px 20px rgba(34,113,177,0.18), 0 0 0 2px rgba(34,113,177,0.35);
}

.tnc-ps-input {
    flex: 1;
    height: 40px;
    padding: 0 18px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 15px;
    background: transparent;
    color: #222;
    min-width: 0;
    line-height: 40px;
}

.tnc-ps-clear {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    width: 26px;
    height: 26px;
    margin: 0 2px 0 -4px;
    padding: 0;
    border: 0;
    background: #eef0f2;
    color: #6b7280;
    cursor: pointer;
    box-shadow: none;
    transition: background .15s, color .15s;
    z-index: 3;
}
.tnc-ps-clear:hover { background: #e2e5e9; color: #111; }
.tnc-ps-search-box.has-text .tnc-ps-clear { display: inline-flex; }

.tnc-ps-input::placeholder {
    color: #aaa;
}

.tnc-ps-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 22px;
    background: var(--tnc-ps-btn-bg, linear-gradient(135deg, #2271b1, #1a5a96));
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: stretch;
    transition: opacity 0.2s;
    height: 40px;
    margin-right: 0px;
}

.tnc-ps-btn:hover {
    opacity: 0.88;
}

.tnc-ps-btn svg {
    flex-shrink: 0;
}

/* ===== GỢI Ý TỪ KHÓA ===== */
.tnc-ps-search-box { position: relative; }

.tnc-ps-ghost {
    position: absolute;
    display: none;
    pointer-events: none;
    white-space: pre;
    overflow: hidden;
    box-sizing: border-box;
    color: #b5b5b5;
    z-index: 2;
}

.tnc-ps-ghost-typed { visibility: hidden; }

.tnc-ps-kw-list {
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}

.tnc-ps-kw-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    transition: background 0.15s;
}

.tnc-ps-kw-item > svg:first-child { color: #aaa; flex-shrink: 0; }

.tnc-ps-kw-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tnc-ps-kw-text strong { color: #1a1a1a; font-weight: 700; }

.tnc-ps-kw-fill { color: #c4c4c4; flex-shrink: 0; }

.tnc-ps-kw-src {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 99px;
    background: #f1f2f4;
    color: #888;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
}

.tnc-ps-kw-item:hover,
.tnc-ps-nav-item.is-active { background: #f5f9ff; }

/* Từ khóa phổ biến (ô tìm kiếm trống) */
.tnc-ps-popular { padding: 12px 14px 14px; }

.tnc-ps-popular-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}
.tnc-ps-popular-title svg { color: #f05a22; }

.tnc-ps-popular-list { display: flex; flex-wrap: wrap; gap: 8px; }

.tnc-ps-pop-chip {
    display: inline-flex;
    align-items: center;
    height: 32px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid #e5e7eb;
    border-radius: 99px;
    background: #f7f8fa;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    box-shadow: none;
    cursor: pointer;
    transition: all .15s;
}
.tnc-ps-pop-chip:hover,
.tnc-ps-pop-chip.is-active {
    border-color: var(--tnc-ps-sort, #2271b1);
    color: var(--tnc-ps-sort, #2271b1);
    background: var(--tnc-ps-sort-06, rgba(34,113,177,.06));
}

/* ===== DROPDOWN ===== */
.tnc-ps-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    z-index: 9999;
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
}

.tnc-ps-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.tnc-ps-dropdown-item:last-child {
    border-bottom: none;
}

.tnc-ps-dropdown-item:hover {
    background: #f5f9ff;
}

.tnc-ps-item-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.tnc-ps-item-info {
    flex: 1;
    min-width: 0;
}

.tnc-ps-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tnc-ps-item-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}

.tnc-ps-item-price {
    font-size: 13px;
    color: #d94f00;
    font-weight: 700;
}

.tnc-ps-item-price ins { text-decoration: none; }

.tnc-ps-item-sku {
    font-size: 11px;
    color: #777;
    background: #f0f0f0;
    padding: 2px 7px;
    border-radius: 20px;
}

.tnc-ps-arrow {
    color: #bbb;
    flex-shrink: 0;
}

.tnc-ps-empty,
.tnc-ps-loading {
    padding: 18px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.tnc-ps-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: tnc-ps-spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes tnc-ps-spin { to { transform: rotate(360deg); } }

/* ===== OVERLAY + MODAL ===== */
.tnc-ps-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.tnc-ps-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22);
    animation: tnc-ps-modal-in 0.22s ease;
}

@keyframes tnc-ps-modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.tnc-ps-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: #f0f0f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #555;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.tnc-ps-modal-close:hover { background: #e0e0e0; color: #111; }

.tnc-ps-modal-content { padding: 28px; }

/* ===== POPUP LAYOUT ===== */
.tnc-ps-popup-inner {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

@media (max-width: 600px) {
    .tnc-ps-popup-inner { flex-direction: column; }
}

.tnc-ps-gallery { flex-shrink: 0; width: 280px; }

@media (max-width: 600px) { .tnc-ps-gallery { width: 100%; } }

.tnc-ps-gallery-main {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #eee;
    display: block;
    margin-bottom: 10px;
    background: #f9f9f9;
}

.tnc-ps-gallery-thumbs { display: flex; gap: 7px; flex-wrap: wrap; }

.tnc-ps-gallery-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 7px;
    border: 2px solid #eee;
    cursor: pointer;
    transition: border-color 0.15s;
}

.tnc-ps-gallery-thumb.active,
.tnc-ps-gallery-thumb:hover { border-color: #2271b1; }

.tnc-ps-popup-info { flex: 1; min-width: 0; }

.tnc-ps-popup-title {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin: 0 0 10px;
    line-height: 1.35;
    padding-right: 30px;
}

.tnc-ps-popup-price {
    font-size: 24px;
    font-weight: 700;
    color: #d94f00;
    margin-bottom: 14px;
}

.tnc-ps-popup-price ins { text-decoration: none; }

.tnc-ps-popup-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: #fafafa;
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid #f0f0f0;
}

.tnc-ps-popup-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tnc-ps-meta-label { font-weight: 600; color: #444; min-width: 70px; }
.tnc-ps-stock-yes { color: #1e8a3c; font-weight: 600; }
.tnc-ps-stock-no  { color: #c00; font-weight: 600; }

.tnc-ps-popup-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.65;
    margin-bottom: 16px;
    border-top: 1px solid #f0f0f0;
    padding-top: 14px;
}

.tnc-ps-variations {
    margin-bottom: 16px;
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 13px;
}

.tnc-ps-variation-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #f5f5f5;
}

.tnc-ps-variation-row:last-child { border-bottom: none; }
.tnc-ps-variation-attrs { color: #444; }
.tnc-ps-variation-price { color: #d94f00; font-weight: 600; }

.tnc-ps-popup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.tnc-ps-btn-detail {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
    background: #2271b1;
    color: #fff !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s;
}

.tnc-ps-btn-detail:hover { background: #135e96; }

.tnc-ps-btn-cart {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
    background: var(--tnc-ps-cart-bg, #e05a00);
    color: var(--tnc-ps-cart-text, #fff) !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    transition: filter 0.2s;
}

.tnc-ps-btn-cart:hover { filter: brightness(0.9); }

/* ===== VIEW ALL (dropdown) ===== */
.tnc-ps-view-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #2271b1;
    cursor: pointer;
    border-top: 1px solid #eee;
    transition: background 0.15s;
}

.tnc-ps-view-all:hover {
    background: #f0f6ff;
}

/* ===== TRANG KẾT QUẢ ===== */
.tnc-ps-results-header {
    font-size: 16px;
    color: #444;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.tnc-ps-results-count {
    color: #888;
    font-weight: normal;
    font-size: 14px;
    white-space: nowrap;
}
.tnc-ps-results-count b { color: var(--tnc-ps-sort, #2271b1); font-weight: 700; }

/* Máy tính: đã có ô "Hiển thị N kết quả" trên thanh sắp xếp → không lặp ở tiêu đề */
@media (min-width: 850px) {
    .tnc-ps-results-header.has-count-pill .tnc-ps-results-count { display: none; }
}

.tnc-ps-results-empty {
    padding: 40px 0;
    text-align: center;
    color: #888;
    font-size: 15px;
}

.tnc-ps-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.tnc-ps-result-card {
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    background: #fff;
}

.tnc-ps-result-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.tnc-ps-result-img-wrap {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f9f9f9;
}

.tnc-ps-result-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.tnc-ps-result-card:hover .tnc-ps-result-img-wrap img {
    transform: scale(1.05);
}

.tnc-ps-result-info {
    padding: 10px 12px;
}

.tnc-ps-result-name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.tnc-ps-result-price {
    font-size: 14px;
    font-weight: 700;
    color: #d94f00;
    margin-bottom: 4px;
}

.tnc-ps-result-price ins { text-decoration: none; }

.tnc-ps-result-sku {
    font-size: 11px;
    color: #999;
}

/* ===== MOBILE: list row ===== */
@media (max-width: 600px) {
    .tnc-ps-results-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tnc-ps-result-card {
        display: flex;
        flex-direction: row-reverse;
        align-items: center;
        border-radius: 8px;
    }

    .tnc-ps-result-img-wrap {
        width: 90px;
        min-width: 90px;
        height: 90px;
        aspect-ratio: unset;
        border-radius: 0;
        flex-shrink: 0;
    }

    .tnc-ps-result-info {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
    }

    .tnc-ps-result-name {
        font-size: 13px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        word-break: break-word;
        margin-bottom: 6px;
    }

    .tnc-ps-result-price {
        font-size: 13px;
        margin-bottom: 3px;
    }

    .tnc-ps-result-sku {
        font-size: 11px;
    }
}

/* ===== THANH SẮP XẾP (trang kết quả) — cùng kiểu thanh sắp xếp trang cửa hàng ===== */
.tnc-ps-sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    max-width: 100%;
}

.tnc-ps-sort-count {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    height: 34px;
    margin-right: 6px;
    padding: 0 14px;
    border-radius: 99px;
    background: var(--tnc-ps-sort-08, rgba(34,113,177,.08));
    border: 1px dashed var(--tnc-ps-sort-45, rgba(34,113,177,.45));
    font-size: 13px;
    color: #4b5563;
    white-space: nowrap;
    line-height: 1;
}
.tnc-ps-sort-count > svg { color: var(--tnc-ps-sort, #2271b1); flex-shrink: 0; }
.tnc-ps-sort-count .tnc-ps-num { color: var(--tnc-ps-sort, #2271b1); font-weight: 800; font-size: 15px; margin: 0 1px; }

.tnc-ps-sort-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}
.tnc-ps-sort-label svg { color: var(--tnc-ps-sort, #2271b1); }

.tnc-ps-sort-btns {
    display: flex;
    gap: 6px;
    padding: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tnc-ps-sort-btns::-webkit-scrollbar { display: none; }

.tnc-ps-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    height: 34px;
    min-height: 0;
    margin: 0;
    padding: 0 14px;
    border: 1px solid #e5e7eb;
    border-radius: 99px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    box-shadow: none;
    cursor: pointer;
    transition: all .15s;
}
.tnc-ps-sort-btn > svg { color: #9ca3af; flex-shrink: 0; transition: color .15s; }

.tnc-ps-sort-btn:hover {
    border-color: var(--tnc-ps-sort, #2271b1);
    color: var(--tnc-ps-sort, #2271b1);
    background: var(--tnc-ps-sort-06, rgba(34,113,177,.06));
}
.tnc-ps-sort-btn:hover > svg { color: var(--tnc-ps-sort, #2271b1); }

.tnc-ps-sort-btn.is-active,
.tnc-ps-sort-btn.is-active:hover {
    background: var(--tnc-ps-sort, #2271b1);
    border-color: var(--tnc-ps-sort, #2271b1);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 3px 10px var(--tnc-ps-sort-30, rgba(34,113,177,.3));
}
.tnc-ps-sort-btn.is-active > svg { color: #fff; }

.tnc-ps-sort-arrow { display: inline-flex; opacity: .9; }

.tnc-ps-sort-reset {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    height: 34px;
    margin: 0;
    padding: 0 12px;
    border: 1px dashed #d1d5db;
    border-radius: 99px;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: all .15s;
}
.tnc-ps-sort-reset:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }
@media (max-width: 849px) { .tnc-ps-sort-reset { height: 32px; font-size: 12.5px; } }

/* Điện thoại / máy tính bảng: ẩn ô đếm, các nút xuống hàng & căn giữa */
@media (max-width: 849px) {
    .tnc-ps-sort-bar { flex-wrap: wrap; justify-content: center; margin: 6px 0 12px; }
    .tnc-ps-sort-count { display: none; }
    .tnc-ps-sort-bar.is-count-only { display: none; }
    .tnc-ps-sort-btns { flex-wrap: wrap; justify-content: center; overflow: visible; padding: 0; }
    .tnc-ps-sort-btn { height: 32px; padding: 0 12px; font-size: 12.5px; gap: 5px; }
}
@media (max-width: 549px) {
    .tnc-ps-sort-label { display: none; }
}
@media (max-width: 380px) {
    .tnc-ps-sort-btn { padding: 0 10px; font-size: 12px; }
}

/* ===== NÚT THÊM VÀO GIỎ ===== */
.tnc-ps-result-card { display: flex; flex-direction: column; }
.tnc-ps-result-info { flex: 1; display: flex; flex-direction: column; }

.tnc-ps-result-cart {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--tnc-ps-cart-bg, #e05a00);
    border-radius: 6px;
    background: var(--tnc-ps-cart-bg, #e05a00);
    color: var(--tnc-ps-cart-text, #fff) !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none !important;
    box-sizing: border-box;
    transition: background 0.15s, color 0.15s, filter 0.15s;
}

/* Hàng giá + nút giỏ */
.tnc-ps-result-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.tnc-ps-result-price-row .tnc-ps-result-price { margin-bottom: 0; min-width: 0; }

/* Máy tính: nút giỏ chỉ là icon, nằm bên phải giá */
@media (min-width: 601px) {
    .tnc-ps-result-price-row > .tnc-ps-result-cart {
        width: 36px;
        height: 36px;
        padding: 0;
        margin: 0;
        flex-shrink: 0;
        border-radius: 8px;
    }
    .tnc-ps-result-price-row > .tnc-ps-result-cart svg { width: 18px; height: 18px; }
    .tnc-ps-result-price-row > .tnc-ps-result-cart .tnc-ps-cart-label { display: none; }
    .tnc-ps-result-price-row > .tnc-ps-result-cart.is-disabled {
        width: auto;
        height: 26px;
        padding: 0 8px;
        font-size: 11px;
    }
}

.tnc-ps-result-cart:hover { filter: brightness(0.9); }

/* "Chọn mua": viền cùng màu nút giỏ, nền trắng */
.tnc-ps-result-cart.is-link { background: #fff; color: var(--tnc-ps-cart-bg, #e05a00) !important; }
.tnc-ps-result-cart.is-link:hover { filter: none; background: var(--tnc-ps-cart-bg, #e05a00); color: var(--tnc-ps-cart-text, #fff) !important; }

.tnc-ps-result-cart.is-disabled {
    filter: none !important;
    border-color: #ddd;
    color: #aaa !important;
    background: #f7f7f7;
    cursor: default;
}

.tnc-ps-add-cart.is-loading { opacity: 0.6; pointer-events: none; }
.tnc-ps-add-cart.is-added   { background: #1e8a3c !important; border-color: #1e8a3c !important; color: #fff !important; }

/* Icon giỏ nhỏ trong dropdown */
.tnc-ps-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--tnc-ps-cart-bg, #e05a00);
    color: var(--tnc-ps-cart-text, #fff);
    cursor: pointer;
    transition: filter 0.15s;
}
.tnc-ps-cart-icon:hover { filter: brightness(0.9); }

/* Thông báo đã thêm */
.tnc-ps-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 100000;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    padding: 12px 18px;
    border-radius: 8px;
    background: #222;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}
.tnc-ps-toast.is-show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.tnc-ps-toast a { color: #ffb27a !important; font-weight: 600; margin-left: 8px; text-decoration: underline; }

@media (max-width: 600px) {
    .tnc-ps-result-card { flex-direction: row-reverse; }
    .tnc-ps-result-info::after { display: none; }

    /* Điện thoại: nút giỏ nằm cùng hàng, bên phải giá */
    .tnc-ps-result-price-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 6px 8px;
        margin-bottom: 3px;
    }
    .tnc-ps-result-price-row .tnc-ps-result-price { margin-bottom: 0; }
    .tnc-ps-result-price-row > .tnc-ps-result-cart {
        order: 0;
        width: auto;
        margin: 0 0 0 auto;
        height: 30px;
        padding: 0 10px;
        font-size: 12px;
        flex-shrink: 0;
    }
}

/* ===== ĐÁNH GIÁ SAO + ĐÃ BÁN ===== */
.tnc-ps-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 12px;
    color: #777;
    line-height: 1.4;
}

.tnc-ps-item-stats   { margin-top: 3px; }
.tnc-ps-result-stats { margin-top: 4px; }

.tnc-ps-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tnc-ps-stars {
    position: relative;
    display: inline-block;
    font-size: 13px;
    line-height: 1;
    letter-spacing: 1px;
    white-space: nowrap;
}

.tnc-ps-stars-bg   { color: #ddd; }

.tnc-ps-stars-fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: #f5a623;
}

.tnc-ps-rating-num   { font-weight: 600; color: #444; }
.tnc-ps-rating-count { color: #999; }

.tnc-ps-sold { color: #777; }

.tnc-ps-rating + .tnc-ps-sold {
    padding-left: 10px;
    border-left: 1px solid #e2e2e2;
}

/* Trang kết quả chưa có từ khóa */
.tnc-ps-results-start {
    padding: 36px 16px 28px;
    text-align: center;
    color: #6b7280;
}
.tnc-ps-results-start-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--tnc-ps-sort-08, rgba(34,113,177,.08));
    color: var(--tnc-ps-sort, #2271b1);
}
.tnc-ps-results-start p { margin: 0 0 18px; font-size: 15px; }
.tnc-ps-results-start .tnc-ps-popular-title { justify-content: center; }
.tnc-ps-results-start .tnc-ps-popular-list { justify-content: center; }

/* ===== PAGE INTRO ===== */
.tnc-ps-page-intro {
    font-size: 15px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: #f8faff;
    border-left: 4px solid #2271b1;
    border-radius: 0 6px 6px 0;
}


/* ===== TRANG KẾT QUẢ: ô tìm kiếm + nút "Xoá tìm kiếm" ===== */
.tnc-ps-results-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}
.tnc-ps-results-bar > .tnc-ps-wrap {
    flex: 0 1 600px;
    min-width: 0;
    margin: 0;
}
.tnc-ps-reset-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #d0d4d9;
    border-radius: 8px;
    background: #fff;
    color: #50575e;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: border-color .15s, color .15s, background .15s;
}
.tnc-ps-reset-search:hover,
.tnc-ps-reset-search:focus {
    border-color: #d63638;
    color: #d63638;
    background: #fff5f5;
    text-decoration: none;
}
/* Điện thoại: chỉ hiện dấu × cho gọn */
@media (max-width: 549px) {
    .tnc-ps-results-bar { gap: 8px; }
    .tnc-ps-reset-search { width: 40px; padding: 0; justify-content: center; }
    .tnc-ps-reset-search span { display: none; }
}
