/**
 * lh-product.css — Khối kết quả tạo link & danh sách sản phẩm (design system Longhousee).
 *
 * Gồm: khối kết quả (#result-section), thông tin sản phẩm vừa tạo link, card sản phẩm
 * trong danh sách "của bạn" / "có sẵn", trạng thái rỗng, khối hỗ trợ, trạng thái chưa
 * cấu hình domain. Token lấy từ lh-base.css.
 */

/* ── Khối kết quả tạo link ─────────────────────────────────────────────── */
.result-section {
    display: none;
    flex-direction: column;
    gap: var(--lh-space-md);
    background: var(--lh-bg-secondary);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius-lg);
    padding: var(--lh-space-md);
}

.result-section.show {
    display: flex;
    animation: lh-slide-in 0.25s ease;
}

/* JS bật/tắt class .mb-3 trên #success-alert — khoảng cách đã do gap lo */
.result-section .alert {
    margin: 0;
}

.link-box {
    background: var(--lh-bg);
    border: 1px dashed var(--lh-primary);
    border-radius: var(--lh-radius-lg);
    padding: var(--lh-space-md);
}

.link-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--lh-space-sm);
    margin-bottom: var(--lh-space-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--lh-text);
}

.link-box #affiliate-link {
    font-size: 12px;
    color: var(--lh-text-secondary);
    word-break: break-all;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--lh-space-xs);
    background: var(--lh-primary-surface);
    color: var(--lh-primary);
    border: 1px solid var(--lh-primary);
    border-radius: var(--lh-radius-md);
    padding: 6px 10px;
    font-family: var(--lh-font-body);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.copy-btn:active {
    opacity: 0.7;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--lh-space-sm);
}

/* ── Thông tin sản phẩm vừa tạo link ───────────────────────────────────── */
.product-info-box {
    display: none;
    background: var(--lh-bg);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius-lg);
    padding: var(--lh-space-md);
}

.product-info-box.show {
    display: block;
    animation: lh-slide-in 0.25s ease;
}

.product-info-header {
    display: flex;
    align-items: center;
    gap: var(--lh-space-sm);
    padding-bottom: var(--lh-space-sm);
    margin-bottom: var(--lh-space-md);
    border-bottom: 1px solid var(--lh-border);
    font-family: var(--lh-font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--lh-text-secondary);
    text-transform: uppercase;
}

.product-image {
    width: 84px;
    height: 84px;
    flex: 0 0 84px;
    object-fit: cover;
    border-radius: var(--lh-radius-lg);
    border: 1px solid var(--lh-border);
    margin-right: var(--lh-space-md);
}

.product-details {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--lh-text);
    line-height: 1.35;
    margin-bottom: var(--lh-space-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-shop {
    font-size: 12px;
    color: var(--lh-text-secondary);
    margin-bottom: var(--lh-space-xs);
}

.product-price {
    font-family: var(--lh-font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--lh-primary);
}

.product-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--lh-space-sm);
}

.stat-item {
    background: var(--lh-bg-secondary);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius-md);
    padding: var(--lh-space-sm);
    text-align: center;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--lh-text-muted);
    margin-bottom: 2px;
}

.stat-value {
    font-family: var(--lh-font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--lh-text);
}

.commission-badge {
    margin-top: var(--lh-space-md);
    background: var(--lh-success-surface);
    border: 1px solid var(--lh-success-border);
    border-radius: var(--lh-radius-lg);
    padding: var(--lh-space-md);
    text-align: center;
    color: var(--lh-success);
}

.commission-badge .label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.commission-badge .amount {
    font-family: var(--lh-font-heading);
    font-size: 20px;
    font-weight: 700;
}

/* ── Card sản phẩm (danh sách "của bạn" / "có sẵn") ────────────────────── */
.up-item {
    position: relative;
    background: var(--lh-bg);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius-lg);
    padding: var(--lh-space-md);
    padding-left: calc(var(--lh-space-md) + 3px);
    margin-bottom: var(--lh-space-sm);
    overflow: hidden;
}

.up-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--lh-border-dark);
}

.up-item.is-ready::before {
    background: var(--lh-success);
}

.up-item.is-pending::before {
    background: var(--lh-warning);
}

.up-item.is-empty::before {
    background: var(--lh-error);
}

.up-top {
    display: flex;
    align-items: flex-start;
    gap: var(--lh-space-md);
}

.up-thumb {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    border-radius: var(--lh-radius-md);
    object-fit: cover;
    background: var(--lh-bg-muted);
    border: 1px solid var(--lh-border);
}

.up-thumb-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lh-text-muted);
}

.up-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* Nút xoá (chỉ ở "Sản phẩm của bạn") — nằm cùng hàng, không đè lên tên sản phẩm */
.up-del {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    margin: -4px -4px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--lh-radius-pill);
    color: var(--lh-text-muted);
    font-size: 14px;
    cursor: pointer;
}

.up-del:active {
    background: var(--lh-error-surface);
    color: var(--lh-error);
}

.up-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--lh-text);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.up-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lh-space-xs);
    margin-bottom: var(--lh-space-xs);
}

.up-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--lh-space-xs);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 5px 8px;
    border-radius: var(--lh-radius-pill);
    white-space: nowrap;
}

.up-chip--shopee {
    background: var(--lh-primary-surface);
    color: var(--lh-shopee);
}

.up-chip--lazada {
    background: #eef2ff;
    color: var(--lh-lazada);
}

.up-chip--ready {
    background: var(--lh-success-surface);
    color: var(--lh-success);
}

.up-chip--pending {
    background: var(--lh-warning-surface);
    color: var(--lh-warning);
}

.up-chip--empty {
    background: var(--lh-error-surface);
    color: var(--lh-error);
}

.up-ids {
    font-size: 11px;
    font-weight: 600;
    color: var(--lh-text-muted);
    word-break: break-all;
}

/* Khối thời gian: gửi link → trả link */
.up-times {
    display: flex;
    flex-wrap: wrap;
    gap: var(--lh-space-xs) var(--lh-space-md);
    margin-top: var(--lh-space-md);
    padding-top: var(--lh-space-sm);
    border-top: 1px dashed var(--lh-border);
    font-size: 11px;
    font-weight: 600;
    color: var(--lh-text-secondary);
}

.up-time {
    display: inline-flex;
    align-items: center;
    gap: var(--lh-space-xs);
    white-space: nowrap;
}

.up-time b {
    color: var(--lh-text);
    font-weight: 700;
}

.up-delay {
    font-weight: 700;
    color: var(--lh-success);
}

.up-delay.is-late {
    color: var(--lh-warning);
}

.up-delay.is-verylate {
    color: var(--lh-error);
}

.up-action {
    margin-top: var(--lh-space-md);
}

.up-action .btn {
    width: 100%;
}

/* Ghi chú trạng thái thay cho nút (đang chờ / không tạo được link).
   CHỈ đổi màu chữ, KHÔNG nền/viền — tránh trông giống nút bấm được. */
.up-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--lh-space-sm);
    width: 100%;
    padding: var(--lh-space-xs) 0;
    text-align: center;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--lh-accent-text);
}

/* Màn rộng: nút không kéo hết chiều ngang */
@media (min-width: 577px) {
    .up-action {
        text-align: right;
    }

    .up-action .btn {
        width: auto;
        min-width: 150px;
    }
}

/* ── Trạng thái rỗng / đang tải của danh sách ──────────────────────────── */
.list-state {
    padding: var(--lh-space-lg) 0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--lh-text-muted);
}

/* ── Khối liên hệ & hỗ trợ ─────────────────────────────────────────────── */
.support-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--lh-space-sm);
}

@media (max-width: 400px) {
    .support-actions {
        grid-template-columns: 1fr;
    }
}

/* ── Trạng thái chưa cấu hình domain ───────────────────────────────────── */
.no-config {
    text-align: center;
    padding: var(--lh-space-xl) var(--lh-space-md);
}

.no-config__icon {
    font-size: 34px;
    color: var(--lh-warning);
    margin-bottom: var(--lh-space-md);
}

/* ── Webview: ẩn nút chia sẻ nổi của ShareThis trên màn nhỏ ────────────── */
@media (max-width: 768px) {
    #st-1,
    .st-sticky-share-buttons {
        display: none !important;
    }
}
