/* ================= 基础重置 ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 0px 12px 14px;
    color: #2c3e50;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto 10px;
    box-sizing: border-box;
    line-height: 1.4;
}

/* ================= 结果标题行（含筛选框 + 关闭按钮）—— 自身 sticky ================= */
.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 10px;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 20;
    background: #ffffff;
    flex-wrap: nowrap;
}
.result-head h1 {
    font-size: 19px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
    flex-shrink: 0;
    margin-right: 10px;
}
.result-head h1 em {
    font-style: normal;
    color: #007BFF;
}

/* 筛选框占右侧剩余区域 */
.filter-bar {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    margin-right: 10px;
}
.filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}
.filter-input:focus {
    border-color: #007BFF;
    outline: none;
}
.filter-input::placeholder { color: #999; }

/* 关闭按钮（点击回首页） */
.close-btn {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    text-decoration: none;
    transition: color 0.2s;
    padding: 0 4px;
    user-select: none;
}
.close-btn:hover { color: #333; }

/* ================= 表格 ================= */
.table-container {
    width: 100%;
    border: 1px solid #e0e0e0;
    margin-top: 0;
}

.result-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.result-table thead th {
    position: -webkit-sticky;
    position: sticky;
    top: var(--result-head-h, 44px);
    z-index: 10;
    background-color: #007BFF;
    color: #fff;
    padding: 9px 4px;
    text-align: center;
    font-weight: 600;
}

.result-table tbody tr { height: 48px; }
.result-table tbody td {
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    vertical-align: middle;
    padding: 8px 4px;
}
.result-table tbody tr:last-child td {
    border-bottom: none;
}
.result-table tbody tr:nth-child(even) { background-color: #f9f9f9; }
.result-table tbody tr:hover { background-color: #f0f0f0; }

.website-col { width: 12%; font-weight: bold; word-break: break-all; }
.product-col { width: 56%; }
.stock-col   { width: 10%; }
.price-col   { width: 11%; font-weight: bold; color: #e74c3c; }
.action-col  { width: 11%; }

.price-link { color: #e74c3c; text-decoration: none; }

.buy-btn {
    padding: 6px 12px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    display: inline-block;
    text-decoration: none;
}
.buy-btn:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.system-prompt-row .website-col,
.system-prompt-row .product-col { color: red !important; }

.has-fire-icon {
    box-shadow: inset 4px 0 0 #ff7f0e;
    background-color: #fff8f0 !important;
    transition: all 0.3s ease;
}
.has-fire-icon:hover {
    background-color: #fff0e0 !important;
    box-shadow: 0 3px 10px rgba(255, 127, 14, 0.25);
}
.has-fire-icon .website-col { color: #ff7f0e; font-weight: 700; }
.has-fire-icon .buy-btn { background-color: #ff7f0e; }
.has-fire-icon .buy-btn:hover { background-color: #e67200; }

.product-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: 2.8em;
    transition: all 0.3s ease;
    word-break: break-all;
    text-align: center;
    width: 100%;
}
.product-name.clickable { cursor: pointer; }
.product-name.expanded {
    -webkit-line-clamp: unset;
    max-height: 200px;
    cursor: auto;
    -webkit-user-select: text;
    user-select: text;
}

.expand-more-btn {
    display: inline-block;
    color: #007BFF;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border: 1px solid #007BFF;
    border-radius: 3px;
    margin-top: 4px;
}
.expand-more-btn:hover { background: #007BFF; color: #fff; }

tr.sub-item-row { display: none; }
tr.sub-item-row.show-sub { display: table-row; }
tr.sub-item-row td:first-child {
    position: relative;
    padding-left: 3px !important;
}
tr.sub-item-row td:first-child::before {
    content: "";
    position: absolute;
    left: 0; top: 0;
    width: 3px; height: 100%;
    background-color: #409eff;
    z-index: 2;
}

/* ================= 底部"近期搜索还常搜" ================= */
.related-hot {
    margin-top: 16px;
    padding: 14px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}
.related-hot p {
    font-size: 14px;
    color: #666;
    margin: 0 0 8px;
    line-height: 1.6;
}
.related-hot p em, .related-hot p a{
    font-style: normal;
    color: #007BFF;
    font-weight: 600;
}

.keyword-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}
.hot-keyword {
    padding: 6px 14px;
    background-color: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 15px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 4px;
    text-decoration: none;
    display: inline-block;
}
.hot-keyword:hover {
    border-color: #007BFF;
    color: #007BFF;
    transform: translateY(-1px);
}

/* ================= 底部自定义搜索框 ================= */
.custom-search {
    margin-top: 16px;
    padding: 16px 14px;
    background: #f8f9fa;
    border-radius: 8px;
}
.custom-search-title {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-bottom: 10px;
}
.custom-search-title em {
    font-style: normal;
    color: #007BFF;
    font-weight: 600;
}
.custom-search-form {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}
.custom-search-form input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    border-radius: 15px;
    padding: 12px 108px 12px 18px;
    border: 1px solid transparent;
    background:
        linear-gradient(white, white) padding-box,
        linear-gradient(160deg, #3377fe, #4c6fff, #8370ff, #ba59ff) border-box;
    font-size: 15px;
    transition: all 0.24s ease;
    background-color: transparent;
}
.custom-search-form input[type="text"]:focus { outline: none; }
.custom-search-form input[type="submit"] {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    border-radius: 12px;
    padding: 0 18px;
    background: linear-gradient(136deg, #286aff, #4e6ef2, #7274f9, #9f66ff);
    color: #fff;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.custom-search-form input[type="submit"]:hover {
    background: linear-gradient(rgba(0,0,0,0.09), rgba(0,0,0,0.09)),
                linear-gradient(136deg, #286aff, #4e6ef2, #7274f9, #9f66ff);
}

/* 空结果 / 错误 */
.empty-box {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 15px;
    line-height: 2;
}
.empty-box .big { font-size: 40px; display: block; margin-bottom: 8px; }

.no-results {
    text-align: center;
    padding: 24px 12px;
    color: #666;
    font-style: italic;
    font-size: 14px;
}

.disclaimer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    text-align: center;
}

/* ================= 响应式 ================= */
@media screen and (max-width: 480px) {
    body { padding: 0px 12px 10px; }

    .result-head h1 { font-size: 15px; max-width: 55%; }
    .filter-input { padding: 7px 10px; font-size: 13px; }
    .filter-input::placeholder { font-size: 11px; }
    .close-btn { font-size: 24px; padding: 0 2px; }

    .result-table { font-size: 12px; }
    .result-table thead th { padding: 8px 2px; }
    .result-table tbody td { padding: 6px 2px; }
    .result-table tbody tr { height: 58px; }

    .website-col { width: 20%; font-size: 11px; }
    .product-col { width: 38%; }
    .stock-col, .price-col { width: 11%; font-size: 11px; }
    .price-col a { font-size: 11px; }
    .action-col { width: 20%; }
    .buy-btn { padding: 4px 8px; font-size: 11px; line-height: 2; }

    .product-name {
        -webkit-line-clamp: 3;
        max-height: 4.2em;
    }

    .related-hot { padding: 12px 8px; }
    .hot-keyword { font-size: 13px; padding: 5px 10px; }

    .custom-search { padding: 14px 10px; }
    .custom-search-form input[type="text"] { font-size: 14px; padding: 10px 92px 10px 14px; }
    .custom-search-form input[type="submit"] { font-size: 14px; padding: 0 14px; }
}
.result-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: #7f8c8d;
    margin: 0 0 10px;
    text-align: left;
}

.intro-paragraph {
margin-top: 16px;
padding: 14px 16px;
background: #f8f9fa;
border-left: 3px solid #007BFF;
border-radius: 6px;
font-size: 14px;
line-height: 1.8;
color: #555;
text-align: left;
}
.intro-paragraph h2 {
font-size: 15px;
font-weight: 600;
color: #2c3e50;
margin: 0 0 8px;
padding: 0;
line-height: 1.4;
}
.intro-paragraph p {
margin: 0;
}
@media screen and (max-width: 480px) {
.intro-paragraph {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.7;
}
}
/* ================= 剩余商品加载提示 ================= */
.js-load-hint {
margin-top: 12px;
padding: 12px 14px;
background: #fff8e6;
border: 1px solid #ffe0a3;
border-radius: 6px;
font-size: 13px;
line-height: 1.7;
color: #8a6d3b;
text-align: center;
}
@media screen and (max-width: 480px) {
.js-load-hint {
    font-size: 12px;
    padding: 10px 12px;
    line-height: 1.6;
}
}