/* ─── 全局样式重置与基本配置 ─── */
:root {
    --bg-color: #08090c;
    --card-bg: rgba(20, 24, 33, 0.5);
    --card-bg-hover: rgba(28, 34, 46, 0.65);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* 状态与角色颜色 */
    --neon-green: #00e676;
    --neon-red: #ff1744;
    --neon-orange: #ff9100;
    --color-cyan: #00e5ff;
    --color-purple: #bd00ff;
    --color-pink: #ff2d78;
    --color-amber: #ffb300;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* ─── 背景流光霓虹球特效 ─── */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--color-cyan) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.bg-glow-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--color-purple) 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
}

.bg-glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--color-pink) 0%, transparent 70%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ─── 毛玻璃底层样式 ─── */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass:hover {
    border-color: var(--border-color-hover);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.55);
}

/* ─── 页面主体容器 ─── */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ─── 头部栏 ─── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(0, 229, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 229, 255, 0.2);
    color: var(--color-cyan);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.25);
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: linear-gradient(to right, #ffffff, #a5f3fc, #00e5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .sub-title {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: block;
    margin-top: -2px;
}

.pulse-icon {
    animation: iconPulse 2s infinite ease-in-out;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 5px var(--color-cyan)); }
}

.header-center {
    display: flex;
    align-items: center;
}

.global-status-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.global-status-badge.online {
    background: rgba(0, 230, 118, 0.06);
    border-color: rgba(0, 230, 118, 0.25);
}

.global-status-badge.online .badge-dot {
    background-color: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
}

.global-status-badge.online .badge-text {
    color: var(--neon-green);
}

.global-status-badge.offline {
    background: rgba(255, 23, 68, 0.06);
    border-color: rgba(255, 23, 68, 0.25);
}

.global-status-badge.offline .badge-dot {
    background-color: var(--neon-red);
    box-shadow: 0 0 10px var(--neon-red);
}

.global-status-badge.offline .badge-text {
    color: var(--neon-red);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.badge-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.update-countdown {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.icon-small {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.btn-refresh {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.btn-refresh:active {
    transform: scale(0.95);
}

.btn-refresh svg {
    width: 16px;
    height: 16px;
}

/* ─── 硬件概览卡片区 ─── */
.summary-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.summary-card {
    padding: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
}

.summary-card.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.03);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.card-icon {
    width: 20px;
    height: 20px;
}

.card-value-container {
    margin: 4px 0;
}

.value-large {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
}

.value-large .unit {
    font-size: 16px;
    font-weight: 500;
    margin-left: 2px;
    color: var(--text-secondary);
}

.value-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 颜色辅助类 */
.text-cyan { color: var(--color-cyan); filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.3)); }
.text-purple { color: var(--color-purple); filter: drop-shadow(0 0 4px rgba(189, 0, 255, 0.3)); }
.text-pink { color: var(--color-pink); filter: drop-shadow(0 0 4px rgba(255, 45, 120, 0.3)); }
.text-amber { color: var(--color-amber); filter: drop-shadow(0 0 4px rgba(255, 179, 0, 0.3)); }

.bg-cyan { background-color: var(--color-cyan); box-shadow: 0 0 8px var(--color-cyan); }
.bg-purple { background-color: var(--color-purple); box-shadow: 0 0 8px var(--color-purple); }
.bg-pink { background-color: var(--color-pink); box-shadow: 0 0 8px var(--color-pink); }
.bg-amber { background-color: var(--color-amber); box-shadow: 0 0 8px var(--color-amber); }

/* ─── 历史趋势图表区 ─── */
.trend-section {
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.title-with-desc h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.section-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.time-range-tabs {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tab-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 7px;
    box-shadow: none;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-container-wrapper {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

/* ─── 双栏网格 ─── */
.main-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 24px;
}

@media (max-width: 600px) {
    .main-content-grid {
        grid-template-columns: 1fr;
    }
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-with-icon svg {
    width: 20px;
    height: 20px;
}

.title-with-icon h2 {
    font-size: 16px;
    font-weight: 600;
}

.badge-count {
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

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

/* ─── 项目与模型卡片 ─── */
.item-card {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.item-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 600;
}

/* 状态变化 */
.status-indicator.online {
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.2);
    color: var(--neon-green);
}
.status-indicator.online .indicator-dot {
    background-color: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
    animation: breathing 2s infinite ease-in-out;
}

.status-indicator.offline {
    background: rgba(255, 23, 68, 0.08);
    border: 1px solid rgba(255, 23, 68, 0.2);
    color: var(--neon-red);
}
.status-indicator.offline .indicator-dot {
    background-color: var(--neon-red);
    box-shadow: 0 0 6px var(--neon-red);
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

@keyframes breathing {
    0%, 100% { opacity: 0.6; box-shadow: 0 0 4px currentColor; }
    50% { opacity: 1; box-shadow: 0 0 8px currentColor; }
}

.latency-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.item-card-metrics.three-cols {
    grid-template-columns: 1fr 1.2fr 0.8fr;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

.metric-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── GPU 网格 ─── */
.gpu-drawer {
    padding: 24px;
}

.gpu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.gpu-item {
    padding: 16px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gpu-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gpu-name-tag {
    font-size: 13px;
    font-weight: 600;
}

.gpu-util-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-pink);
}

/* ─── 磁盘网格 ─── */
.storage-drawer {
    padding: 24px;
}

.storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.storage-item {
    padding: 16px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.storage-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.storage-mount {
    font-size: 14px;
    font-weight: 600;
    font-family: monospace;
}

.storage-percent-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-amber);
}

/* ─── Skeleton 加载骨架屏 ─── */
.skeleton-card {
    height: 98px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.04),
        transparent
    );
    animation: loadingSweep 1.6s infinite;
}

@keyframes loadingSweep {
    100% {
        transform: translateX(100%);
    }
}

/* ─── Footer ─── */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 4px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    flex-wrap: wrap;
    gap: 12px;
}

.app-footer p {
    font-weight: 500;
}

/* 响应式样式适配 */
@media (max-width: 900px) {
    .app-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    .header-center, .header-right {
        justify-content: center;
    }
}

/* ─── 登录验证遮罩层 ─── */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 9, 12, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    opacity: 1;
    visibility: visible;
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    width: 90%;
    max-width: 380px;
    padding: 36px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(20, 24, 33, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s;
}

.login-overlay.hidden .login-card {
    transform: scale(0.9);
}

.login-logo {
    margin-bottom: 20px;
}

.login-logo .logo-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(0, 229, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 229, 255, 0.15);
    color: var(--color-cyan);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}

.login-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #a5f3fc, #00e5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.login-card .input-group {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
}

.login-card #password-input {
    width: 100%;
    padding: 13px 44px 13px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.login-card #password-input:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.2), inset 0 0 8px rgba(0, 229, 255, 0.05);
}

.login-card .toggle-password-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.login-card .toggle-password-btn:hover {
    color: var(--text-secondary);
}

.login-error-msg {
    font-size: 12px;
    color: var(--neon-red);
    margin-bottom: 16px;
    align-self: flex-start;
    text-align: left;
    opacity: 0;
    transition: opacity 0.2s;
    padding-left: 4px;
}

.login-error-msg.visible {
    opacity: 1;
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.8) 0%, rgba(189, 0, 255, 0.8) 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.2);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.35), 0 0 15px rgba(189, 0, 255, 0.15);
    filter: brightness(1.08);
}

.btn-login:active {
    transform: translateY(0);
}

/* 错误抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.login-card.shake {
    animation: shake 0.35s ease-in-out;
    border-color: rgba(255, 23, 68, 0.4);
    box-shadow: 0 20px 50px rgba(255, 23, 68, 0.15);
}

