/* ===== Project Portal · Modern UI ===== */

:root {
    --bg-1: #0f172a;
    --bg-2: #1e1b4b;
    --accent: #818cf8;
    --accent-2: #c084fc;
    --glass: rgba(255, 255, 255, 0.07);
    --glass-strong: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.14);
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --text-faint: #64748b;
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.12);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.12);
    --radius: 20px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter",
                 "PingFang SC", "Segoe UI", sans-serif;
    color: var(--text);
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 背景动态光斑 */
body::before, body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}
body::before {
    width: 520px; height: 520px;
    background: var(--accent);
    top: -160px; left: -120px;
    animation: drift1 16s ease-in-out infinite;
}
body::after {
    width: 480px; height: 480px;
    background: var(--accent-2);
    bottom: -140px; right: -100px;
    animation: drift2 18s ease-in-out infinite;
}
@keyframes drift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(70px, 50px) scale(1.1); }
}
@keyframes drift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-60px, -70px) scale(1.15); }
}

a { color: inherit; text-decoration: none; }
h1, h2 { font-weight: 700; letter-spacing: -0.02em; }

/* ===== 登录页 ===== */
.login-page { display: flex; align-items: center; justify-content: center; padding: 24px; }

.login-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 44px 38px 38px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.logo-mark {
    width: 56px; height: 56px;
    margin-bottom: 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid; place-items: center;
    box-shadow: 0 8px 24px rgba(129, 140, 248, 0.4);
}
.logo-mark svg { width: 30px; height: 30px; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.login-card h1 { font-size: 1.7rem; margin-bottom: 6px; }

.muted { color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; }

.stack { display: grid; gap: 16px; margin-top: 28px; }

.field { display: grid; gap: 7px; }
.field span {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s, background 0.2s;
}
input::placeholder { color: var(--text-faint); }
input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.3);
}

/* ===== 按钮 ===== */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 11px 18px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: transform 0.15s, filter 0.2s, background 0.2s;
}
.button:active { transform: scale(0.97); }

.button-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 6px 20px rgba(129, 140, 248, 0.3);
}
.button-primary:hover { filter: brightness(1.1); }

.button-secondary {
    background: var(--glass-strong);
    color: var(--text);
    border: 1px solid var(--glass-border);
}
.button-secondary:hover { background: rgba(255, 255, 255, 0.18); }

.button-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.3);
}
.button-danger:hover { background: rgba(248, 113, 113, 0.25); }

.button-ghost {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
}
.button-ghost:hover { color: var(--text); border-color: var(--text-dim); }

/* ===== 仪表盘 ===== */
.topbar {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 36px 0 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.topbar .eyebrow { margin-bottom: 4px; }
.topbar h1 { font-size: 1.5rem; }

.topbar-actions { display: flex; gap: 10px; }

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding-bottom: 40px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.project-card {
    padding: 26px;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: transform 0.25s, border-color 0.25s;
}
.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(129, 140, 248, 0.35);
}

.project-head { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; }
.project-head h2 { font-size: 1.25rem; margin-bottom: 4px; }

/* 状态指示器 */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.status-pill::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
}
.status-running {
    background: var(--green-bg);
    color: var(--green);
}
.status-running::before {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s ease-in-out infinite;
}
.status-stopped {
    background: var(--red-bg);
    color: var(--red);
}
.status-stopped::before { background: var(--red); }

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

/* 元信息 */
.project-meta {
    display: grid;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.project-meta div { display: grid; gap: 3px; }
dt {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}
dd {
    font-size: 0.86rem;
    color: var(--text-dim);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* 操作区 */
.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}
.project-actions .button-primary { flex: 1; }
.inline-form { margin: 0; }

/* Flash 消息 */
.flash {
    padding: 13px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
}
.flash-success {
    background: var(--green-bg);
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.25);
}
.flash-error {
    background: var(--red-bg);
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.25);
}

/* ===== 资源监控条 ===== */
.stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}
.stat-block {
    padding: 18px 20px;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}
.stat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.stat-head svg { color: var(--accent); }
.stat-head span { color: var(--text-dim); font-weight: 600; }
.stat-head strong { margin-left: auto; font-size: 1.3rem; font-weight: 700; }
.stat-sub { font-size: 0.74rem !important; font-weight: 500 !important; color: var(--text-faint) !important; margin-left: 8px; }
.meter {
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 999px;
    overflow: hidden;
}
.meter-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}
.meter-fill.cpu { background: linear-gradient(90deg, #818cf8, #c084fc); }
.meter-fill.mem { background: linear-gradient(90deg, #34d399, #2dd4bf); }

/* 区块标题 */
.section-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}
.section-title h2 { font-size: 1.1rem; }

@media (max-width: 720px) {
    .topbar { flex-direction: column; align-items: flex-start; }
    .topbar-actions { width: 100%; }
    .topbar-actions .button { flex: 1; }
    .login-card { padding: 36px 26px 30px; }
    .stats-bar { grid-template-columns: 1fr; }
}
