/* TNC Product Search - 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;
}

.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-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;
}

/* ===== 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: #e05a00;
    color: #fff !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.2s;
}

.tnc-ps-btn-cart:hover { background: #c44f00; }

/* ===== 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;
}

.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: 3;
        margin-bottom: 6px;
    }

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

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

/* ===== 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;
}
