/* ============================================================
   天域国度 PWA 排行榜网站 - 样式表
   ============================================================ */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: #58a6ff;
    text-decoration: none;
}
a:hover {
    color: #79c0ff;
}

/* ============================================================
   头部导航
   ============================================================ */
.header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    font-size: 1.3rem;
    color: #f0f6fc;
    white-space: nowrap;
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: #8b949e;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover {
    color: #f0f6fc;
    background: #21262d;
}
.nav-link.active {
    color: #f0f6fc;
    background: #1f6feb;
}

/* ============================================================
   主体
   ============================================================ */
.main {
    flex: 1;
    padding: 30px 20px;
}

h2 {
    font-size: 1.5rem;
    color: #f0f6fc;
    margin-bottom: 8px;
}
h3 {
    font-size: 1.15rem;
    color: #f0f6fc;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #21262d;
}
h4 {
    color: #58a6ff;
    margin: 12px 0 8px;
}

.subtitle {
    color: #8b949e;
    margin-bottom: 24px;
}

/* ============================================================
   首页
   ============================================================ */
.hero {
    text-align: center;
    padding: 40px 0;
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 24px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 24px;
}

.stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px 40px;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: #58a6ff;
}

.stat-label {
    color: #8b949e;
    font-size: 0.9rem;
}

.intro {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 32px;
}

.intro p {
    margin-bottom: 8px;
}

.intro .hint {
    color: #8b949e;
    font-style: italic;
}

.link-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.link-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 24px;
    transition: all 0.2s;
}
.link-card:hover {
    border-color: #58a6ff;
    transform: translateY(-2px);
}
.link-card h4 {
    color: #58a6ff;
    margin-bottom: 8px;
}
.link-card p {
    color: #8b949e;
    font-size: 0.9rem;
}

/* ============================================================
   搜索框
   ============================================================ */
.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 0.95rem;
}
.search-input:focus {
    outline: none;
    border-color: #58a6ff;
}

.search-select {
    padding: 10px 16px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 0.95rem;
}

.search-hint {
    color: #8b949e;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #21262d;
    color: #c9d1d9;
    white-space: nowrap;
}
.btn:hover {
    background: #30363d;
    color: #f0f6fc;
}
.btn-primary {
    background: #238636;
    border-color: #238636;
    color: #fff;
}
.btn-primary:hover {
    background: #2ea043;
}
.btn-secondary {
    background: #21262d;
    border-color: #30363d;
    color: #8b949e;
}
.btn-small {
    padding: 5px 12px;
    font-size: 0.8rem;
}

/* ============================================================
   表格
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid #30363d;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: #161b22;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #8b949e;
    border-bottom: 1px solid #30363d;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #21262d;
}

.data-table tbody tr:hover {
    background: #161b22;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.steamid-cell {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.85rem;
    color: #8b949e;
}

.points-cell {
    font-weight: 600;
    color: #58a6ff;
}

.empty-cell {
    text-align: center;
    color: #8b949e;
    padding: 40px 16px !important;
}

/* ============================================================
   徽章
   ============================================================ */
.vip-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #9c6b0a;
    color: #ffd54f;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.rank-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}
.rank-0 { background: #6b3a1f; color: #cd7f32; }  /* 青铜 */
.rank-1 { background: #5a5a6e; color: #c0c0c0; }  /* 白银 */
.rank-2 { background: #7a6320; color: #ffd700; }  /* 黄金 */
.rank-3 { background: #1a3a5c; color: #58a6ff; }  /* 星钻 */
.rank-4 { background: #4a0a5c; color: #d291e0; }  /* 大佬 */

.ban-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}
.ban-status.active { background: #5a1e1e; color: #f85149; }
.ban-status.expired { background: #1e3a1e; color: #56d364; }
.ban-status.permanent { background: #3a1e1e; color: #ff7b72; }

/* ============================================================
   玩家详情页
   ============================================================ */
.breadcrumb {
    margin-bottom: 16px;
}
.breadcrumb a {
    color: #8b949e;
    font-size: 0.9rem;
}

.player-header {
    display: flex;
    gap: 20px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.player-avatar {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #1f6feb, #58a6ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.avatar-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.player-summary {
    flex: 1;
    min-width: 250px;
}
.player-summary h3 {
    margin: 0 0 12px;
    border: none;
    font-size: 1.3rem;
}

.player-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}
.meta-label {
    font-size: 0.8rem;
    color: #8b949e;
}
.meta-value {
    font-size: 0.95rem;
    color: #f0f6fc;
    font-family: "Consolas", "Courier New", monospace;
}

.player-titles {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.titles-label {
    color: #8b949e;
    font-size: 0.85rem;
}

.title-tag {
    padding: 2px 10px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #c9d1d9;
}
.title-tag.title-active {
    background: #1f3a5a;
    border-color: #58a6ff;
    color: #58a6ff;
    font-weight: 600;
}

/* 数据统计 */
.stats-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .stats-section {
        grid-template-columns: 1fr;
    }
}

.stats-group {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
}

.stats-group h4 {
    margin: 0 0 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.stat-item {
    background: #0d1117;
    border-radius: 6px;
    padding: 10px 8px;
    text-align: center;
}
.stat-item.highlight {
    background: #0d1a2d;
    border: 1px solid #1f6feb;
}
.stat-item.negative {
    background: #1a0d0d;
}

.stat-name {
    display: block;
    font-size: 0.75rem;
    color: #8b949e;
    margin-bottom: 4px;
}
.stat-val {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f0f6fc;
    font-family: "Consolas", "Courier New", monospace;
}

.active-title {
    color: #58a6ff;
    font-weight: 600;
}

/* ============================================================
   封禁列表
   ============================================================ */
.ban-row.ban-active {
    border-left: 3px solid #f85149;
}
.ban-row.ban-expired {
    opacity: 0.6;
}
.ban-row.ban-permanent {
    border-left: 3px solid #ff7b72;
}

.reason-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   插件相关页面
   ============================================================ */
.mode-section {
    margin-bottom: 32px;
}
.mode-section .tag {
    font-size: 0.8rem;
    color: #8b949e;
    font-weight: normal;
}

.mode-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .mode-columns {
        grid-template-columns: 1fr;
    }
}

.mode-col {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px;
}

.compare-table, .simple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.compare-table th, .simple-table th {
    background: #0d1117;
    padding: 8px 12px;
    text-align: left;
    color: #58a6ff;
    border-bottom: 1px solid #30363d;
}

.compare-table td, .simple-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #21262d;
}

.compare-table tbody tr:hover, .simple-table tbody tr:hover {
    background: #1c2128;
}

/* ============================================================
   分页
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.page-info {
    color: #8b949e;
    font-size: 0.9rem;
}

/* ============================================================
   404
   ============================================================ */
.not-found {
    text-align: center;
    padding: 60px 0;
}
.not-found h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}
.not-found p {
    color: #8b949e;
    margin-bottom: 24px;
}

/* ============================================================
   底部
   ============================================================ */
.footer {
    background: #161b22;
    border-top: 1px solid #30363d;
    padding: 16px 0;
    text-align: center;
    font-size: 0.85rem;
    color: #484f58;
    margin-top: auto;
}

/* ============================================================
   排名查询页
   ============================================================ */
.ranking-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 6px 12px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #8b949e;
    font-size: 0.82rem;
    white-space: nowrap;
    transition: all 0.15s;
}
.tab-btn:hover {
    color: #f0f6fc;
    background: #30363d;
}
.tab-btn.active {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
}
.tab-btn small {
    color: inherit;
    opacity: 0.7;
    font-size: 0.7rem;
}

.tab-divider {
    width: 1px;
    background: #30363d;
    margin: 4px 4px;
    align-self: stretch;
}

.ranking-header {
    margin-bottom: 12px;
}
.ranking-header h3 {
    margin: 0;
    padding: 0;
    border: none;
}
.ranking-limit {
    font-size: 0.8rem;
    color: #58a6ff;
    font-weight: normal;
    margin-left: 8px;
}

.rankings-table .rank-cell {
    text-align: center;
    width: 60px;
}
.rankings-table .sort-col {
    color: #58a6ff;
}
.rankings-table .sort-value {
    font-weight: 700;
    color: #f0f6fc;
    font-family: "Consolas", "Courier New", monospace;
}

.rank-icon {
    font-size: 1.2rem;
}
.rank-num {
    color: #8b949e;
    font-weight: 600;
}

tr.top-three {
    background: rgba(31, 111, 235, 0.06);
}
tr.top-three:hover {
    background: rgba(31, 111, 235, 0.12) !important;
}

/* ============================================================
   服务器查询页
   ============================================================ */
.servers-header {
    margin-bottom: 24px;
}
.servers-header h2 {
    margin-bottom: 4px;
}
.servers-header p {
    color: #8b949e;
    margin-bottom: 12px;
}

.servers-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.refresh-status {
    color: #56d364;
    font-size: 0.85rem;
}

/* 服务器卡片 */
.servers-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* 响应式：屏幕较小时自动变为单列 */
@media (max-width: 650px) {
    .servers-list {
        grid-template-columns: 1fr;
    }
}

.server-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    overflow: hidden;
}

.server-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #21262d;
    flex-wrap: wrap;
    gap: 12px;
}

.server-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.server-card-title h3 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.1rem;
}

.server-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.server-card-body {
    padding: 16px 20px;
}

.server-loading {
    color: #8b949e;
    font-style: italic;
    padding: 12px 0;
}

.server-offline {
    color: #f85149;
    padding: 12px 0;
}

/* 状态指示灯 */
.server-status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.server-status-dot.offline {
    background: #f85149;
    box-shadow: 0 0 6px #f85149;
}
.server-status-dot.online {
    background: #56d364;
    box-shadow: 0 0 8px #56d364;
}
.server-status-dot.loading {
    background: #d29922;
    box-shadow: 0 0 6px #d29922;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 服务器信息网格 */
.server-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.info-item {
    background: #0d1117;
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-label {
    font-size: 0.75rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 0.92rem;
    color: #f0f6fc;
}
.info-value code {
    background: #21262d;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #79c0ff;
}

.player-count.normal { color: #56d364; }
.player-count.busy   { color: #d29922; }
.player-count.full   { color: #f85149; }

/* 玩家列表 */
.player-list {
    margin-top: 8px;
}

.player-list-title {
    font-size: 0.9rem;
    color: #8b949e;
    margin-bottom: 8px;
}

.player-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    border: 1px solid #21262d;
    border-radius: 6px;
    overflow: hidden;
}
.player-table th {
    background: #0d1117;
    padding: 8px 12px;
    text-align: left;
    color: #8b949e;
    font-weight: 600;
    border-bottom: 1px solid #30363d;
}
.player-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #21262d;
    color: #c9d1d9;
}
.player-table tbody tr:last-child td {
    border-bottom: none;
}
.player-table tbody tr:hover {
    background: #1c2128;
}

.no-players {
    color: #484f58;
    font-style: italic;
    padding: 8px 0;
}

/* 加入游戏按钮 */
.btn-join {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
    font-weight: 600;
}
.btn-join:hover {
    background: #388bfd;
    border-color: #388bfd;
    color: #fff;
}

/* RCON 面板 */
.rcon-panel {
    border-top: 1px solid #30363d;
    background: #0d1117;
}

.rcon-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #161b22;
    border-bottom: 1px solid #21262d;
}
.rcon-header h4 {
    margin: 0;
    color: #d29922;
    font-size: 0.95rem;
}

.rcon-output {
    height: 200px;
    overflow-y: auto;
    padding: 10px 20px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.82rem;
    background: #06090f;
    border-bottom: 1px solid #21262d;
}

.rcon-line {
    padding: 2px 0;
    color: #c9d1d9;
    white-space: pre-wrap;
    word-break: break-all;
}
.rcon-line.cmd {
    color: #58a6ff;
}
.rcon-line.error {
    color: #f85149;
}
.rcon-line.hint {
    color: #484f58;
    font-style: italic;
}

.rcon-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
}

.rcon-input {
    flex: 1;
    padding: 8px 12px;
    background: #06090f;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.85rem;
}
.rcon-input:focus {
    outline: none;
    border-color: #d29922;
}

.rcon-quick-cmds {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px 12px;
    flex-wrap: wrap;
}

.rcon-quick-label {
    color: #484f58;
    font-size: 0.78rem;
    margin-right: 4px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-xs:hover {
    color: #c9d1d9;
    border-color: #484f58;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    color: #8b949e;
    cursor: pointer;
}
.btn-sm:hover {
    color: #f0f6fc;
}

.btn-rcon-toggle {
    background: #21262d;
    border: 1px solid #484f58;
    color: #d29922;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-rcon-toggle:hover {
    background: #30363d;
    color: #f0c040;
}
