/* Galaxy Web — 用户端全局样式 */
/* 注意：CSS 变量文件通过 <link> 在 index.html 中加载，不使用 @import */

/* ── 加载状态 ── */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── 深色主题覆盖（覆盖 variables.css 的浅色默认值）── */
:root {
    --color-bg: #0f172a;
    --color-card: rgba(255, 255, 255, 0.06);
    --color-text: #e2e8f0;
    --color-text-secondary: #94a3b8;
    --color-text-light: #e2e8f0;
    --color-border: rgba(255, 255, 255, 0.1);
    --color-sidebar: #0b0f1a;
    --color-sidebar-text: #c7d2fe;

    /* 卡片毛玻璃 */
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --topbar-bg: rgba(15, 23, 42, 0.8);
    --topbar-border: rgba(255, 255, 255, 0.08);

    /* 输入框 */
    --input-bg: rgba(255, 255, 255, 0.06);
    --input-border: rgba(255, 255, 255, 0.12);
    --input-focus-border: rgba(99, 102, 241, 0.5);

    /* 按钮 */
    --btn-bg: rgba(255, 255, 255, 0.08);
    --btn-border: rgba(255, 255, 255, 0.12);
    --btn-primary-bg: rgba(99, 102, 241, 0.2);
    --btn-primary-border: rgba(99, 102, 241, 0.35);
}

/* ── 强调色文字描边（覆盖 variables.css 全局效果）── */
.cw-up, .cw-badge--success { color: #4ade80; -webkit-text-stroke: 0.2px rgba(74, 222, 128, 0.3); }
.cw-down, .cw-badge--danger { color: #f87171; -webkit-text-stroke: 0.2px rgba(248, 113, 113, 0.3); }
.cw-badge--warning { color: #fbbf24; -webkit-text-stroke: 0.2px rgba(251, 191, 36, 0.3); }

/* ── 全局基础 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    line-height: 1.6;
}

a { color: #a5b4fc; text-decoration: none; }
a:hover { color: #6366f1; }

/* ── Portal 布局（首页 + 登录） ── */
.portal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    position: relative;
    overflow: hidden;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    position: relative;
    z-index: 10;
}

.portal-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e0e7ff;
    text-decoration: none;
}

.portal-nav { display: flex; gap: 1rem; }

.portal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.portal-footer {
    text-align: center;
    padding: 1.5rem;
    color: rgba(224, 231, 255, 0.5);
    font-size: 0.85rem;
    position: relative;
    z-index: 10;
}

/* ── 星星动画 ── */
.stars-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite alternate;
}
.star-1 { top: 10%; left: 20%; animation-delay: 0s; }
.star-2 { top: 30%; left: 70%; animation-delay: 0.5s; }
.star-3 { top: 60%; left: 40%; animation-delay: 1s; }
.star-4 { top: 80%; left: 80%; animation-delay: 1.5s; }
.star-5 { top: 50%; left: 10%; animation-delay: 2s; }

@keyframes twinkle {
    0% { opacity: 0.3; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.5); }
}

/* ── UserLayout ── */
.user-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0f172a;
}

.user-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.topbar-left { display: flex; align-items: center; gap: 2rem; }
.topbar-logo { font-size: 1.1rem; font-weight: 700; color: #e0e7ff; text-decoration: none; }
.topbar-nav { display: flex; gap: 1rem; }
.nav-link { color: #94a3b8; font-size: 0.9rem; padding: 0.25rem 0; }
.nav-link:hover { color: #a5b4fc; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-user { font-size: 0.85rem; color: #94a3b8; }

.user-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ── 首页 Hero ── */
.user-hero {
    text-align: center;
    padding: 4rem 2rem;
}
.user-hero h1 { font-size: 2.5rem; margin-bottom: 1rem; color: #e0e7ff; }
.user-hero p { font-size: 1.1rem; color: rgba(224,231,255,0.7); margin-bottom: 2rem; }

/* ── 登录页 ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
.login-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(12px);
}
.login-card h1 { text-align: center; margin-bottom: 0.5rem; font-size: 1.5rem; color: #e0e7ff; }
.login-hint { text-align: center; color: rgba(224,231,255,0.5); font-size: 0.85rem; margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; color: rgba(224,231,255,0.8); }
.form-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--input-border, rgba(255,255,255,0.15));
    border-radius: 0.5rem;
    background: var(--input-bg, rgba(255,255,255,0.08));
    color: #e2e8f0;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--input-focus-border, rgba(99,102,241,0.5)); }
.form-input::placeholder { color: rgba(224,231,255,0.3); }

/* ── 按钮 ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--btn-border, rgba(255,255,255,0.2));
    border-radius: 0.5rem;
    background: var(--btn-bg, rgba(255,255,255,0.15));
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { background: rgba(255,255,255,0.25); }
.btn-primary {
    background: var(--btn-primary-bg, rgba(99,102,241,0.25));
    border-color: var(--btn-primary-border, rgba(99,102,241,0.35));
    color: white;
}
.btn-primary:hover { background: rgba(99,102,241,0.4); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ── 卡片 ── */
.card {
    background: var(--card-bg, rgba(255,255,255,0.15));
    border: 1px solid var(--card-border, rgba(255,255,255,0.2));
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.card-link { text-decoration: none; color: inherit; display: block; }

/* ── 警告/提示 ── */
.alert-error {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(234,67,53,0.3);
    border-radius: 0.5rem;
    background: rgba(234,67,53,0.12);
    color: #fca5a5;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ── Toast ── */
.toast {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-top: 1rem;
}
.toast-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.toast-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }

/* ── 标题 ── */
.subtitle { color: var(--color-text-secondary, #94a3b8); font-size: 0.95rem; margin-top: 0.25rem; }

/* ── Badge ── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
}

/* ── 404 ── */
.not-found {
    text-align: center;
    padding: 4rem 2rem;
}
.not-found h1 { font-size: 4rem; color: rgba(224,231,255,0.3); }
.not-found p { color: rgba(224,231,255,0.5); margin-top: 0.5rem; }

/* ── Blazor 错误 UI ── */
#blazor-error-ui {
    background: rgba(239,68,68,0.9);
    color: white;
    padding: 0.5rem 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: none;
    z-index: 9999;
    font-size: 0.85rem;
}
#blazor-error-ui .reload { color: white; text-decoration: underline; margin-left: 1rem; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ── ECO 状态栏 ── */
.eco-statusbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    color: rgba(148, 163, 184, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    user-select: none;
    z-index: 1000;
}

.eco-statusbar__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.3s;
}

.eco-statusbar__dot--connected {
    background-color: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.eco-statusbar__dot--connecting {
    background-color: #fbbf24;
    animation: pulse-dot 1.2s ease-in-out infinite;
}

.eco-statusbar__dot--error {
    background-color: #f87171;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.eco-statusbar__dot--disconnected {
    background-color: rgba(148, 163, 184, 0.4);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.eco-statusbar__label {
    font-weight: 600;
    color: rgba(165, 180, 252, 0.8);
    letter-spacing: 0.03em;
}

.eco-statusbar__state {
    color: rgba(148, 163, 184, 0.6);
}

.eco-statusbar__sep {
    color: rgba(148, 163, 184, 0.3);
}

.eco-statusbar__info {
    color: rgba(148, 163, 184, 0.5);
}

/* ── 动态表单结果 / Markdown ── */
.cw-form-result {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius);
    background: rgba(34,197,94,0.06);
    border: 1px solid rgba(34,197,94,0.15);
}
.cw-form-result__raw {
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin: 0;
    color: var(--color-success);
}
.md-body {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--color-text, #e5e7eb);
}
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
    margin: 0.75em 0 0.4em;
    font-weight: 600;
}
.md-body h1 { font-size: 1.25rem; }
.md-body h2 { font-size: 1.15rem; }
.md-body h3 { font-size: 1.05rem; }
.md-body p { margin: 0.5em 0; }
.md-body ul, .md-body ol { margin: 0.4em 0 0.4em 1.2em; padding-left: 0.5em; }
.md-body li { margin: 0.2em 0; }
.md-body code {
    background: rgba(255,255,255,0.08);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88em;
}
.md-body pre.md-code {
    background: rgba(0,0,0,0.35);
    padding: 0.75em 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.6em 0;
}
.md-body pre.md-code code { background: none; padding: 0; }
.md-body blockquote {
    border-left: 3px solid var(--color-primary, #6366f1);
    margin: 0.6em 0;
    padding: 0.2em 0 0.2em 0.8em;
    opacity: 0.9;
}
.md-body a { color: var(--color-primary, #818cf8); }
