<?php
require_once 'functions.php';
require_once 'site_config.php'; // 引入配置文件
$products = read_data('products.php');
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo SITE_NAME; ?> - 数码潮品首页</title>
    <style>
        /* 使用系统自带字体，确保加载速度 */
        @font-face {
            font-family: 'TechFont';
            src: local('Microsoft YaHei'), local('Segoe UI');
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
            line-height: 1.6;
            color: #1a1a2e;
            background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
            min-height: 100vh;
            position: relative;
        }
        
        body::before {
            content: "";
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(66, 133, 244, 0.03) 0%, transparent 20%),
                radial-gradient(circle at 90% 80%, rgba(234, 67, 53, 0.03) 0%, transparent 20%);
            z-index: -1;
        }
        
        /* 顶部导航栏样式 */
        .top-nav {
            background: linear-gradient(135deg, rgba(26, 26, 46, 0.98), rgba(15, 25, 45, 0.98));
            padding: 0.8rem 1.5rem;
            position: sticky;
            top: 0;
            z-index: 1001;
            border-bottom: 2px solid #4285f4;
            backdrop-filter: blur(10px);
        }
        
        .top-nav-container {
            max-width: 1300px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .top-menu {
            display: flex;
            gap: 2rem;
            list-style: none;
        }
        
        .top-menu a {
            color: #e8eaed;
            text-decoration: none;
            font-size: 0.9rem;
            padding: 0.5rem 0.8rem;
            border-radius: 4px;
            transition: all 0.3s;
            position: relative;
        }
        
        .top-menu a:hover {
            background: rgba(66, 133, 244, 0.2);
            color: #8ab4f8;
        }
        
        .top-menu a::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 50%;
            width: 0;
            height: 2px;
            background: #4285f4;
            transition: all 0.3s;
            transform: translateX(-50%);
        }
        
        .top-menu a:hover::after {
            width: 80%;
        }
        
        .customer-service {
            color: #e8eaed;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .customer-service::before {
            content: '💁';
            font-size: 1rem;
        }
        
        /* 侧边栏样式 */
        .sidebar {
            position: fixed;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            z-index: 1000;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        
        .sidebar-item {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 50%;
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(26, 26, 46, 0.15);
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            border: 2px solid transparent;
            position: relative;
            overflow: hidden;
        }
        
        .sidebar-item::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #1a1a2e, #0f192d);
            opacity: 0;
            transition: opacity 0.3s;
            z-index: -1;
        }
        
        .sidebar-item:hover {
            transform: translateY(-5px) scale(1.1);
            box-shadow: 0 8px 25px rgba(26, 26, 46, 0.25);
            border-color: #4285f4;
        }
        
        .sidebar-item:hover::before {
            opacity: 1;
        }
        
        .sidebar-item:hover .sidebar-icon {
            color: #e8eaed;
            transform: scale(1.2);
        }
        
        .sidebar-icon {
            font-size: 1.5rem;
            color: #1a1a2e;
            transition: all 0.3s;
        }
        
        .sidebar-tooltip {
            position: absolute;
            right: 70px;
            background: rgba(26, 26, 46, 0.95);
            color: #e8eaed;
            padding: 10px 15px;
            border-radius: 8px;
            font-size: 0.9rem;
            white-space: nowrap;
            opacity: 0;
            transform: translateX(10px);
            transition: all 0.3s;
            pointer-events: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            border-left: 3px solid #4285f4;
        }
        
        .sidebar-tooltip::after {
            content: "";
            position: absolute;
            top: 50%;
            right: -6px;
            transform: translateY(-50%);
            border-left: 6px solid rgba(26, 26, 46, 0.95);
            border-top: 6px solid transparent;
            border-bottom: 6px solid transparent;
        }
        
        .sidebar-item:hover .sidebar-tooltip {
            opacity: 1;
            transform: translateX(0);
        }
        
        .contact-panel {
            position: fixed;
            right: 100px;
            top: 50%;
            transform: translateY(-50%) translateX(20px);
            background: rgba(255, 255, 255, 0.98);
            padding: 25px;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(26, 26, 46, 0.2);
            width: 280px;
            opacity: 0;
            visibility: hidden;
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            border: 1px solid rgba(66, 133, 244, 0.3);
            backdrop-filter: blur(10px);
            z-index: 999;
        }
        
        .contact-panel.active {
            opacity: 1;
            visibility: visible;
            transform: translateY(-50%) translateX(0);
        }
        
        .contact-panel::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(to right, #1a1a2e, #0f192d, #4285f4);
            border-radius: 15px 15px 0 0;
        }
        
        .contact-title {
            font-size: 1.2rem;
            color: #1a1a2e;
            margin-bottom: 20px;
            text-align: center;
            font-weight: 600;
            position: relative;
            padding-bottom: 10px;
        }
        
        .contact-title::after {
            content: "";
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 50px;
            height: 2px;
            background: linear-gradient(to right, #1a1a2e, #4285f4);
        }
        
        .contact-item {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 20px;
            padding: 12px;
            border-radius: 8px;
            transition: all 0.3s;
            background: rgba(245, 247, 250, 0.5);
        }
        
        .contact-item:hover {
            background: rgba(66, 133, 244, 0.1);
            transform: translateX(5px);
        }
        
        .contact-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #1a1a2e, #0f192d);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #e8eaed;
            font-size: 1.2rem;
            flex-shrink: 0;
        }
        
        .contact-info h4 {
            color: #1a1a2e;
            font-size: 0.9rem;
            margin-bottom: 3px;
        }
        
        .contact-info p {
            color: #5f6368;
            font-size: 0.95rem;
            font-weight: 500;
        }
        
        .qrcode-container {
            text-align: center;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px dashed #dadce0;
        }
        
        .qrcode-container p {
            color: #5f6368;
            font-size: 0.85rem;
            margin-bottom: 10px;
        }
        
        .qrcode-placeholder {
            width: 150px;
            height: 150px;
            margin: 0 auto;
            background: linear-gradient(135deg, #f5f7fa, #e8ecf1);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #5f6368;
            font-size: 0.8rem;
            border: 2px dashed #4285f4;
            overflow: hidden;
        }
        
        .qrcode-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: none;
        }
        
        /* 头部样式 */
        .header {
            background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(15, 25, 45, 0.95));
            color: #e8eaed;
            padding: 1.2rem 1rem;
            text-align: center;
            box-shadow: 0 4px 20px rgba(26, 26, 46, 0.2);
            position: relative;
            backdrop-filter: blur(5px);
            border-bottom: 3px solid #4285f4;
        }
        
        .header::after {
            content: "⚡";
            position: absolute;
            bottom: -12px;
            left: 50%;
            transform: translateX(-50%);
            color: #4285f4;
            font-size: 24px;
            background: #f5f7fa;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            line-height: 24px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        .logo {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            margin-bottom: 10px;
        }
        
        .logo-icon {
            font-size: 2rem;
            color: #4285f4;
            animation: float 3s ease-in-out infinite;
        }
        
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-5px); }
        }
        
        .header h1 {
            font-size: 2.2rem;
            font-weight: 700;
            letter-spacing: 3px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            font-family: 'TechFont', 'Microsoft YaHei', sans-serif;
        }
        
        .header p {
            font-size: 1rem;
            opacity: 0.9;
            margin-top: 5px;
            letter-spacing: 1px;
        }
        
        .container {
            max-width: 1300px;
            margin: 3rem auto;
            padding: 0 1.5rem;
        }
        
        .products-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1.8rem;
        }
        
        .product-card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(26, 26, 46, 0.08);
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            position: relative;
            border: 1px solid rgba(66, 133, 244, 0.2);
            backdrop-filter: blur(10px);
        }
        
        .product-card:hover {
            transform: translateY(-8px) scale(1.02);
            box-shadow: 0 15px 30px rgba(26, 26, 46, 0.15);
            border-color: #4285f4;
        }
        
        .card-corner {
            position: absolute;
            width: 30px;
            height: 30px;
            border: 2px solid #4285f4;
            opacity: 0;
            transition: opacity 0.3s;
        }
        
        .card-corner.tl {
            top: -2px;
            left: -2px;
            border-right: none;
            border-bottom: none;
        }
        
        .card-corner.tr {
            top: -2px;
            right: -2px;
            border-left: none;
            border-bottom: none;
        }
        
        .card-corner.bl {
            bottom: -2px;
            left: -2px;
            border-right: none;
            border-top: none;
        }
        
        .card-corner.br {
            bottom: -2px;
            right: -2px;
            border-left: none;
            border-top: none;
        }
        
        .product-card:hover .card-corner {
            opacity: 1;
        }
        
        .product-image-container {
            width: 100%;
            height: 180px;
            overflow: hidden;
            position: relative;
        }
        
        .product-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.8s;
        }
        
        .product-card:hover .product-image {
            transform: scale(1.1);
        }
        
        .image-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to bottom, transparent 60%, rgba(26, 26, 46, 0.4));
            opacity: 0;
            transition: opacity 0.3s;
        }
        
        .product-card:hover .image-overlay {
            opacity: 1;
        }
        
        .product-info {
            padding: 1.2rem;
            position: relative;
        }
        
        .product-name {
            font-size: 1.1rem;
            font-weight: 600;
            color: #1a1a2e;
            margin-bottom: 0.5rem;
            line-height: 1.3;
            height: 2.6em;
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }
        
        .category-tag {
            display: inline-block;
            background: linear-gradient(135deg, #1a1a2e, #0f192d);
            color: #e8eaed;
            font-size: 0.75rem;
            padding: 0.3rem 0.7rem;
            border-radius: 15px;
            margin-bottom: 0.8rem;
            font-weight: 500;
            letter-spacing: 0.5px;
            box-shadow: 0 2px 4px rgba(26, 26, 46, 0.2);
        }
        
        .price-container {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 1rem;
            padding-top: 0.5rem;
            border-top: 1px dashed #dadce0;
        }
        
        .product-price {
            color: #ea4335;
            font-size: 1.3rem;
            font-weight: 700;
            position: relative;
        }
        
        .product-price::before {
            content: "¥";
            font-size: 0.9rem;
            margin-right: 2px;
            color: #5f6368;
        }
        
        .product-grade {
            color: #4285f4;
            font-size: 0.8rem;
            font-weight: 500;
        }
        
        .product-description {
            color: #5f6368;
            font-size: 0.85rem;
            line-height: 1.5;
            height: 4.5em;
            overflow: hidden;
            position: relative;
            margin-bottom: 1.2rem;
        }
        
        .product-description::after {
            content: "...";
            position: absolute;
            right: 0;
            bottom: 0;
            background: white;
            padding-left: 5px;
        }
        
        .btn {
            display: block;
            width: 100%;
            padding: 0.6rem;
            background: linear-gradient(135deg, #1a1a2e, #0f192d);
            color: #e8eaed;
            text-decoration: none;
            border-radius: 8px;
            border: none;
            cursor: pointer;
            transition: all 0.3s;
            font-weight: 600;
            letter-spacing: 1px;
            text-align: center;
            position: relative;
            overflow: hidden;
            font-size: 0.9rem;
        }
        
        .btn::after {
            content: "→";
            position: absolute;
            right: 15px;
            opacity: 0;
            transform: translateX(-10px);
            transition: all 0.3s;
        }
        
        .btn:hover {
            background: linear-gradient(135deg, #0f192d, #1a1a2e);
            padding-right: 2.5rem;
        }
        
        .btn:hover::after {
            opacity: 1;
            transform: translateX(0);
        }
        
        /* 脚页样式 */
        .footer {
            background: linear-gradient(135deg, rgba(26, 26, 46, 0.9), rgba(15, 25, 45, 0.9));
            color: #e8eaed;
            padding: 2.5rem 1.5rem 1.5rem;
            margin-top: 4rem;
            position: relative;
            border-top: 3px solid #4285f4;
        }
        
        .footer::before {
            content: "";
            position: absolute;
            top: -12px;
            left: 50%;
            transform: translateX(-50%);
            width: 100px;
            height: 2px;
            background: linear-gradient(90deg, transparent, #4285f4, transparent);
        }
        
        .footer-container {
            max-width: 1300px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 2rem;
        }
        
        .footer-section {
            margin-bottom: 1.5rem;
        }
        
        .footer-section h3 {
            font-size: 1.1rem;
            margin-bottom: 1rem;
            color: #8ab4f8;
            position: relative;
            padding-bottom: 0.5rem;
        }
        
        .footer-section h3::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 40px;
            height: 2px;
            background: #4285f4;
        }
        
        .footer-section p {
            font-size: 0.9rem;
            line-height: 1.8;
            margin-bottom: 0.5rem;
            opacity: 0.95;
            color: #e8eaed;
        }
        
        .footer-section a {
            color: #8ab4f8;
            text-decoration: none;
            transition: color 0.3s;
        }
        
        .footer-section a:hover {
            color: #4285f4;
            text-decoration: underline;
        }
        
        .company-info p strong {
            color: #8ab4f8;
            font-size: 1rem;
            display: block;
            margin-bottom: 10px;
        }
        
        .contact-info {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            margin-bottom: 0.8rem;
        }
        
        .contact-icon-small {
            width: 25px;
            height: 25px;
            border-radius: 50%;
            background: rgba(66, 133, 244, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            margin-top: 2px;
        }
        
        .contact-text {
            color: #e8eaed;
            font-size: 0.9rem;
            line-height: 1.5;
        }
        
        .icp {
            text-align: center;
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 1px solid rgba(66, 133, 244, 0.3);
        }
        
        .icp a {
            color: #4285f4;
            text-decoration: none;
            font-weight: 500;
            font-size: 0.95rem;
        }
        
        .icp a:hover {
            text-decoration: underline;
        }
        
        .copyright {
            text-align: center;
            margin-top: 1rem;
            font-size: 0.85rem;
            opacity: 0.9;
            color: #9aa0a6;
        }
        
        .footer-content {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 20px;
            flex-wrap: wrap;
        }
        
        .tech-icon {
            font-size: 1.2rem;
            animation: spin 4s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* 响应式设计 */
        @media (max-width: 1200px) {
            .products-grid {
                grid-template-columns: repeat(3, 1fr);
            }
            
            .sidebar {
                right: 15px;
            }
            
            .contact-panel {
                right: 90px;
                width: 260px;
            }
            
            .top-nav-container {
                flex-direction: column;
                gap: 1rem;
                text-align: center;
            }
        }
        
        @media (max-width: 992px) {
            .products-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .sidebar {
                flex-direction: row;
                top: auto;
                bottom: 20px;
                left: 50%;
                transform: translateX(-50%);
                background: rgba(255, 255, 255, 0.95);
                padding: 10px;
                border-radius: 50px;
                box-shadow: 0 5px 20px rgba(26, 26, 46, 0.2);
                gap: 10px;
                width: auto;
            }
            
            .sidebar-item {
                width: 50px;
                height: 50px;
            }
            
            .contact-panel {
                right: 50%;
                top: auto;
                bottom: 90px;
                transform: translateX(50%) translateY(20px);
                width: 300px;
            }
            
            .contact-panel.active {
                transform: translateX(50%) translateY(0);
            }
            
            .sidebar-tooltip {
                right: auto;
                bottom: 60px;
                left: 50%;
                transform: translateX(-50%) translateY(10px);
            }
            
            .sidebar-tooltip::after {
                right: auto;
                left: 50%;
                top: auto;
                bottom: -12px;
                transform: translateX(-50%) rotate(90deg);
                border-left: 6px solid transparent;
                border-right: 6px solid transparent;
                border-top: 6px solid rgba(26, 26, 46, 0.95);
            }
            
            .sidebar-item:hover .sidebar-tooltip {
                transform: translateX(-50%) translateY(0);
            }
            
            .top-menu {
                flex-wrap: wrap;
                justify-content: center;
                gap: 1rem;
            }
            
            .footer-container {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        
        @media (max-width: 768px) {
            .products-grid {
                grid-template-columns: 1fr;
                max-width: 400px;
                margin: 0 auto;
            }
            
            .header h1 {
                font-size: 1.8rem;
            }
            
            .container {
                margin: 2rem auto;
            }
            
            .contact-panel {
                width: 280px;
            }
            
            .footer-container {
                grid-template-columns: 1fr;
                text-align: center;
            }
            
            .footer-section h3::after {
                left: 50%;
                transform: translateX(-50%);
            }
            
            .contact-info {
                justify-content: center;
                text-align: left;
            }
            
            .footer-section h3 {
                text-align: center;
            }
        }
        
        /* 加载动画 */
        .product-card {
            animation: fadeInUp 0.6s ease-out forwards;
            opacity: 0;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        /* 为每个卡片设置延迟动画 */
        .product-card:nth-child(1) { animation-delay: 0.1s; }
        .product-card:nth-child(2) { animation-delay: 0.2s; }
        .product-card:nth-child(3) { animation-delay: 0.3s; }
        .product-card:nth-child(4) { animation-delay: 0.4s; }
        .product-card:nth-child(5) { animation-delay: 0.5s; }
        .product-card:nth-child(6) { animation-delay: 0.6s; }
        .product-card:nth-child(7) { animation-delay: 0.7s; }
        .product-card:nth-child(8) { animation-delay: 0.8s; }
        
        /* 返回顶部按钮样式 */
        .back-to-top {
            display: none;
        }
        
        .back-to-top.active {
            display: flex;
        }
    </style>
</head>
<body>
    <!-- 顶部导航栏 -->
    <div class="top-nav">
        <div class="top-nav-container">
            <ul class="top-menu">
                <?php foreach ($top_menu as $menu_item): ?>
                <li><a href="<?php echo htmlspecialchars($menu_item['url']); ?>"><?php echo htmlspecialchars($menu_item['title']); ?></a></li>
                <?php endforeach; ?>
            </ul>
            <div class="customer-service">在线客服</div>
        </div>
    </div>
    
    
    <!-- 头部 -->
    <div class="header">
        <div class="logo">
            <span class="logo-icon"></span>
            <h1><?php echo SITE_NAME; ?></h1>
            <span class="logo-icon"></span>
        </div>
        <p>数码新潮 · 智享生活</p>
    </div>
    
    <div class="container">
        <div class="products-grid">
            <?php foreach ($products as $product): ?>
            <div class="product-card">
                <!-- 卡片四角装饰 -->
                <div class="card-corner tl"></div>
                <div class="card-corner tr"></div>
                <div class="card-corner bl"></div>
                <div class="card-corner br"></div>
                
                <div class="product-image-container">
                    <img src="<?php echo htmlspecialchars($product['image']); ?>" 
                         alt="<?php echo htmlspecialchars($product['name']); ?>" 
                         class="product-image">
                    <div class="image-overlay"></div>
                </div>
                
                <div class="product-info">
                    <h3 class="product-name"><?php echo htmlspecialchars($product['name']); ?></h3>
                    <span class="category-tag"><?php echo htmlspecialchars($product['category']); ?></span>
                    
                    <div class="price-container">
                        <div class="product-price"><?php echo number_format($product['price'], 2); ?></div>
                        <div class="product-grade">热卖推荐</div>
                    </div>
                    
                    <p class="product-description"><?php echo htmlspecialchars($product['description']); ?></p>
                    
                    <a href="product.php?id=<?php echo $product['id']; ?>" class="btn">查看详情</a>
                </div>
            </div>
            <?php endforeach; ?>
        </div>
    </div>
    
    <!-- 脚页 -->
    <div class="footer">
        <div class="footer-container">
            
        
        
        
        <div class="copyright">
            <p>© <?php echo date('Y'); ?> 湖南牛猫电子商务有限公司 版权所有</p>
            <p>数码新潮 · 品质保障</p>
        </div>
    </div>
    
    <script>
        // 显示/隐藏联系方式面板
        const contactBtn = document.getElementById('contactBtn');
        const contactPanel = document.getElementById('contactPanel');
        const wechatBtn = document.getElementById('wechatBtn');
        const qqBtn = document.getElementById('qqBtn');
        const wechatQrImage = document.getElementById('wechatQrImage');
        const qrText = document.getElementById('qrText');
        
        contactBtn.addEventListener('click', function() {
            contactPanel.classList.toggle('active');
        });
        
        wechatBtn.addEventListener('click', function() {
            contactPanel.classList.add('active');
        });
        
        qqBtn.addEventListener('click', function() {
            contactPanel.classList.add('active');
        });
        
        // 点击页面其他区域关闭联系方式面板
        document.addEventListener('click', function(event) {
            if (!contactPanel.contains(event.target) && 
                !contactBtn.contains(event.target) && 
                !wechatBtn.contains(event.target) && 
                !qqBtn.contains(event.target)) {
                contactPanel.classList.remove('active');
            }
        });
        
        // 返回顶部功能
        const backToTopBtn = document.getElementById('backToTop');
        
        window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
                backToTopBtn.classList.add('active');
            } else {
                backToTopBtn.classList.remove('active');
            }
        });
        
        backToTopBtn.addEventListener('click', function() {
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            });
        });
        
        // 阻止联系面板内的点击事件冒泡
        contactPanel.addEventListener('click', function(event) {
            event.stopPropagation();
        });
        
        // 检查微信二维码图片是否存在
        if (wechatQrImage) {
            wechatQrImage.style.display = 'block';
            if (qrText) {
                qrText.style.display = 'none';
            }
        }
    </script>
</body>
</html>