/* ============================================================
 * 午马清谷监控系统 — H5 手机端样式
 * 设计原则：深色主题、卡片式布局、微信内置浏览器优化
 * ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

/* ======================== 设计令牌 ======================== */

:root {
    /* 颜色 */
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d28;
    --bg-card: #1e2235;
    --bg-card-hover: #252a3a;

    --text-primary: #e8eaed;
    --text-secondary: #9aa0b4;
    --text-muted: #636980;

    --accent: #4f8cff;
    --accent-light: #6ba1ff;
    --accent-glow: rgba(79, 140, 255, 0.15);

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.12);

    --border: rgba(255, 255, 255, 0.06);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);

    /* 布局 */
    --radius: 12px;
    --radius-sm: 8px;
    --spacing: 16px;
    --max-width: 480px;

    /* 过渡 */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======================== 基础重置 ======================== */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* ======================== 页面容器 ======================== */

.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

/* ======================== 顶部导航 ======================== */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px var(--spacing);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--success);
}

.header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

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

/* ======================== 底部导航 ======================== */

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(26, 29, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-bar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 4px;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    color: var(--text-muted);
    font-size: 10px;
    transition: color var(--transition);
    cursor: pointer;
}

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

.tab-item svg {
    width: 22px;
    height: 22px;
}

/* ======================== 统计卡片 ======================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: var(--spacing) 0;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.stat-card:active {
    transform: scale(0.97);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.1;
}

.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-value.warning { color: var(--warning); }
.stat-value.info { color: var(--info); }

/* ======================== 健康评分圆环 ======================== */

.health-ring {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: var(--spacing) 0;
}

.health-ring svg {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.health-ring circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.health-ring .bg {
    stroke: var(--bg-secondary);
}

.health-ring .fg {
    stroke: var(--success);
    transition: stroke-dashoffset 1s ease;
}

.health-score {
    position: absolute;
    font-size: 36px;
    font-weight: 700;
}

.health-score-unit {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.health-label {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ======================== 列表 ======================== */

.section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 20px 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title .badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-glow);
    color: var(--accent);
}

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

.list-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all var(--transition);
    cursor: pointer;
}

.list-item:active {
    background: var(--bg-card-hover);
    transform: scale(0.99);
}

.list-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.list-item-icon.success { background: var(--success-bg); }
.list-item-icon.danger { background: var(--danger-bg); }
.list-item-icon.warning { background: var(--warning-bg); }
.list-item-icon.info { background: var(--info-bg); }

.list-item-body {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    flex-shrink: 0;
}

/* ======================== 状态标签 ======================== */

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.status-dot.unknown { background: var(--text-muted); }

.priority-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.priority-tag.p5 { background: var(--danger-bg); color: var(--danger); }
.priority-tag.p4 { background: var(--danger-bg); color: var(--danger); }
.priority-tag.p3 { background: var(--warning-bg); color: var(--warning); }
.priority-tag.p2 { background: var(--warning-bg); color: var(--warning); }
.priority-tag.p1 { background: var(--info-bg); color: var(--info); }

/* ======================== 筛选栏 ======================== */

.filter-bar {
    display: flex;
    gap: 8px;
    margin: var(--spacing) 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ======================== 空状态 ======================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 14px;
}

/* ======================== 加载动画 ======================== */

.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======================== 工具类 ======================== */

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
