:root {
    --primary-color: #0078d4;
    --secondary-color: #106ebe;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --border-color: #dee2e6;
    --section-bg: white;
    --table-header-bg: #f8f9fa;
    --hover-bg: #e9ecef;
    --table-row-hover: rgba(0, 0, 0, 0.04);
}

/* 使用 data-theme 替代 prefers-color-scheme */
[data-theme="dark"] {
    --primary-color: #0091ff;
    --secondary-color: #47a7f5;
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
    --section-bg: #2d2d2d;
    --table-header-bg: #333333;
    --hover-bg: #404040;
    --table-row-hover: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-bottom: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.section {
    background: var(--section-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    padding: 2rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0 0.5rem;
}

.tab {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
    position: relative;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    transition: color 0.2s;
}

.tab.active {
    color: var(--primary-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.download-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--section-bg);
    border-radius: 8px;
    overflow: hidden;
}

.download-table tr {
    border-bottom: 1px solid var(--border-color);
}

.download-table tr:last-child {
    border-bottom: none;
}

.download-table td {
    padding: 1rem;
    text-align: left;
    color: var(--text-color);
    transition: background-color 0.2s;
    vertical-align: middle;
    height: 100%;
    border: none;
}

.download-table th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    padding: 1.25rem 1rem;
    border: none;
    text-align: left;
    color: var(--text-color);
    letter-spacing: 0.5px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, 
        var(--table-header-bg) 0%, 
        var(--section-bg) 100%);
}

.download-table tr:hover td {
    background-color: var(--table-row-hover);
}

.file-name-cell {
    color: var(--text-color);
    font-weight: normal;
    padding: 1rem;
    vertical-align: middle;
    line-height: 1.4;
}

.update-date {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.download-link {
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.download-link:hover {
    background-color: var(--hover-bg);
    text-decoration: underline;
}

.note {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #fff3cd;
    border-radius: 4px;
    color: #856404;
}

.sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.sub-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: var(--section-bg);
    font-size: 1rem;
    transition: all 0.2s;
    color: var(--text-color);
}

.sub-tab:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.sub-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.download-links-cell {
    /* display: flex; */
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    vertical-align: middle;
    white-space: nowrap;
    min-width: 110px;
}

.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 60px;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ed2k-button {
    background-color: #4CAF50;
    color: white;
}

.bt-button {
    background-color: #2196F3;
    color: white;
}

.download-button-link {
    background-color: #0078d4;
    color: white;
}

.download-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.download-button:active {
    transform: translateY(0);
}

.download-button.disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
        overflow-x: hidden;  /* 防止水平溢出 */
    }
    
    .section {
        padding: 1rem;
        margin: 1rem 0.5rem;  /* 减小边距 */
    }
    
    /* 表格容器添加水平滚动 */
    .download-table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;  /* 提升iOS滚动体验 */
        margin: 0 -1rem;  /* 抵消section的padding */
        padding: 0 1rem;  /* 添加内边距保持视觉一致性 */
    }
    
    .download-table {
        min-width: 320px;  /* 减小最小宽度，因为隐藏了一列 */
        margin: 1rem 0;
    }
    
    .download-table th,
    .download-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;  /* 稍微减小字体 */
    }
    
    /* 隐藏发布时间列 */
    .download-table th:nth-child(2),
    .download-table td:nth-child(2) {
        display: none;
    }
    
    /* 文件名单元格允许多行显示 */
    .file-name-cell {
        padding: 0.75rem 0.5rem;
        word-break: break-word;
    }
    
    /* 优化下载按钮容器 */
    .download-links-cell {
        padding: 0.75rem 0.5rem;
        min-width: 110px;
        justify-content: flex-end;
    }
    
    /* 标签适配 */
    .tabs {
        gap: 0.15rem;
        padding: 0 0.25rem;
    }
    
    .tab {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }
    
    .sub-tabs {
        gap: 0.25rem;
        padding: 0 0.25rem;
        flex-wrap: wrap;  /* 允许换行 */
    }
    
    .sub-tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* 在更窄的屏幕上进一步优化 */
@media (max-width: 480px) {
    .download-table {
        min-width: 280px;  /* 进一步减小最小宽度 */
    }
    
    .download-links-cell {
        min-width: 90px;
    }
    
    .download-button {
        padding: 0.35rem 0.6rem;  /* 进一步减小按钮内边距 */
        font-size: 0.8rem;  /* 进一步减小字体 */
        min-width: 40px;  /* 减小最小宽度 */
    }
}

/* 需要在主样式中添加表格容器 */
.download-table-wrapper {
    width: 100%;
}

.history-versions {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.history-title {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}

.history-title::before {
    content: '▼';
    display: inline-block;
    margin-right: 0.8rem;
    font-size: 0.9rem;
    transition: transform 0.2s;
    position: relative;
    top: -1px;
}

.history-title.collapsed::before {
    transform: rotate(-90deg);
}

.history-month {
    margin-bottom: 1.5rem;
    margin-left: 0.5rem;
}

.month-title {
    color: var(--text-color);
    margin: 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
}

.month-title::before {
    content: '▼';
    display: inline-block;
    margin-right: 0.8rem;
    font-size: 0.9rem;
    transition: transform 0.2s;
    position: relative;
    top: -1px;
}

.month-title.collapsed::before {
    transform: rotate(-90deg);
}

.version-table-container {
    margin-bottom: 1.5rem;
    transition: display 0.3s ease;
}

.table-title {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* 调整按钮在深色模式下的透明度 */
@media (prefers-color-scheme: dark) {
    .download-button:hover {
        opacity: 0.8;
    }
    
    .download-button.disabled {
        background-color: #555;
        opacity: 0.5;
    }
}

/* 添加主题切换开关的样式 */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.title-area {
    flex: 1;
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    background: rgba(0, 120, 212, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s;
}

.theme-switch-wrapper:hover {
    opacity: 1;
    background: rgba(0, 120, 212, 0.9);
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 34px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: transparent;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.slider:before {
    display: none;
}

.slider::after {
    content: "☀️";
    transition: .4s;
}

input:checked + .slider::after {
    content: "🌙";
}

.slider:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.moon, .sun {
    display: none;
}

.slider.round {
    border-radius: 50%;
}

/* 移除之前的移动端样式 */
@media (max-width: 768px) {
    .header-content {
        text-align: center;
    }
    
    /* 移除之前的 theme-switch-wrapper 相关样式 */
}

/* 在深色模式下调整背景色 */
[data-theme="dark"] .theme-switch-wrapper {
    background: rgba(0, 145, 255, 0.8);
}

/* 表格行悬浮效果 */
.download-table tbody tr {
    transition: background-color 0.2s ease;
}

.download-table tbody tr:hover {
    background-color: var(--table-row-hover);
    cursor: pointer;
}

/* 选中状态效果 */
.download-table tbody tr.selected {
    background-color: var(--table-row-hover);
}

/* 确保最后一行悬浮时保持圆角 */
.download-table tbody tr:last-child:hover td:first-child {
    border-bottom-left-radius: 8px;
}

.download-table tbody tr:last-child:hover td:last-child {
    border-bottom-right-radius: 8px;
}

/* 扩展表格样式 */
.extension-tables {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.extension-table-container {
    margin-bottom: 2rem;
}

.extension-table-title {
    color: var(--text-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* 在移动端适配中添加 */
@media (max-width: 768px) {
    .extension-table-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
}

/* 添加扩展表格链接的样式 */
.extension-table-container a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.extension-table-container a:visited {
    color: var(--primary-color); /* 访问过的链接保持相同颜色 */
}

.extension-table-container a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* 主导航样式 */
.main-nav {
    background: var(--section-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.main-nav li {
    margin: 0;
}

.main-nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.main-nav a:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.main-nav i {
    font-size: 1.2rem;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .main-nav ul {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .main-nav a {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}
