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

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #333;
    min-height: 100vh;
    padding-top: 70px;
    padding-bottom: 14px;
}

/* ===== 主容器 ===== */
.container {
    max-width: 800px;
    width: 100%;
    padding: 25px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
    margin: 10px auto;
    box-sizing: border-box;
}

.service-intro {
    margin: 20px 0;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}
.service-intro strong {
    color: #007BFF;
    font-weight: 600;
}

/* ===== 表单样式 ===== */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    text-align: left;
}
.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}
.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}
.form-group input:focus {
    border-color: #007BFF;
    outline: none;
}

input[type="submit"] {
    padding: 12px 30px;
    background-color: #007BFF;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s;
    width: 100%;
    box-sizing: border-box;
}
input[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

#loading {
    display: none;
    margin: 15px 0;
    font-weight: bold;
    color: #007BFF;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.related-links {
    margin-top: 25px;
    font-size: 0.95em;
}
.related-links a {
    color: #007BFF;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}
.related-links a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* ===== 弹窗样式 ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 15px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    height: 85vh;
    height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    overscroll-behavior: contain;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}
.modal-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #2c3e50;
    flex-shrink: 0;
    margin-right: 15px;
    white-space: nowrap;
}
.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 10px;
}
.close:hover {
    color: #333;
}
.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
    min-height: 0;
}
.modal-footer {
    text-align: right;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}
.modal-footer button {
    padding: 8px 16px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.modal-footer button:hover {
    background-color: #0056b3;
}

/* ===== 表格样式 ===== */
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 0;
}
.result-table th {
    top: 0;
    background-color: #007BFF;
    color: white;
    position: sticky;
    z-index: 2;
    padding: 8px 4px;
    text-align: center;
}
.result-table tbody tr {
    height: 48px;
}
.result-table td {
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    vertical-align: middle;
    padding: 8px 4px;
}
.result-table tr:nth-child(even) {
    background-color: #f9f9f9;
}
.result-table tr:hover {
    background-color: #f0f0f0;
}
.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;
    box-shadow: 0 3px 10px rgba(255, 127, 14, 0.25);
    transform: translateY(-1px);
}
.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;
    box-shadow: 0 2px 6px rgba(255, 127, 14, 0.4);
}
.website-col { width: 10%; font-weight: bold; }
.product-col { width: 60%; }
.stock-col { width: 10%;  }
.price-col { width: 10%;  font-weight: bold; color: #e74c3c; }
.action-col { width: 10%; }

.buy-btn {
    padding: 6px 12px;
    background-color: #28a745;
    color: white;
    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);
}

.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;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.filter-container {
    flex-grow: 1;
    margin: 0 10px;
    min-width: 120px;
}
.filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    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;
}
.no-results {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}
.result-table tbody tr.hidden {
    display: none;
}
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;
}
.expand-more-btn {
    color:#007BFF;
    font-size:12px;
    cursor:pointer;
    padding:2px 6px;
    border:1px solid #007BFF;
    border-radius:3px;
}
.expand-more-btn:hover {
    background:#007BFF;
    color:#fff;
}

.table-container {
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

/* ===== 推荐站点 ===== */
.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 10px 0;
}
.site-card {
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    overflow: hidden;
}
.site-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #007BFF;
}
.site-name {
    color: #2c3e50;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-url {
    color: #7f8c8d;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recommend-error, .recommend-empty {
    background: #fff9e6;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    color: #e67e22;
}

/* ===== 热搜 ===== */
.hot-search {
    text-align: center;
}
.keyword-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.hot-keyword {
    padding: 6px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 15px;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.hot-keyword:hover {
    background-color: #007BFF;
    color: white;
    border-color: #007BFF;
    transform: translateY(-1px);
}

/* ===== 轮播 ===== */
.banner-content {
    overflow: hidden;
    border-radius: 6px;
}
.natural-link {
    display: block;
    text-decoration: none;
}
.service-img {
    width: 100%;
    height: auto;
    display: block;
}

.promo-slider {
    position: relative;
    width: 100%;
    height: 25vh;
    height: 25dvh;
    margin: 0;
    overflow: hidden;
    border-radius: 6px;
}
.promo-container {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}
.promo-item {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.promo-item a {
    display: block;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: transparent;
}
.promo-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

.partner-title {
    margin: 10px 0;
    color: #333;
    font-size: 18px;
    text-align: center;
    font-weight: bold;
}

/* ===== 页脚 ===== */
.disclaimer {
    margin-top: 30px;
    padding-top:15px;
    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: 60px 12px 10px;
    }

    .modal-content {
        padding: 10px;
        width: 100%;
        height: 100dvh;
        border-radius: 0px;
    }
    .table-container {
        max-height: 100dvh;
    }
    .modal-header {
        flex-wrap: nowrap;
        align-items: center;
        margin-top: 10px;
    }
    .filter-container {
        margin: 0 5px;
        min-width: 100px;
    }
    .filter-input {
        padding: 6px 8px;
        font-size: 12px;
    }
    .filter-input::placeholder {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .result-table {
        font-size: 12px;
        overflow-x: auto;
    }
    .result-table th {
        padding: 8px 2px;
    }
    .result-table td {
        padding: 6px 2px;
    }
    .result-table tbody tr {
        height: 60px;
    }
    .product-name {
        -webkit-line-clamp: 3;
        max-height: 4.2em;
    }
    .website-col {
        width: 20%;
        font-size: 11px;
    }
    .product-col {
        width: 40%;
    }
    .stock-col, .price-col {
        width: 10%;
        font-size: 11px;
    }
    .price-col a {
        font-size: 11px;
    }
    .action-col {
        width: 20%;
    }
    .buy-btn {
        padding: 4px 8px;
        font-size: 11px;
        line-height: 2;
    }
    .recommend-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    .site-card {
        padding: 12px;
    }
    .site-name {
        font-size: 14px;
    }
}

@media screen and (max-width: 360px) {
    .modal-title {
        font-size: 1em;
        max-width: 60px;
    }
    .filter-input {
        font-size: 11px;
        padding: 5px 6px;
    }
    .filter-input::placeholder {
        font-size: 10px;
    }
}