/* ===== 白色背景紧凑版本 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #ffffff;
    color: #333333;
    line-height: 1.3;
    min-height: 100vh;
    font-size: 12px;
    overflow-x: hidden; /* 防止页面出现横向滚动 */
}

/* 主容器 */
.container { 
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 5px;
}

/* 头部logo区域 */
.site-header { 
    text-align: center; 
    padding: 0;
    margin-bottom: 8px;
    width: 100%;
}

.logo-container {
    width: 100%;
    margin-bottom: 5px;
    overflow: hidden;
}

.site-logo {
    width: 100%;
    height: auto;
    max-height: 50px;
    object-fit: cover;
    display: block;
}

.site-title {
    color: #d4af37;
    font-size: 1.2rem;
    margin: 0;
    display: none;
}

/* 分类按钮区域 */
.category-filter {
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 3px;
    margin-top: 5px;
}

.cat-btn {
    padding: 2px 8px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    color: #333;
    border-radius: 2px; 
    cursor: pointer; 
    font-size: 0.7rem;
    font-weight: normal;
}

.cat-btn.active { 
    background: #d4af37; 
    color: #fff; 
    border-color: #d4af37;
}

/* 时段提示 */
.period-indicator {
    padding: 3px 8px;
    text-align: center;
    border-radius: 2px;
    margin-bottom: 6px;
    font-weight: bold;
    display: block;
    border-left: 2px solid;
    font-size: 0.7rem;
}

.period-indicator.daytime {
    background-color: rgba(52, 152, 219, 0.1);
    border-left-color: #3498db;
    color: #3498db;
}

.period-indicator.overnight {
    background-color: rgba(155, 89, 182, 0.1);
    border-left-color: #9b59b6;
    color: #9b59b6;
}

/* 表格控制区域 */
.table-controls {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 2px 2px 0 0; 
    border: 1px solid #ddd;
    font-size: 0.7rem;
}

.stats { 
    color: #4CAF50; 
}

.sort-controls select { 
    padding: 2px 4px;
    background: #fff;
    color: #333; 
    border: 1px solid #ccc; 
    border-radius: 2px; 
    font-size: 0.7rem;
}

/* 表格区域 - 修改为自适应宽度 */
.table-wrapper {
    width: 100%;
    overflow-x: auto; /* 只在必要时显示滚动条 */
    border: 1px solid #ddd; 
    border-top: none;
}

/* 移除最小宽度限制，让表格自适应 */
#serverTable {
    width: 100%; 
    border-collapse: collapse; 
    min-width: 0; /* 移除固定最小宽度 */
    font-size: 0.75rem;
    table-layout: fixed; /* 使用固定布局，防止单元格宽度不一致 */
}

#serverTable thead { 
    background: #f5f5f5;
}

#serverTable th {
    padding: 3px 4px;
    text-align: left; 
    color: #333;
    border-bottom: 2px solid #ddd;
    font-weight: bold; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 文本溢出显示省略号 */
    font-size: 0.75rem;
}

#serverTable tbody tr {
    border-bottom: 1px solid #eee;
}

#serverTable tbody tr:nth-child(even) { 
    background-color: #fafafa;
}

#serverTable td {
    padding: 2px 4px;
    vertical-align: middle;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis; /* 文本溢出显示省略号 */
    white-space: nowrap;
}

/* 表格列宽度分配 - 优化为更适合移动端的比例 */
#serverTable th:nth-child(1),
#serverTable td:nth-child(1) {
    width: 22%; /* 服务器名列稍微加宽 */
}

#serverTable th:nth-child(2),
#serverTable td:nth-child(2) {
    width: 15%;
}

#serverTable th:nth-child(3),
#serverTable td:nth-child(3) {
    width: 14%;
}

#serverTable th:nth-child(4),
#serverTable td:nth-child(4) {
    width: 14%;
}

#serverTable th:nth-child(5),
#serverTable td:nth-child(5) {
    width: 10%;
}

#serverTable th:nth-child(6),
#serverTable td:nth-child(6) {
    width: 15%;
}

#serverTable th:nth-child(7),
#serverTable td:nth-child(7) {
    width: 10%;
}

/* 服务器名样式 */
.server-name { 
    color: #0066cc;
    font-weight: bold; 
    font-size: 0.8em;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-name:hover {
    text-decoration: underline;
}

/* 服务器IP样式 */
.server-ip { 
    color: #0066cc;
    cursor: pointer;
    font-size: 0.75em;
    text-decoration: none;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-ip:hover {
    text-decoration: underline;
}

.server-tags { 
    margin-top: 1px; 
}

.tag { 
    display: inline-block; 
    padding: 0 3px;
    border-radius: 1px; 
    font-size: 0.65em; 
    margin-right: 2px; 
    margin-top: 1px;
}

.tag.new { 
    background: #ff4444; 
    color: white; 
}

.tag.hot { 
    background: #ff9900; 
    color: black; 
}

/* 特色备注列 */
.server-feature { 
    color: #666;
    line-height: 1.2;
    font-size: 0.7em;
    white-space: normal; /* 允许换行 */
    word-break: break-word; /* 允许单词内断行 */
}

/* 按钮样式 */
.btn-detail {
    display: inline-block; 
    padding: 2px 6px;
    background: #d4af37;
    color: #fff; 
    font-weight: bold; 
    text-decoration: none; 
    border-radius: 1px; 
    border: none; 
    cursor: pointer;
    font-size: 0.7rem;
    white-space: nowrap;
}

.btn-detail:hover { 
    background: #c19b2e; 
}

.loading { 
    text-align: center; 
    padding: 15px!important; 
    color: #888; 
    font-size: 0.8rem; 
}

/* 页脚样式 */
.site-footer {
    text-align: center; 
    padding: 8px 0;
    margin-top: 10px;
    color: #777; 
    border-top: 1px solid #ddd;
    font-size: 0.7em;
}

/* 推荐系统样式 */
tr.row-yellow-bg {
    background-color: rgba(255, 244, 92, 0.15) !important;
    border-left: 2px solid #f1c40f !important;
}

.promotion-badge {
    display: inline-block;
    padding: 0 4px;
    margin-left: 2px;
    font-size: 0.6em;
    border-radius: 4px;
    color: white;
    vertical-align: middle;
    white-space: nowrap;
    font-weight: bold;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-allday {
    background: #3498db;
}

.badge-overnight {
    background: #9b59b6;
}

/* 移动端响应式优化 */
@media (max-width: 768px) {
    .container {
        padding: 3px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .site-header { 
        margin-bottom: 5px;
    }
    
    .site-logo {
        max-height: 40px;
    }
    
    .category-filter { 
        gap: 2px; 
        margin-top: 3px;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 3px;
    }
    
    .cat-btn { 
        padding: 1px 6px; 
        font-size: 0.65em; 
        flex-shrink: 0; /* 防止按钮被压缩 */
    }
    
    .period-indicator {
        padding: 2px 4px;
        font-size: 0.65rem;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .table-controls { 
        padding: 3px 6px;
        font-size: 0.65rem;
        flex-wrap: wrap;
    }
    
    .sort-controls select {
        padding: 1px 3px;
        font-size: 0.65em;
        margin-top: 2px;
    }
    
    /* 移动端表格优化 */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* 移动端滚动更流畅 */
    }
    
    #serverTable {
        width: 100%;
        min-width: 0; /* 移除最小宽度限制 */
        font-size: 0.7rem;
    }
    
    #serverTable th,
    #serverTable td { 
        padding: 1px 2px;
        font-size: 0.7em; 
    }
    
    #serverTable th {
        font-size: 0.7em;
        padding: 2px 2px;
    }
    
    /* 移动端列宽调整 */
    #serverTable th:nth-child(1),
    #serverTable td:nth-child(1) {
        width: 24%;
    }
    
    #serverTable th:nth-child(2),
    #serverTable td:nth-child(2) {
        width: 14%;
    }
    
    #serverTable th:nth-child(3),
    #serverTable td:nth-child(3) {
        width: 13%;
    }
    
    #serverTable th:nth-child(4),
    #serverTable td:nth-child(4) {
        width: 13%;
    }
    
    #serverTable th:nth-child(5),
    #serverTable td:nth-child(5) {
        width: 10%;
    }
    
    #serverTable th:nth-child(6),
    #serverTable td:nth-child(6) {
        width: 16%;
    }
    
    #serverTable th:nth-child(7),
    #serverTable td:nth-child(7) {
        width: 10%;
    }
    
    .btn-detail { 
        padding: 1px 4px; 
        font-size: 0.65em; 
    }
    
    /* 确保服务器名和IP在移动端可点击区域足够大 */
    .server-name,
    .server-ip {
        min-height: 16px;
        line-height: 16px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    #serverTable {
        font-size: 0.65rem;
    }
    
    #serverTable th,
    #serverTable td {
        font-size: 0.65em;
        padding: 1px 1px;
    }
    
    .server-name,
    .server-ip {
        font-size: 0.7em;
    }
    
    .btn-detail {
        font-size: 0.6em;
        padding: 1px 3px;
    }
    
    .promotion-badge {
        font-size: 0.55em;
        padding: 0 2px;
    }
}
