/* Tab紧凑表格式模板样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #000;
    color: #fff;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* 顶部标题栏 */
.site-header {
    text-align: center;
    padding: 0 20px;
    margin-bottom: 20px;
}

.site-title {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #fff, #999);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 平台切换Tab */
.platform-tabs {
    display: flex;
    gap: 0;
    justify-content: center;
    margin-bottom: 20px;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 4px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.platform-tabs::-webkit-scrollbar {
    height: 4px;
}

.platform-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.platform-tabs::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.platform-tab {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
}

.platform-tab.active {
    background: #0066ff;
    color: #fff;
}

.platform-tab:hover:not(.active) {
    background: #2a2a2a;
    color: #fff;
}

.tab-icon {
    font-size: 18px;
}

/* 搜索框 */
.search-container {
    max-width: 600px;
    margin: 0 auto 20px auto;
    padding: 0 20px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 8px 16px;
    border: 1px solid #333;
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.search-icon {
    font-size: 18px;
    color: #666;
    margin-right: 10px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 14px;
    padding: 4px 0;
}

.search-input::placeholder {
    color: #666;
}

.search-clear {
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.search-clear:hover {
    background: #2a2a2a;
    color: #fff;
}

/* 主内容区 */
.main-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 左侧分类Tab */
.category-tabs {
    width: 180px;
    flex-shrink: 0;
    background: #1a1a1a;
    border-radius: 12px;
    padding: 6px;
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

/* 自定义滚动条样式 */
.category-tabs::-webkit-scrollbar {
    width: 4px;
}

.category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.category-tabs::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.tab-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tab-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
    color: #999;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.tab-item:hover {
    background: #2a2a2a;
    color: #fff;
}

.tab-item.active {
    background: #0066ff;
    color: #fff;
    font-weight: 500;
}

.tab-name {
    display: block;
}

/* 右侧内容区 */
.content-area {
    flex: 1;
    min-height: 600px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.current-category {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.view-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    background: #0066ff;
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.count-label {
    color: #999;
    font-size: 14px;
}

/* 表格容器 */
.table-container {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
}

/* 表格样式 */
.software-table {
    width: 100%;
    border-collapse: collapse;
}

.software-table thead {
    background: #242424;
    position: sticky;
    top: 0;
    z-index: 10;
}

.software-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #0066ff;
    border-bottom: 2px solid #0066ff;
}

.software-table th.col-icon {
    width: 50px;
    text-align: center;
}

.software-table th.col-name {
    width: 30%;
}

.software-table th.col-category {
    width: 15%;
}

.software-table th.col-version {
    width: 10%;
}

.software-table th.col-platform {
    width: 12%;
}

.software-table th.col-download {
    width: auto;
    text-align: left;
}

.software-table tbody tr {
    border-bottom: 1px solid #2a2a2a;
    transition: all 0.2s;
}

.software-table tbody tr:hover {
    background: #242424;
}

.software-table td {
    padding: 12px 6px;
    font-size: 13px;
    color: #ccc;
}

.td-icon {
    text-align: center;
}

.table-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a;
    overflow: hidden;
}

.table-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.table-icon-emoji {
    font-size: 24px;
}

.td-name {
    font-weight: 500;
    color: #fff;
    cursor: pointer;
}

.td-name:hover {
    color: #0066ff;
}

.td-category {
    color: #999;
}

.category-tag {
    display: inline-block;
    background: rgba(0, 102, 255, 0.1);
    color: #0066ff;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 4px;
}

.td-version {
    color: #0066ff;
    font-weight: 500;
}

.td-platform {
    color: #999;
    font-size: 12px;
}

.td-download {
    white-space: nowrap;
    text-align: left;
    padding-left: 8px;
}

.download-btn-mini {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    margin-right: 8px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

.download-btn-mini.primary {
    background: #0066ff;
    color: #fff;
}

.download-btn-mini.primary:hover {
    background: #0052cc;
}

.download-btn-mini.quark {
    background: linear-gradient(135deg, #FF6A3D 0%, #FF8C5F 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(255, 106, 61, 0.2);
}

.download-btn-mini.quark:hover {
    background: linear-gradient(135deg, #FF5528 0%, #FF7A4A 100%);
    box-shadow: 0 2px 6px rgba(255, 106, 61, 0.4);
}

.download-btn-mini.secondary {
    background: #2a2a2a;
    color: #999;
    border: 1px solid #333;
}

.download-btn-mini.secondary:hover {
    background: #333;
    color: #fff;
    border-color: #0066ff;
}

/* 安装教程按钮样式增强 - 提高对比度 */
.download-btn-mini.tutorial-btn {
    background: rgba(0, 102, 255, 0.2) !important;
    color: #4da6ff !important;
    border-color: rgba(0, 102, 255, 0.5) !important;
    font-weight: 500;
}

.download-btn-mini.tutorial-btn:hover {
    background: rgba(0, 102, 255, 0.3) !important;
    color: #66b3ff !important;
    border-color: #0066ff !important;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
}

.more-versions-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0, 102, 255, 0.15);
    color: #4da6ff;
    border: 1px solid #0066ff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.more-versions-btn:hover {
    background: #0066ff;
    color: #fff;
    border-color: #0080ff;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
}

/* 骨架屏样式 */
.skeleton-row {
    display: table-row;
}

.skeleton-row.hidden {
    display: none;
}

.skeleton {
    background: linear-gradient(90deg, #1a1a1a 25%, #242424 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.skeleton-text {
    height: 16px;
    margin: 2px 0;
}

.skeleton-tag {
    width: 60px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-btn {
    width: 80px;
    height: 28px;
    border-radius: 6px;
    display: inline-block;
    margin: 2px 4px 2px 0;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 加载动画（保留作为备用） */
.loading-container {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.loading-cell {
    background: transparent !important;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top: 3px solid #0066ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
}

.pagination button {
    padding: 8px 16px;
    background: #1a1a1a;
    color: #999;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #2a2a2a;
    border-color: #0066ff;
    color: #fff;
}

.pagination button.active {
    background: #0066ff;
    color: #fff;
    border-color: #0066ff;
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* 底部版权 */
.site-footer {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 13px;
    margin-top: 60px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .page-container {
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .main-wrapper {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .category-tabs {
        width: 100%;
        position: static;
        max-height: none;
        box-sizing: border-box;
    }
    
    .tab-list {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding: 4px;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-item {
        flex-shrink: 0;
        min-width: 100px;
        white-space: nowrap;
        padding: 8px 12px;
        margin-right: 4px;
    }
    
    /* 移动端隐藏部分列 */
    .col-category,
    .col-platform,
    .td-category,
    .td-platform {
        display: none;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        box-sizing: border-box;
    }
    
    .content-area {
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 768px) {
    .page-container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .site-header {
        margin-bottom: 15px;
        padding: 0 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .search-container {
        padding: 0 10px;
        margin-bottom: 15px;
    }
    
    .search-box {
        padding: 6px 12px;
    }
    
    .search-input {
        font-size: 13px;
    }
    
    .search-icon {
        font-size: 16px;
        margin-right: 8px;
    }
    
    .site-title {
        font-size: 28px;
        letter-spacing: 2px;
        margin-bottom: 8px;
        word-wrap: break-word;
    }
    
    .platform-tabs {
        display: flex;
        flex-wrap: nowrap;
        gap: 0;
        padding: 4px;
        margin-bottom: 15px;
        width: fit-content;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }
    
    .platform-tab {
        flex: 0 0 auto;
        min-width: 120px;
        padding: 8px 16px;
        font-size: 13px;
        text-align: center;
    }
    
    .tab-icon {
        font-size: 16px;
    }
    
    .tab-text {
        font-size: 12px;
        display: inline;
    }
    
    .main-wrapper {
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .category-tabs {
        width: 100%;
        box-sizing: border-box;
    }
    
    .content-area {
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .current-category {
        font-size: 18px;
        word-wrap: break-word;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    
    .software-table {
        min-width: 100%;
        width: 100%;
        max-width: 100%;
        table-layout: fixed;
    }
    
    .software-table th,
    .software-table td {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .col-version,
    .td-version {
        display: none;
    }
    
    .col-icon {
        width: 45px;
    }
    
    .col-name {
        width: 30%;
        min-width: 80px;
    }
    
    .col-download {
        width: auto;
        min-width: 0;
        text-align: left;
    }
    
    .td-download {
        text-align: left;
        padding-left: 0;
        padding-right: 2px;
    }
    
    .download-btn-mini {
        padding: 6px 8px;
        font-size: 11px;
        margin: 3px 2px;
        white-space: nowrap;
    }
    
    /* 移动端隐藏安装教程按钮 */
    .tutorial-btn {
        display: none !important;
    }
    
    .more-versions-btn {
        padding: 6px 8px;
        font-size: 11px;
        white-space: nowrap;
    }
    
    .more-versions-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        margin-top: 15px;
    }
    
    .pagination button {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 36px;
    }
    
    .site-footer {
        padding: 20px 10px;
        font-size: 12px;
        margin-top: 30px;
        width: 100%;
        box-sizing: border-box;
    }
}

/* ========== 优化7: 平滑过渡动画 ========== */
.software-table tbody tr {
    animation: fadeInRow 0.3s ease-in;
    opacity: 0;
    animation-fill-mode: forwards;
}

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

/* ========== 性能优化: will-change 优化动画元素 ========== */
.platform-tab,
.tab-item,
.download-btn-mini,
.more-versions-btn,
.pagination button {
    will-change: transform;
    /* 使用transform代替position，减少重排重绘 */
    transform: translateZ(0);
}

/* 动画元素优化 */
.table-icon img,
.category-tag {
    will-change: opacity;
    transform: translateZ(0);
}

/* 减少重排重绘：使用transform代替top/left */
.table-container {
    contain: layout style paint;
}

/* 优化滚动性能 */
.table-container,
.content-area {
    will-change: scroll-position;
}

.table-row-fade-in {
    animation: fadeInRow 0.3s ease-in;
    /* ========== 性能优化: will-change 减少重排重绘 ========== */
    will-change: transform, opacity;
}

/* 错误状态样式 */
.error-cell {
    text-align: center;
    padding: 40px 20px !important;
}

.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.retry-btn {
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: #0052cc !important;
    transform: scale(1.05);
}

.retry-btn:active {
    transform: scale(0.95);
}

/* 空状态样式 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.clear-search-btn {
    transition: all 0.3s ease;
}

.clear-search-btn:hover {
    background: #0052cc !important;
    transform: scale(1.05);
}

.clear-search-btn:active {
    transform: scale(0.95);
}

/* 加载状态动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-cell {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ========== 性能优化: 图片优化样式 ========== */
picture {
    display: inline-block;
    width: 27px;
    height: 27px;
}

picture img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s;
}

/* 图片加载时的占位符 */
picture img[loading="lazy"] {
    background: #1a1a1a;
    opacity: 0;
    animation: fadeInImage 0.3s ease-in forwards;
}

@keyframes fadeInImage {
    to {
        opacity: 1;
    }
}

/* 优化字体加载 */
@font-face {
    font-display: swap; /* 使用swap策略，避免FOIT */
}

@media (max-width: 480px) {
    .page-container {
        padding: 8px;
    }
    
    .site-title {
        font-size: 24px;
        letter-spacing: 1px;
    }
    
    .platform-tabs {
        display: flex;
        margin: 0 auto 15px auto;
        padding: 4px 8px;
        border-radius: 8px;
        width: fit-content;
        max-width: calc(100% - 16px);
        justify-content: center;
    }
    
    .platform-tab {
        flex: 0 0 auto;
        padding: 8px 14px;
        min-width: 100px;
        text-align: center;
    }
    
    .tab-text {
        display: inline;
        font-size: 12px;
    }
    
    .tab-icon {
        font-size: 16px;
        margin-right: 4px;
    }
    
    .software-table {
        min-width: 100%;
        width: 100%;
        table-layout: fixed;
    }
    
    .software-table th,
    .software-table td {
        padding: 6px 2px;
        font-size: 10px;
    }
    
    .col-icon {
        width: 35px;
    }
    
    .table-icon {
        width: 32px;
        height: 32px;
    }
    
    .table-icon-emoji {
        font-size: 20px;
    }
    
    .col-name {
        width: 28%;
        min-width: 70px;
        word-break: break-word;
    }
    
    .td-name {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .col-download {
        width: auto;
        min-width: 0;
        text-align: left;
    }
    
    .td-download {
        text-align: left;
        padding-left: 0;
        padding-right: 2px;
    }
    
    .download-btn-mini {
        padding: 5px 6px;
        font-size: 10px;
        margin: 2px 1px;
        white-space: nowrap;
    }
    
    /* 超小屏幕也隐藏安装教程按钮 */
    .tutorial-btn {
        display: none !important;
    }
    
    .more-versions-btn {
        padding: 5px 6px;
        font-size: 10px;
        white-space: nowrap;
    }
}
