/* ==========================================================================
   State 1: Initial Icon Grid (初始图标列表)
   ========================================================================== */
.top-icon-grid-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-left: -10px; /* 抵消 padding */
    margin-right: -10px;
    margin-top: 20px;
    /* FIX: 增加底部间距，因为 Grid 现在常驻显示，需要和下方详情页拉开距离 */
    margin-bottom: 30px;
}

.top-icon-grid-item {
    position: relative;
    width: calc(25% - 20px); /* 4列布局，减去间隙 */
    margin: 10px;
    background-color: #fff;
    /* FIX: 始终保持 1px 边框，防止宽度变化导致的抖动 */
    border: 1px solid #E6E5E5;
    border-radius: 8px;
    padding: 30px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out; /* 稍微加快动画响应 */
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    /* FIX: 关键属性，确保 padding 和 border 不会撑大 width */
    box-sizing: border-box;
    overflow: hidden;
}

/* Hover 状态：上浮 + 阴影加深 + 边框变色 */
.top-icon-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-color: var(--appl-primary-color);
}

/* FIX: Active 状态 - 修复位置抖动问题 */
.top-icon-grid-item.active {
    /* 1. 改变边框颜色 (宽度保持 1px) */
    border-color: var(--appl-primary-color);
    /* 2. 背景微调 (可选，增加选中感) */
    background-color: #fcfdfe;
    /* 3. 核心修复：使用 box-shadow 模拟"加粗"效果，不占据物理空间 */
    box-shadow: 0 0 0 1px var(--appl-primary-color);
    /* 4. 强制位置复位，防止 hover 的 translateY 导致点击时高度跳动 */
    transform: none;
}

/* 右上角标签样式 */
.top-product-type-badge {
    position: absolute;
    top: 4px;           /* 距离顶部距离 */
    right: 4px;         /* 距离右侧距离 */
    background-color: #0076a8; /* 附图中的蓝色 (类似 Realtek 蓝) */
    color: #fff;
    font-size: var(--font-size-p);
    padding: 4px 12px;   /* 上下4px，左右12px内边距 */
    border-radius: 20px; /* 圆角胶囊形状 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* 轻微阴影，增加层次感 */
    z-index: 10;         /* 确保在图片上层 */
    letter-spacing: 0.5px;
}

/* 鼠标悬停时，标签颜色也稍微变化，增加互动感 */
.top-icon-grid-item:hover .top-product-type-badge {
    background-color: var(--appl-primary-color, #0068B6); /* 使用主色调或更亮的蓝 */
}

.top-icon-box {
    margin: 0 auto 15px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;  /* 建议：给一个固定高度，防止不同图片高度不一致导致标题上下跳动 */
}

.top-icon-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.top-icon-title {
    font-size: var(--font-size-h3);
    font-weight: 500;
    color: #333;
}

/* ==========================================================================
   Detail View Wrapper (详情页包裹)
   ========================================================================== */
.top-detail-view-wrapper {
    width: 100%;
    margin-top: 10px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Large Image Display (大图显示区)
   ========================================================================== */
.top-large-image-wrapper {
    width: 100%;
    margin-bottom: 30px; /* 与下方导航栏的间距 */
    text-align: center;
    background-color: #fff;
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
}

.top-large-image-wrapper img {
    width: 100%;       /* 默认 100% 宽度 */
    max-width: 800px;  /* 限制最大宽度，防止在大屏上过于夸张 */
    height: auto;
    max-height: 400px; /* 限制最大高度 */
    object-fit: contain;
    border-radius: 4px;
}

/* ==========================================================================
   Small Icon Navigation (顶部小图标导航)
   ========================================================================== */
.top-small-nav-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* 居中显示 */
    align-items: center;
    gap: 30px; /* 图标之间的间距 */
    margin-bottom: 40px;
}

.top-small-nav-item {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    padding: 10px;
    border-radius: 8px;
    min-width: 80px;
}

.top-small-nav-item:hover {
    background-color: #f9f9f9;
    text-decoration: none;
}

.top-small-nav-item.active .top-small-nav-img {
    border-color: var(--appl-primary-color);
    /* 选中时增加一点光晕 */
    box-shadow: 0 0 0 3px rgba(0, 104, 182, 0.1);
}

.top-small-nav-item.active .top-small-nav-text {
    color: var(--appl-primary-color);
    font-weight: 700;
}

/* 当处于展开状态时，在下方显示一个小三角 */
.top-small-nav-item.expanded::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #f8f9fa; /* 颜色要匹配 link-list-area 的背景色 */
    z-index: 2;
}

/* 小图标尺寸控制 */
.top-small-nav-img {
    width: 64px;
    height: 64px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.top-small-nav-img img {
    object-fit: contain;
}

.top-small-nav-text {
    font-size: var(--font-size-p);
    margin: 0;
    line-height: 1.2;
    text-align: center;
}

/* ==========================================================================
   Expandable Link List View (折叠链接列表)
   ========================================================================== */
.top-link-list-area {
    width: 100%;
    background-color: #f8f9fa; /* 浅灰背景区别于白色内容 */
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 40px; /* 与下方 Spec 容器的间距 */
    display: none;       /* 默认隐藏，由 JS 控制显示 */
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

.top-link-list-content {
    display: none;       /* 具体的内容块默认隐藏 */
    padding: 25px;
    animation: fadeInDown 0.3s ease-out;
}

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

/* 链接列表的标题（可选） */
.top-link-list-title {
    font-size: var(--font-size-h3);
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

/* 链接网格布局 */
.top-link-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* 单个链接按钮样式 */
.top-link-item-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    color: #555;
    font-size: var(--font-size-p);
    transition: all 0.2s;
    min-width: 150px;
}

.top-link-item-btn:hover {
    border-color: var(--appl-primary-color);
    color: var(--appl-primary-color);
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.top-link-item-btn i,
.top-link-item-btn img {
    margin-left: 8px;
    margin-right: 8px;
    font-size: var(--font-size-p);
    width: 20px;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --------------------------------------------------------
   Detailed Spec Container (详细信息容器)
   -------------------------------------------------------- */
.top-spec-container {
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); /* 增加阴影提升层次感 */
    margin-bottom: 40px;
    border: 1px solid #e1e8ed;
}

/* 左侧栏 - 蓝色背景 */
.top-spec-sidebar {
    width: 280px; /* 固定宽度 */
    flex-shrink: 0;
    background: linear-gradient(135deg, #0068B6 0%, #0088d6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
    background-color: rgb(6, 125, 183);
    background-size: cover;
}

.top-spec-sidebar-inner {
    text-align: center;
    z-index: 2;
    width: 100%; /* 确保内容居中 */
}

.top-spec-sidebar-icon-circle {
    width: 140px;
    height: 140px;
    background-color: #fff;
    border-radius: 50%;
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.top-spec-sidebar-icon-circle img {
    width: 92%; /* 调整图片比例，避免贴边 */
    height: auto;
}

.top-spec-sidebar-title {
    font-size: var(--font-size-h2);
    font-weight: 700;
    margin: 0;
    color: #fff !important;
    line-height: 1.3;
}

/* 右侧内容区 - 白色背景 */
.top-spec-content {
    flex-grow: 1;
    padding: 30px 40px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    background-color: #fff;
}

/* 具体模块 (Module) */
.top-spec-module {
    width: 46%; /* 2列布局，留出 margin */
    margin: 0 2% 30px 2%; /* 左右各2%，下边距30 */
}

/* FIX: 修复 Header 对齐问题 */
.top-spec-header {
    display: flex;
    align-items: center;
    /* 核心修复：强制内容左对齐 */
    justify-content: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.top-spec-header-icon {
    width: 32px;
    height: 32px;
    margin-left: 0;
    margin-right: 12px;
    object-fit: contain;
    display: block; /* 防止 inline-block 带来的额外间隙 */
}

.top-spec-header-title {
    font-size: var(--font-size-h3);
    font-weight: 600;
    color: #333;
    text-align: left;
}

.top-spec-body ul {
    padding-left: 0;
    margin: 0;
}

.top-spec-body li {
    list-style-type: none !important; /* 移除默认圆点 */
    position: relative;
    padding-left: 18px;
    margin-left: 0 !important;
    margin-bottom: 8px;
    font-size: var(--font-size-p);
    color: #666;
    line-height: 1.6;
    text-align: left;
}

/* 自定义一级列表圆点 */
.top-spec-body li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px; /* 根据行高调整 */
    width: 6px;
    height: 6px;
    background-color: #ccc;
    border-radius: 50%;
}

/* 二级嵌套列表 (缩进容器) */
.top-spec-body li ul {
    margin-top: 5px;       /* 与父级标题的间距 */
    margin-bottom: 10px;   /* 与下一个一级项目的间距 */
    padding-left: 4px;    /* ✅ 整体缩进距离 */
}

/* 二级列表项的横杠 (Dash) */
.top-spec-body li ul li {
    padding-left: 15px; /* 给横杠留出空间 */
    margin-bottom: 4px; /* 子项稍微紧凑一点 */
}

/* 覆盖之前的一级圆点样式，改为横杠 */
.top-spec-body li ul li::before {
    content: "-";          /* ✅ 使用横杠 */
    position: absolute;
    left: 0;
    top: 0;                /* 调整横杠位置 */
    width: auto;
    height: auto;
    background-color: transparent; /* 去掉圆点的背景色 */
    color: #999;           /* 横杠颜色 */
    font-weight: bold;
    border-radius: 0;
}

/* ==========================================================================
   Media Queries (Responsive)
   ========================================================================== */

/* 平板 & 窄屏桌面 (Tablet / Laptop) */
@media (max-width: 1200px) {
    .top-icon-grid-item {
        width: calc(33.33% - 20px); /* 3列 */
    }
}

/* 手机 (Mobile) */
@media (max-width: 768px) {
    /* 初始网格变 2列 */
    .top-icon-grid-item {
        width: calc(50% - 20px);
        padding: 20px 10px;
    }

    /* 小图标导航可以横向滚动 */
    .top-small-nav-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-left: 10px;
    }
    .top-close-btn {
        position: static;
        transform: none;
        margin-left: auto;
        padding-right: 10px;
    }

    /* 详细信息容器变为垂直堆叠 */
    .top-spec-container {
        flex-direction: column;
    }

    /* 左侧 Sidebar 变顶部 Banner */
    .top-spec-sidebar {
        width: 100%;
        height: auto;
        padding: 20px;
        flex-direction: row; /* 图标和文字横排 */
        justify-content: flex-start;
    }

    .top-spec-sidebar-inner {
        display: flex;
        align-items: center;
        text-align: left;
    }

    .top-spec-sidebar-icon-circle {
        width: 60px;
        height: 60px;
        margin: 0 15px 0 0;
    }

    .top-spec-sidebar-title {
        text-align: left;
    }

    /* 内容区 */
    .top-spec-content {
        padding: 20px;
    }

    /* 模块变单列 */
    .top-spec-module {
        width: 100%;
        margin: 0 0 25px 0;
    }
}

@media (max-width: 480px) {
    .top-icon-grid-item {
        width: 100%; /* 单列 */
        margin: 10px 0;
    }
}
