/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --secondary-color: #00a0e9;
    --accent-color: #ff6b35;
    --text-primary: #333333;
    --text-secondary: #666666;
    --bg-light: #f5f7fa;
    --bg-white: #ffffff;
    --border-color: #e1e8ed;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ==================== 全局应用导航栏样式 ==================== */
.app-global-nav {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 2px solid #3b82f6;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    font-size: 24px;
}
.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.nav-brand {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.nav-links {
    display: flex;
    gap: 8px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #94a3b8;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}
.nav-link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #e2e8f0;
}
.nav-link.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
}
.nav-icon {
    font-size: 18px;
}
.nav-text {
    font-size: 14px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
        height: auto;
        padding: 0;
        gap: 0;
    }
    .nav-logo {
        width: 100%;
        justify-content: center;
        padding: 6px 0 4px;
    }
    .logo-text { font-size: 14px; font-weight: 600; }
    .nav-links {
        display: flex;
        width: 100%;
        gap: 2px;
        padding: 0 4px 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-link {
        flex: 1 0 auto;
        justify-content: center;
        padding: 7px 6px;
        font-size: 12px;
        white-space: nowrap;
        border-radius: 6px;
        gap: 3px;
        min-height: 40px;
    }
    .nav-icon { font-size: 14px; }
    .nav-text { font-size: 11px; }
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--bg-light);
    line-height: 1.6;
    padding-top: 60px;
}

@media (max-width: 768px) {
    body {
        padding-top: 82px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-brand h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.nav-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-item {
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    transition: var(--transition);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* 主内容区 */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 600px;
}

#searchInput {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

#searchBtn {
    padding: 0.8rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

#searchBtn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* 统计信息 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 产品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* 产品卡片 */
.product-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.product-image-placeholder {
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.product-content {
    padding: 1.5rem;
}

.product-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.8rem;
}

.product-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.product-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-color);
}

.product-action {
    color: var(--primary-color);
    font-weight: 500;
    transition: var(--transition);
}

.product-card:hover .product-action {
    color: var(--secondary-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.btn-primary {
    padding: 0.8rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.modal-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-category {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.modal-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.modal-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 2rem;
}

.modal-parameters {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.modal-parameters h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.parameter-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.parameter-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.parameter-key {
    font-weight: 500;
    color: var(--text-primary);
}

.parameter-value {
    color: var(--text-secondary);
}

.modal-link {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.modal-link:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* 页脚 */
.footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        text-align: center;
    }

    .nav-menu {
        justify-content: center;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .search-bar {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .parameter-list {
        grid-template-columns: 1fr;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 过渡效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 品牌筛选栏 */
.brand-filter {
    background: var(--bg-white);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 80px;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.brand-filter .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.brand-buttons {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.brand-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-primary);
}

.brand-btn:hover {
    border-color: var(--primary-color);
    background: rgba(0, 102, 204, 0.05);
    transform: translateY(-2px);
}

.brand-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.brand-logo {
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.zte-logo {
    background: linear-gradient(135deg, #0066cc, #00a0e9);
    color: white;
}

.huawei-logo {
    background: linear-gradient(135deg, #cf0a2c, #ff1a1a);
    color: white;
}

.compare-actions {
    display: flex;
    gap: 0.8rem;
}

.compare-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #ff6b35, #ff8c5a);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
}

.compare-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.compare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.compare-icon {
    font-size: 1.1rem;
}

.clear-btn {
    padding: 0.6rem 1.2rem;
    background: var(--bg-white);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.clear-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* 产品卡片选择状态 */
.product-card {
    position: relative;
}

.product-card.selected {
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-white);
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.product-card.selected::before {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.product-card.selected::after {
    content: '✓';
    position: absolute;
    top: 14px;
    right: 14px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    z-index: 11;
}

/* 品牌标签 */
.product-brand {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    z-index: 5;
}

.product-brand.zte {
    background: linear-gradient(135deg, #0066cc, #00a0e9);
}

.product-brand.huawei {
    background: linear-gradient(135deg, #cf0a2c, #ff1a1a);
}

/* 图片占位符（显示设备信息） */
.product-image-placeholder {
    width: 100%;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.product-image-placeholder.zte {
    background: linear-gradient(135deg, #0066cc 0%, #00a0e9 100%);
}

.product-image-placeholder.huawei {
    background: linear-gradient(135deg, #cf0a2c 0%, #ff1a1a 100%);
}

.placeholder-brand {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.placeholder-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.placeholder-info {
    font-size: 0.85rem;
    opacity: 0.8;
    line-height: 1.4;
}

.placeholder-price {
    margin-top: 0.8rem;
    font-size: 1.3rem;
    font-weight: 700;
}

/* 对比模态框 */
.compare-modal {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

.compare-table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.compare-table th,
.compare-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.compare-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.compare-table tr:hover {
    background: rgba(0, 102, 204, 0.02);
}

.compare-table td:first-child {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-light);
    position: sticky;
    left: 0;
}

.compare-product-header {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.compare-product-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.compare-product-brand {
    font-size: 0.9rem;
    opacity: 0.9;
}

.compare-product-price {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.highlight-better {
    background: rgba(0, 200, 100, 0.1);
    color: #00c864;
    font-weight: 600;
}

.highlight-worse {
    background: rgba(255, 100, 100, 0.1);
    color: #ff6464;
}

/* 响应式更新 */
@media (max-width: 768px) {
    .brand-filter .container {
        flex-direction: column;
        align-items: stretch;
    }

    .brand-buttons {
        justify-content: center;
    }

    .compare-actions {
        justify-content: center;
    }

    .compare-modal {
        width: 98%;
        margin: 1rem;
    }

    .compare-table td:first-child {
        position: static;
    }
}
