/* CSS 变量定义 */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --text-color: #2c3e50;
    --secondary-text: #666;
    --border-color: #ddd;
    --bg-light: #f8f9fa;
    --font-size-base: 16px;
    --font-size-large: 1.1em;
    --font-size-small: 14px;
    --gap-sm: 8px;
    --gap-md: 12px;
    --gap-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    background-color: #f9f9f9;
    color: var(--text-color);
    line-height: 1.6;
}

ul,
li {
    list-style: none;
}
.container {
    max-width: 1200px;
    margin: 85px auto 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 24px;
    overflow: hidden;
    font-family: "Microsoft YaHei", sans-serif;
}

h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-tabs {
    display: flex;
    gap: var(--gap-md);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.nav-tab {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--secondary-text);
    border-bottom: none !important;
    text-decoration: none !important;
}

.nav-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    border-bottom: none !important;
    text-decoration: none !important;
}

.nav-tab:hover:not(.active) {
    background-color: var(--bg-light);
    border-color: var(--border-color);
}

.search-container {
    display: flex;
    gap: var(--gap-md);
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-select,
.search-input,
.search-button {
    min-width: 80px;
    padding: 13px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: var(--font-size-small);
    outline: none;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.search-button {
    background-color: #4a6fa5;
    color: white;
    border: none;
    cursor: pointer;
    padding: 13px 16px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.search-button:hover {
    background-color: #3a5a80;
}

.result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px;
    background-color: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 16px;
    font-size: var(--font-size-base);
    border-bottom: 1px solid var(--border-color);
}

.total-count {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.supplier-item {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    background-color: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-top: 0;
}

.supplier-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-bottom-color: var(--primary-color);
}

.supplier-header {
    display: flex;
    align-items: flex-start;
    gap: var(--gap-sm);
    margin-bottom: 12px;
}

.header-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.country-flag {
    max-width: 22px;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    margin-right: var(--gap-sm);
    vertical-align: middle;
    align-self: flex-start;
    margin-top: 7px;
}

.more-link {
    margin-top: 0;
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9em;
    text-decoration: none;
    padding: 4px 8px;
    transition: color 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.more-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.supplier-meta {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: var(--font-size-small);
}

.meta-label {
    font-weight: 500;
    color: var(--secondary-text);
    margin-right: 8px;
}

.meta-value {
    color: var(--text-color);
    font-weight: 500;
}

.recent-record {
    margin-bottom: 12px;
}

.record-title {
    font-size: var(--font-size-small);
    color: var(--secondary-text);
    margin-bottom: 8px;
    font-weight: 500;
}

.record-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm);
}

.record-item-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: var(--font-size-small);
    line-height: 1.4;
    min-width: 0;
    width: 100%;
}

.record-key {
    font-weight: 500;
    color: var(--secondary-text);
    margin-right: 2px;
    flex-shrink: 0;
}

.record-value.hs-code {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    flex: none;
}

.record-value.desc {
    color: var(--text-color);
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    min-height: 1em;
}

.record-value {
    color: var(--text-color);
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.update-date {
    font-size: 13px;
    color: #888;
    margin-top: var(--gap-sm);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--gap-sm);
    margin-top: var(--gap-lg);
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--primary-color);
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: var(--font-size-base);
    min-width: 36px;
    text-align: center;
}

.page-link:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-color);
}

.page-link.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-info {
    margin-left: var(--gap-md);
    color: var(--secondary-text);
    font-size: var(--font-size-small);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary-text);
    font-size: var(--font-size-large);
}

/* 数据展示容器：使用 Flex 布局 */
.data-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    margin-top: 20px;
    /* 确保网格项顶部对齐 */
    align-items: start;
}

.main-content {
    grid-column: 1;
    min-width: 0;
}

.sidebar {
    grid-column: 2;
    width: 280px;
    padding: 0; /* 移除 padding */
    background-color: white;
    border-left: none;
    box-shadow: none;
    position: static;
    height: auto;
    overflow-y: visible;
}

.sidebar-section {
    margin-bottom: 15px;
    padding: 12px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    align-self: flex-start;
}


.hot-search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-item {
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px;
    padding: 4px 10px;
    margin: 2px;
    display: inline-block;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 12px;
}

.tag-item:nth-child(1) { background-color: #28a745; }
.tag-item:nth-child(2) { background-color: #dc3545; }
.tag-item:nth-child(3) { background-color: #ffc107; }
.tag-item:nth-child(4) { background-color: #17a2b8; }
.tag-item:nth-child(5) { background-color: #6c757d; }
.tag-item:nth-child(6) { background-color: #e83c3c; }
.tag-item:nth-child(7) { background-color: #fd7e14; }
.tag-item:nth-child(8) { background-color: #6f42c1; }

.tag-item:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.recent-update-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.update-company {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    font-size: 14px;
}

.update-date {
    color: #666;
    margin-top: 2px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
        margin: 85px auto 20px;
    }

    .search-container {
        flex-direction: column;
        gap: var(--gap-sm);
    }

    .search-input {
        min-width: auto;
        width: 100%;
    }

    .supplier-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--gap-sm);
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        gap: var(--gap-sm);
    }

    .country-flag {
        margin-right: var(--gap-sm);
        margin-top: 0;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-link {
        padding: 6px 10px;
        font-size: 14px;
    }

    .data-container {
        flex-direction: column;
        gap: 16px;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        box-shadow: none;
        padding: 15px;
    }
}
