
:root {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --secondary-light: #34d399;
    --secondary-dark: #059669;
    --accent-color: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-dark: #7c3aed;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* 顶部导航栏 */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background: #fff;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    position: relative;
}

.logo-link span{
    top: 0;
    right: -140px;
    position: absolute;
    border-radius: 8px;
    border: 1px solid #ddd;
    color: #999;
    padding: 2px 5px;
    font-size: 12px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-size: 16px;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

.submit-link {
    background: var(--primary);
    color: white;
    padding: 8px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.submit-link:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(55, 125, 181, 0.3);
}

/* 头部区域 */
header {
    text-align: center;
    padding: 25px 0 30px;
    margin-bottom: 20px;
    position: relative;
}

.header-title {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 1.2rem;
    color: var(--gray-600);
    max-width: 800px;
    margin: 0 auto 25px;
    font-weight: 400;
}

.header-decoration {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

.decoration-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    font-size: 0.95rem;
}

.decoration-item i {
    color: var(--primary-color);
}

/* 统计信息区域 */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.product { background: linear-gradient(135deg, var(--primary-color), var(--primary-light)); }
.stat-icon.upstream { background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light)); }
.stat-icon.downstream { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-icon.connection { background: linear-gradient(135deg, var(--accent-color), var(--accent-light)); }

.stat-value {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

.stat-change {
    font-size: 0.85rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

.stat-change.positive {
    color: var(--secondary-color);
}

/* 搜索和筛选区域 */
.search-filter-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.search-container {
    position: relative;
    margin-bottom: 25px;
}

.search-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    color: var(--gray-800);
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--gray-700);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

.filter-btn.active {
    background: linear-gradient(to right, var(--primary-color), var(--primary-light));
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.filter-btn i {
    font-size: 0.9rem;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 产品列表区域 */
.products-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    height: fit-content;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.4rem;
    color: var(--gray-800);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary-color);
}

.section-count {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* 产品列表 */
.product-list {
    max-height: 550px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.product-item {
    padding: 18px 20px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-item:hover {
    background-color: var(--gray-50);
    transform: translateX(3px);
}

.product-item.active {
    background-color: rgba(37, 99, 235, 0.08);
    border-left: 4px solid var(--primary-color);
}

.product-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.product-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.product-name {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 1.1rem;
}

.product-stats {
    display: flex;
    gap: 15px;
}

.product-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* 关系图区域 */
.relations-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.relations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.relations-title {
    font-size: 1.4rem;
    color: var(--gray-800);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.relations-title i {
    color: var(--primary-color);
}

/* 产品详情区域 */
.product-detail-section {
    background: linear-gradient(to right, rgba(37, 99, 235, 0.03), rgba(139, 92, 246, 0.03));
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--gray-200);
}

.product-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.product-detail-info {
    flex: 1;
}

.product-detail-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.product-detail-code {
    font-size: 1rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin-bottom: 15px;
}

.product-detail-desc {
    color: var(--gray-700);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 800px;
}

.product-chart-container {
    width: 250px;
    height: 120px;
}

/* 上下游关系区域 */
.relations-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

@media (max-width: 768px) {
    .relations-container {
        grid-template-columns: 1fr;
    }
}

.upstream-section, .downstream-section {
    display: flex;
    flex-direction: column;
}

.relation-title {
    font-size: 1.2rem;
    color: var(--gray-800);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.relation-title i {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.upstream-section .relation-title i {
    background: var(--secondary-color);
}

.downstream-section .relation-title i {
    background: #f59e0b;
}

.relation-list {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 20px;
    flex: 1;
}

.relation-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.relation-item:hover {
    background-color: var(--gray-50);
}

.relation-item.active {
    background-color: rgba(16, 185, 129, 0.08);
    border-left: 4px solid var(--secondary-color);
}

.downstream-section .relation-item.active {
    background-color: rgba(245, 158, 11, 0.08);
    border-left: 4px solid #f59e0b;
}

.relation-name {
    font-weight: 600;
    color: var(--gray-800);
}

.relation-count {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* 企业信息区域 */
.enterprise-section {
    margin-top: 10px;
}

.enterprise-title {
    font-size: 1.1rem;
    color: var(--gray-800);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.enterprise-title i {
    color: var(--accent-color);
}

.enterprise-list {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 15px;
    max-height: 240px;
    overflow-y: auto;
    background-color: var(--gray-50);
}

.enterprise-item {
    padding: 15px;
    background-color: white;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.enterprise-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.enterprise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.enterprise-name {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
}

.enterprise-rating {
    color: #fbbf24;
    font-size: 0.9rem;
}

.enterprise-desc {
    color: var(--gray-700);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 25px 0;
    color: var(--gray-600);
    font-size: 0.95rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 30px;
}

footer p {
    margin-bottom: 5px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.footer-links a {
    color: var(--gray-600);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 992px) {
    .header-title {
        font-size: 2.2rem;
    }
    
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-title {
        font-size: 1.8rem;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 2.2rem;
    }
    
    .product-detail-header {
        flex-direction: column;
    }
    
    .product-chart-container {
        width: 100%;
        margin-top: 20px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-600);
    font-style: italic;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading i {
    font-size: 2rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-size: 1.1rem;
}

.no-data i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--gray-300);
}

/* 工具类 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-primary {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* API状态指示器 */
.api-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-status.connected {
    background-color: rgba(16, 185, 129, 0.9);
    color: white;
}

.api-status.disconnected {
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
}

/* 错误提示 */
.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 15px;
    margin: 15px 0;
    color: #dc2626;
    font-size: 0.95rem;
}

.error-message i {
    margin-right: 8px;
}

/* 数据源状态 */
.data-source {
    background-color: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    margin: 15px 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-source-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-source i {
    color: var(--primary-color);
    font-size: 1.2rem;
}
