/* ===== 设计变量 ===== */
:root {
    --primary-color: #445ffc;
    --text-color: #333;
    --light-bg: #E5EDFF;
    --card-bg: #fff;
    --border-color: #e1e8ff;
    --hover-blue: #4285f4;
    --hover-bg: rgba(66, 133, 244, .08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    background: var(--light-bg);
    color: var(--text-color);
    min-height: 100vh;
}

/* ===== 顶部栏 ===== */
#header {
    background: var(--primary-color);
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    color: #fff;
    box-shadow: 0 2px 10px rgba(161, 189, 255, .4);
}

#menu-btn {
    font-size: 22px;
    cursor: pointer;
    background: none;
    border: none;
    color: #fff;
    margin-right: 15px;
    display: none;
}

#title {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
}

#header .logo {
    height: 40px;
    margin-left: auto;
    border-radius: 6px;
}

/* ===== 侧边栏 ===== */
#sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 220px;
    height: calc(100vh - 60px);
    background: #F0F5FF;
    box-shadow: 2px 0 10px rgba(0, 0, 0, .06);
    overflow-y: auto;
    z-index: 99;
    transition: left .3s;
}

#sidebar ul {
    list-style: none;
    padding: 10px 0;
}

#sidebar ul li {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 15px;
    color: #555;
    border-left: 3px solid transparent;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

#sidebar ul li:hover {
    background: var(--hover-bg);
    color: var(--hover-blue);
}

#sidebar ul li.active {
    background: var(--hover-bg);
    color: var(--hover-blue);
    border-left-color: var(--hover-blue);
    font-weight: bold;
}

/* ===== 内容区 ===== */
#content {
    margin-left: 220px;
    padding: 80px 20px 30px;
    min-height: 100vh;
    transition: margin-left .3s;
}

/* ===== Markdown 渲染容器 ===== */
.markdown-body {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 35px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-color);
}

/* ===== Markdown 元素样式 ===== */
.markdown-body h1 {
    font-size: 26px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    color: #2c5fd6;
}

.markdown-body h2 {
    font-size: 21px;
    margin: 24px 0 12px;
    color: #2c5fd6;
}

.markdown-body h3 {
    font-size: 17px;
    margin: 20px 0 10px;
    color: var(--hover-blue);
}

.markdown-body p { margin-bottom: 14px; }

.markdown-body ul,
.markdown-body ol {
    margin: 10px 0 14px 24px;
}

.markdown-body li { margin-bottom: 6px; }

.markdown-body code {
    background: var(--light-bg);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #2c5fd6;
}

.markdown-body pre {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 14px 0;
    border: 1px solid var(--border-color);
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: #333;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 8px 16px;
    background: var(--light-bg);
    border-radius: 0 6px 6px 0;
    margin: 14px 0;
    color: #555;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
}

.markdown-body th,
.markdown-body td {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.markdown-body th {
    background: var(--primary-color);
    color: #fff;
}

.markdown-body tr:hover td {
    background: var(--hover-bg);
}

.markdown-body a {
    color: var(--hover-blue);
    text-decoration: none;
}

.markdown-body a:hover { text-decoration: underline; }

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 8px;
}

/* ===== 加载提示 ===== */
.loading {
    text-align: center;
    color: #999;
    padding: 40px 0;
    font-size: 14px;
}

/* ===== 遮罩 ===== */
#mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .3);
    z-index: 98;
}

#mask.active { display: block; }

/* ===== 服务器状态卡片 ===== */
.status-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef2ff 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px dashed var(--border-color);
    margin-bottom: 18px;
}

.status-icon {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    overflow: hidden;
}

.status-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.status-title h2 {
    margin: 0 0 4px;
    color: #2c5fd6;
    font-size: 20px;
}

.status-title .host {
    color: #888;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    margin-left: auto;
}

.status-badge.online {
    background: #e6f9ee;
    color: #1a7d3a;
}

.status-badge.offline {
    background: #ffeaea;
    color: #c0392b;
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.status-item {
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
}

.status-item .label {
    color: #888;
    font-size: 12px;
    margin-bottom: 6px;
}

.status-item .value {
    color: var(--text-color);
    font-size: 16px;
    font-weight: bold;
}

.status-item .value.online { color: #1a7d3a; }
.status-item .value.offline { color: #c0392b; }

.status-motd {
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    margin-top: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    line-height: 1.6;
}

.status-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 8px 18px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background .2s;
}

.status-refresh:hover { background: var(--hover-blue); }

.status-refresh:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.status-meta {
    margin-top: 12px;
    font-size: 12px;
    color: #aaa;
    text-align: right;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    #menu-btn { display: block; }
    #sidebar { left: -220px; }
    #sidebar.active { left: 0; }
    #content { margin-left: 0; padding: 80px 15px 30px; }
    .markdown-body { padding: 20px; }
    .status-grid { grid-template-columns: 1fr; }
    .status-header { flex-wrap: wrap; }
    .status-badge { margin-left: 0; }
}
