/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a56db;
    --secondary-color: #2c5282;
    --accent-color: #e53e3e;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-color: #2d3748;
    --border-color: #e2e8f0;
    --header-height: 70px;
    --sidebar-width: 260px;
}

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

/* 头部导航 */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 30px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Logo 链接样式 */
.logo-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.logo span {
    font-size: 0.9rem;
    opacity: 0.9;
}

nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

nav input[type="text"] {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    width: 300px;
    font-size: 0.95rem;
    outline: none;
    transition: box-shadow 0.3s;
}

nav input[type="text"]:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

nav select {
    padding: 10px 15px;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    outline: none;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px 0;
    z-index: 100;
}

.sidebar h3 {
    padding: 0 20px;
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-list {
    list-style: none;
}

.category-list li {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-list li img.cat-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
    background: #f5f5f5;
    padding: 2px;
}

.category-list li:hover {
    background: #edf2f7;
}

.category-list li.active {
    background: #ebf8ff;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}

.company-info {
    margin-top: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    margin: 20px;
}

.company-info h4 {
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.company-info p {
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: #4a5568;
}

/* 主内容区 */
main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 25px 30px;
    min-height: calc(100vh - var(--header-height) - 80px);
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#productCount {
    font-weight: 600;
    color: var(--primary-color);
}

#currentCategory {
    color: #718096;
}

/* 产品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

/* 产品卡片 */
.product-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.product-image {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.product-header {
    padding: 15px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.product-header .code {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Consolas', monospace;
}

.product-header .category-tag {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    font-size: 0.75rem;
    margin-top: 8px;
}

.product-body {
    padding: 18px;
}

.product-body .description {
    font-size: 0.95rem;
    color: #4a5568;
    margin-bottom: 15px;
    line-height: 1.5;
    min-height: 50px;
}

.product-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    color: #718096;
}

.product-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-meta .label {
    color: #a0aec0;
    min-width: 50px;
}

.view-detail {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.view-detail:hover {
    background: var(--secondary-color);
}

/* 无结果 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: 12px;
}

.no-results p {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 20px;
}

.no-results button {
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    animation: fadeIn 0.3s;
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    margin: 5vh auto;
    padding: 30px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 15px;
    animation: slideDown 0.3s;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.2s;
}

.close:hover {
    color: var(--accent-color);
}

#modalContent h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

#modalContent .detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

#modalContent .detail-label {
    font-weight: 600;
    min-width: 100px;
    color: var(--secondary-color);
}

#modalContent .detail-value {
    flex: 1;
    color: #4a5568;
}

/* 页脚 */
footer {
    margin-left: var(--sidebar-width);
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 25px;
}

footer p {
    margin: 5px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 语言切换按钮 */
.lang-btn {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    main {
        margin-left: 220px;
    }
    footer {
        margin-left: 220px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    main {
        margin-left: 0;
    }
    footer {
        margin-left: 0;
    }
    .header-content {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    nav {
        flex-direction: column;
        width: 100%;
    }
    nav input[type="text"] {
        width: 100%;
    }
    .product-grid {
        grid-template-columns: 1fr;
    }
}
