/* ==================== LinkHub 管理后台样式 V5 ==================== */
/* 深色侧边栏 · 暗色顶栏 · 亮色内容区 · 紫蓝渐变 · 毛玻璃 · 粒子动画 */

/* ==================== 设计令牌 ==================== */
:root {
    /* 主色 - 紫蓝渐变体系 */
    --primary: #6A5CFF;
    --primary-hover: #5a4de6;
    --primary-light: rgba(106, 92, 255, 0.08);
    --primary-bg: rgba(106, 92, 255, 0.04);
    --primary-border: rgba(106, 92, 255, 0.30);
    --gradient-primary: linear-gradient(135deg, #6A5CFF, #16B7FF);
    /* 辅助强调色 */
    --accent2: #16B7FF;

    /* 功能色 - 现代商务风 */
    --success: #1FBF83;
    --success-bg: rgba(31, 191, 131, 0.10);
    --warning: #FF9A1A;
    --warning-bg: rgba(255, 154, 26, 0.10);
    --danger: #FF3B6A;
    --danger-bg: rgba(255, 59, 106, 0.10);
    --info: #16B7FF;
    --info-bg: rgba(22, 183, 255, 0.10);

    /* 文字色 */
    --text-primary: #0C1222;
    --text-secondary: rgba(12, 18, 34, 0.70);
    --text-tertiary: rgba(12, 18, 34, 0.52);
    --text-inverse: #ffffff;

    /* 背景色 - 渐变底色 */
    --bg-primary: rgba(255, 255, 255, 0.78);
    --bg-secondary: rgba(255, 255, 255, 0.55);
    --bg-tertiary: rgba(244, 247, 255, 0.6);
    --bg-elevated: rgba(255, 255, 255, 0.92);
    --bg-page: #F4F7FF;
    --bg-page-solid: #F4F7FF;
    --bg-hover: rgba(106, 92, 255, 0.04);
    --bg-active: rgba(106, 92, 255, 0.06);

    /* 边框色 - 半透明玻璃感 */
    --border: rgba(22, 29, 55, 0.10);
    --border-light: rgba(22, 29, 55, 0.06);
    --border-focus: var(--primary);

    /* 中性色阶 */
    --gray-50: #f8f9fc;
    --gray-100: #f0f2f7;
    --gray-200: #e2e5ed;
    --gray-300: #cdd1dc;
    --gray-400: rgba(12, 18, 34, 0.52);
    --gray-500: rgba(12, 18, 34, 0.70);
    --gray-600: rgba(12, 18, 34, 0.80);
    --gray-700: #0C1222;
    --gray-800: #080d1a;
    --gray-900: #050812;

    /* 侧边栏专用色 - 深色渐变风格（123.html 模板） */
    --sidebar-bg-start: #0f172a;
    --sidebar-bg-end: #1e1b4b;
    --sidebar-text: #94a3b8;
    --sidebar-text-bright: #e2e8f0;
    --sidebar-text-dim: #64748b;
    --sidebar-active-bg: rgba(255, 255, 255, 0.10);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --sidebar-active-border: #8b5cf6;

    /* 顶栏专用色 - 与侧边栏保持一致的深色 */
    --topbar-bg: var(--sidebar-bg-start);
    --topbar-text: #ffffff;
    --topbar-text-dim: #94a3b8;

    /* 布局 */
    --sidebar-width: 250px;
    --topbar-height: 56px;

    /* 圆角 - 现代商务风大圆角 */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* 阴影 - 柔和发光 */
    --shadow-xs: 0 1px 3px rgba(22, 29, 55, 0.04);
    --shadow-sm: 0 2px 8px rgba(22, 29, 55, 0.06);
    --shadow: 0 4px 16px rgba(22, 29, 55, 0.08);
    --shadow-md: 0 8px 30px rgba(22, 29, 55, 0.10);
    --shadow-lg: 0 14px 40px rgba(22, 29, 55, 0.12);
    /* 聚焦光环 */
    --ring: 0 0 0 3px rgba(106, 92, 255, 0.22);

    /* 毛玻璃 */
    --blur: 14px;

    /* 过渡 */
    --transition: all 0.22s ease;
    --transition-fast: all 0.12s ease;
    --transition-spring: all 0.25s cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* ==================== 全局重置 ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    /* 浅灰色背景（123.html 风格） */
    background: #f1f5f9;
    background-attachment: fixed;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* 文字选中色 - 紫色 */
::selection { background: rgba(106, 92, 255, 0.25); }

a { text-decoration: none; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* 滚动条 - Notion 风格极细 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(55, 53, 47, 0.16); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: rgba(55, 53, 47, 0.3); }

/* ==================== 登录页面 - 深色渐变背景+毛玻璃 ==================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* 深色渐变背景，与侧边栏风格呼应 */
    background:
        radial-gradient(1200px 820px at 10% 5%, rgba(99, 102, 241, 0.25), transparent 62%),
        radial-gradient(1100px 760px at 92% 10%, rgba(139, 92, 246, 0.20), transparent 64%),
        radial-gradient(900px 600px at 50% 105%, rgba(16, 185, 129, 0.10), transparent 62%),
        linear-gradient(180deg, #0f172a, #1e1b4b);
    background-attachment: fixed;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.10);
    text-align: center;
    animation: loginBoxIn 0.4s ease;
    position: relative;
    overflow: hidden;
}

/* 登录卡片顶部光泽 */
.login-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    pointer-events: none;
}

@keyframes loginBoxIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    margin-bottom: 8px;
}
.login-logo img {
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 32px;
}

/* ==================== 表单组件 ==================== */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 13px;  /* 从 12px 调整为 13px */
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* 登录页面表单标签适配深色背景 */
.login-box .form-label {
    color: #94a3b8;
}

/* 登录页面输入框适配深色背景 */
.login-box .form-input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.10);
    color: #e2e8f0;
}

.login-box .form-input:focus {
    background: rgba(255, 255, 255, 0.10);
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.login-box .form-input::placeholder {
    color: #64748b;
}

.form-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(22, 29, 55, 0.10);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: var(--transition);
    outline: none;
    font-family: inherit;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
    background: rgba(255, 255, 255, 0.85);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input-sm {
    padding: 6px 8px;
    font-size: 14px;  /* 从 13px 调整为 14px */
}

select.form-input {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239b9a97' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

/* ==================== 按钮系统 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

/* 主按钮 - 紫蓝渐变 */
.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(106, 92, 255, 0.35);
    transform: translateY(-1px);
}

/* 成功按钮 */
.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover { opacity: 0.9; }

/* 危险按钮 */
.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover { opacity: 0.9; }

/* 次要按钮 */
.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

/* 幽灵按钮 */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

/* 轮廓按钮 */
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary-border);
}

.btn-outline:hover {
    background: var(--primary-light);
}

/* 警告按钮 */
.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover { opacity: 0.9; }

/* 按钮尺寸 */
.btn-sm {
    padding: 4px 8px;
    font-size: 13px;  /* 从 12px 调整为 13px */
}

.btn-block {
    width: 100%;
    padding: 10px;
    font-size: 15px;
    margin-top: 8px;
}

/* ==================== 管理后台布局 ==================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    /* 外层背景与侧边栏一致，让 main-content 圆角处露出深色底色 */
    background: linear-gradient(180deg, var(--sidebar-bg-start), var(--sidebar-bg-end));
}

/* ==================== 侧边栏 - 深色渐变风格（123.html 模板） ==================== */
.sidebar {
    width: var(--sidebar-width);
    /* 深色渐变背景 */
    background: linear-gradient(180deg, var(--sidebar-bg-start), var(--sidebar-bg-end));
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
    padding: 20px 16px;
    border-right: none;
    /* 去掉阴影，避免与顶栏交界处出现竖线 */
    box-shadow: none;
}

/* 侧边栏头部 */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 24px;
    border-radius: 0;
}

.sidebar-logo {
    /* 图标容器 — 直接展示 SVG 图标 */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}
.sidebar-logo img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    /* 渐变文字效果 */
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 侧边栏导航 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* 分区标签 - 深色侧边栏风格：小号大写字母 */
.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--sidebar-text-dim);
    padding: 0 12px 6px;
    margin-top: 18px;
    margin-bottom: 8px;
    text-transform: uppercase;
    border-bottom: none;
}

/* 第一个分区标签不需要上边距 */
.sidebar-nav .nav-section-label:first-child {
    margin-top: 0;
}

/* 导航项 - 深色侧边栏风格：圆角、hover 平移 */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 500;
    position: relative;
    margin-bottom: 4px;
    border: none;
    overflow: hidden;
}

/* 导航项 hover - 深色背景下的微亮效果 + 右移 */
.nav-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-item:hover {
    color: #fff;
    background: var(--sidebar-hover-bg);
    transform: translateX(4px);
    border: none;
}

.nav-item:hover::after {
    opacity: 0;
    animation: none;
}

/* 激活项 - 左侧紫色竖线 + 半透明背景 */
.nav-item.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    box-shadow: inset 3px 0 0 0 var(--sidebar-active-border);
    border: none;
    font-weight: 600;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), transparent);
    pointer-events: none;
    opacity: 1;
    animation: none;
    display: block;
}

/* 移除旧的 active 伪元素竖线 */
.nav-item.active::before {
    display: none;
}

/* 导航图标 - 深色侧边栏风格：无背景方块，图标直接显示 */
.nav-icon {
    font-size: 1rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* hover 时图标变色放大 */
.nav-item:hover .nav-icon {
    transform: scale(1.1);
    color: #a78bfa;
}

/* 激活项图标 - 白色 */
.nav-item.active .nav-icon {
    background: transparent;
    border: none;
    color: #fff;
}

.nav-text { flex: 1; }

/* 导航组（可折叠） */
.nav-arrow {
    font-size: 13px;
    transition: var(--transition);
    opacity: 0.5;
}

.nav-group-toggle.expanded .nav-arrow {
    transform: rotate(90deg);
}

.nav-group-children {
    display: none;
    padding-left: 8px;
}

.nav-group-children.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-child {
    padding-left: 32px;
    font-size: 13px;
}

.nav-child::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--sidebar-text-dim);
    transition: var(--transition);
}

.nav-child.active::before,
.nav-child:hover::before {
    background: #a78bfa;
}

/* 子项激活样式 - 深色侧边栏 */
.nav-child.active {
    background: var(--sidebar-active-bg);
    border: none;
    box-shadow: inset 3px 0 0 0 var(--sidebar-active-border);
    color: #fff;
}

/* 侧边栏底部区域（系统监控 + 用户信息，推到最下方） */
.sidebar-bottom {
    margin-top: auto;
    padding: 0;
}

.sidebar-bottom .nav-section-label {
    margin-top: 0;
}

/* ==================== 侧边栏系统监控面板 ==================== */
.sidebar-sys-monitor {
    padding: 8px 14px;
    margin-bottom: 6px;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 监控信息行 - 使用 CSS Grid 两列对齐 */
.sidebar-monitor-row {
    display: grid;
    /* 左列按最大值（如 100.0%）预留，分隔线前移，右列留更多空间给“运行” */
    grid-template-columns: 84px auto minmax(0, 1fr);
    align-items: center;
    gap: 0;
    font-size: 12px;
    line-height: 1.4;
}

/* 每列内的标签+数值组合 */
.sidebar-monitor-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
}

/* 标签文字 - 亮度提高便于识别 */
.sidebar-monitor-label {
    color: #b0bec5;
    font-size: 12.5px;
    flex-shrink: 0;
}

/* 数值文字 */
.sidebar-monitor-val {
    font-weight: 600;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* 行内竖向分隔符（居中对齐） */
.sidebar-monitor-sep {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 8px;
    flex-shrink: 0;
    justify-self: center;
}

/* 各指标颜色 */
.sidebar-monitor-cpu { color: #818cf8; }
.sidebar-monitor-mem { color: #38bdf8; }
.sidebar-monitor-disk { color: #fbbf24; }
.sidebar-monitor-uptime { color: #a78bfa; }

/* 侧边栏底部用户信息 - 深色风格：半透明暗色卡片 */
.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin-top: 6px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    font-size: 13px;
}

.sidebar-user {
    color: var(--sidebar-text-bright);
    font-weight: 600;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 10px;
    transition: all 0.2s;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(255, 59, 106, 0.15);
    border-color: rgba(255, 59, 106, 0.30);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* 背景与侧边栏/顶栏一致，让 page-container 圆角处露出深色底 */
    background: linear-gradient(180deg, var(--sidebar-bg-start), var(--sidebar-bg-end));
    /* 不在 main-content 上滚动 */
    overflow: hidden;
}

/* ==================== 顶部栏 - 暗色半透明风格（123.html 模板） ==================== */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 12px;
    /* 固定在顶部，不参与滚动 */
    flex-shrink: 0;
    z-index: 50;
    color: var(--topbar-text);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--topbar-text-dim);
    padding: 4px;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--topbar-text);
}

/* header 子导航容器（紧跟标题右侧，flex 流式布局） */
#headerSubNav {
    display: flex;
    align-items: center;
    margin-left: 16px;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-time {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    font-weight: 500;
    /* 暗色顶栏下的胶囊容器 */
    padding: 5px 14px;
    border-radius: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--topbar-text-dim);
}

/* 日期部分：亮白色 */
.topbar-date {
    color: #cbd5e1;
    font-weight: 500;
}

/* 竖线分隔符 */
.topbar-sep {
    color: rgba(255, 255, 255, 0.35);
    margin: 0 8px;
    font-weight: 300;
    user-select: none;
}

/* 本年第X周、第X天：明亮渐变色 */
.topbar-year-info {
    background: linear-gradient(90deg, #ddd6fe, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

/* 时间部分：纯白突出 */
.topbar-clock {
    color: #f1f5f9;
    font-weight: 700;
}

/* 秒前冒号闪烁动画 */
.topbar-time-colon {
    display: inline-block;
    animation: colonBlink 1s step-end infinite;
    color: #a78bfa;
}

@keyframes colonBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.15; }
}

/* ==================== 页面容器 ==================== */
.page-container {
    flex: 1;
    padding: 20px 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* 浅灰色背景 + 左上圆角，与深色顶栏形成柔和过渡 */
    background: #f1f5f9;
    border-top-left-radius: 16px;
    /* 内容在这里滚动，不会跑到 topbar 上面 */
    overflow-y: auto;
    overflow-x: hidden;
}

/* ==================== 卡片组件 - 白色实底 + 悬浮动效（123.html 风格） ==================== */
.card {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

/* 卡片顶部光泽伪元素 - 保留但更微妙 */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    pointer-events: none;
    z-index: 1;
}

/* 卡片悬停 - 上浮 + 大阴影（123.html 风格） */
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
}

/* 禁用 hover 动画的卡片（用于外层容器卡片，内部子卡片保留动画） */
.card.no-hover:hover {
    transform: none;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border-color: var(--border);
}

/* AI 服务页面内部小卡片 - 立体浮雕效果 */
.card.no-hover .card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(248,250,252,0.85));
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 16px;
}

/* ==================== 统计卡片 - 白色实底风格 ==================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    position: relative;
    overflow: hidden;
}

/* 统计卡片顶部光泽 */
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    pointer-events: none;
}

.stat-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

/* 多彩图标背景 */
.stat-icon.purple { background: #f3e8ff; }
.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #dcfce7; }
.stat-icon.orange { background: #ffedd5; }

.stat-info { flex: 1; }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ==================== 标签页 - 现代商务风胶囊 ==================== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: none;
    margin-bottom: 16px;
    background: rgba(244, 247, 255, 0.5);
    border-radius: var(--radius);
    padding: 3px;
}

.tab-btn {
    padding: 7px 18px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    border-bottom: none;
    margin-bottom: 0;
    border-radius: var(--radius-sm);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}

.tab-btn.active {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-xs);
    font-weight: 600;
    border-bottom-color: transparent;
}

.tab-content {
    display: none;
    animation: tabFadeIn 0.2s ease;
}

.tab-content.active { display: block; }

@keyframes tabFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== 表格 ==================== */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 8px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

tbody tr { transition: var(--transition-fast); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

.action-btns { display: flex; gap: 4px; }

/* ==================== 空状态 ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-text, .empty-hint { font-size: 14px; color: var(--text-tertiary); }

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 60px 20px 20px;
    overflow-y: auto;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.show .modal-box,
.modal-overlay.show .modal {
    transform: translateY(0);
    opacity: 1;
}

.modal-box,
.modal {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid #dadce0;
    width: 100%;
    max-width: 520px;
    max-height: none;
    overflow-y: visible;
    transform: translateY(8px);
    opacity: 0;
    transition: var(--transition);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #e8eaed;
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #5f6368;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.15s;
    line-height: 1;
}

.modal-close:hover {
    background: #f1f3f4;
    color: #3c4043;
}

.modal-body { padding: 20px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #e8eaed;
}

/* ==================== 自定义确认弹窗 ==================== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}
.confirm-box {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.45);
    width: 460px;
    max-width: 90vw;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.2s ease;
}
.confirm-overlay.show .confirm-box {
    transform: scale(1) translateY(0);
}
.confirm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 28px 0;
}
.confirm-icon { font-size: 24px; }
.confirm-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}
.confirm-body {
    padding: 16px 28px 24px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    /* 内容尽量一行显示，避免不必要的换行 */
    white-space: pre-line;
}
.confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 28px 24px;
}
.confirm-footer .btn {
    padding: 8px 24px;
    font-size: 14px;
}

/* ==================== Toast 轻提示 ==================== */
.toast-container {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* toast 表情图标 */
.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

/* toast 文字 */
.toast-msg {
    line-height: 1.4;
}

.toast-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.toast-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.toast-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-out {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(-12px); }
}

/* ==================== 搜索框与城市搜索结果 ==================== */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }

.search-result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-location {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ==================== 位置/城市列表项 ==================== */
.location-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.location-item:hover {
    background: var(--bg-hover);
}

.location-item span {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.remove-location {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    line-height: 1;
}

.remove-location:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* 密钥中心 - 眼睛按钮已移除（安全优化：前端不再显示/隐藏密钥明文） */

/* ==================== 测试结果 ==================== */
.test-result {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.test-result.testing { background: var(--info-bg); color: var(--info); }
.test-result.success { background: var(--success-bg); color: var(--success); }
.test-result.error { background: var(--danger-bg); color: var(--danger); }

/* ==================== API 错误提示 ==================== */
.api-error-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--danger-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}

.api-error-alert .error-text {
    font-size: 13px;
    color: var(--danger);
    font-weight: 500;
}

/* ==================== 徽章 - 药丸圆角+半透明 ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-info { background: rgba(22, 183, 255, 0.12); color: #0284c7; }
.badge-success { background: rgba(31, 191, 131, 0.12); color: #059669; }
.badge-warning { background: rgba(255, 154, 26, 0.12); color: #d97706; }
.badge-danger { background: rgba(255, 59, 106, 0.12); color: #e11d48; }
.badge-gray { background: rgba(12, 18, 34, 0.06); color: #64748b; }

/* ==================== 分割线 ==================== */
hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 14px 0;
}

/* ==================== 复选框 ==================== */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ==================== textarea ==================== */
textarea.form-input {
    resize: vertical;
    min-height: 60px;
    line-height: 1.5;
}

/* ==================== number 输入框 ==================== */
input[type="number"].form-input { -moz-appearance: textfield; }
input[type="number"].form-input::-webkit-inner-spin-button,
input[type="number"].form-input::-webkit-outer-spin-button { opacity: 1; }

/* ==================== 日期选择器 ==================== */
input[type="date"].form-input,
input[type="month"].form-input,
input[readonly].form-input {
    cursor: pointer;
}

/* ==================== 文件上传 ==================== */
input[type="file"] { display: none; }

/* ==================== 加载动画 ==================== */
@keyframes spin { to { transform: rotate(360deg); } }

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ==================== 页面切换动画 ==================== */
.page-container > * {
    animation: pageIn 0.2s ease;
}

@keyframes pageIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== 响应式布局 ==================== */

@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .page-container { padding: 16px 20px; }
}

@media (max-width: 640px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .topbar { padding: 0 16px; }
    .page-title { font-size: 14px; }
    .page-container { padding: 12px 16px; border-top-left-radius: 0; }
    .stat-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .login-box { padding: 32px 24px; }
    .tabs { flex-direction: column; }

    #kvTabWeather > div { grid-template-columns: 1fr !important; }
    #kvTabCache > div > div { grid-template-columns: 1fr !important; }
    .page-container > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .toast-container {
        top: 56px;
        width: auto;
        max-width: 90vw;
    }
}

/* ==================== 系统信息状态栏（固定底部） ==================== */
.sys-statusbar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 12.5px;
    color: var(--text-tertiary);
    background: rgba(248, 250, 252, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    user-select: none;
    min-height: 36px;
}
/* 状态栏单项 */
.sys-sb-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
/* 标签文字 */
.sys-sb-label {
    color: var(--text-tertiary);
    font-size: 12px;
}
/* 数值文字（带颜色） */
.sys-sb-val {
    font-weight: 600;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}
/* 各指标颜色 */
.sys-sb-cpu { color: #6366f1; }
.sys-sb-mem { color: #0ea5e9; }
.sys-sb-disk { color: #f59e0b; }
.sys-sb-net { color: #10b981; }
.sys-sb-uptime { color: #8b5cf6; }
.sys-sb-os { color: #64748b; font-weight: 500; }
/* 详情（已用/总量） */
.sys-sb-detail {
    font-size: 11px;
    color: var(--text-tertiary);
    opacity: 0.7;
}
/* 分隔符 */
.sys-sb-sep {
    width: 1px;
    height: 14px;
    background: var(--border);
    margin: 0 4px;
    opacity: 0.5;
}

@media print {
    .sidebar, .topbar, .toast-container { display: none !important; }
    .main-content { margin-left: 0; }
}

/* ==================== 存储迁移 ==================== */

/* 迁移空状态提示 */
.st-migrate-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

/* 迁移配置区域 */
.st-migrate-config {
    padding: 4px 0;
}

/* 源→目标选择行 */
.st-migrate-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

/* 选择字段 */
.st-migrate-field {
    flex: 1;
    min-width: 0;
}

/* 箭头指示 */
.st-migrate-arrow {
    font-size: 22px;
    color: var(--primary);
    padding-bottom: 8px;
    flex-shrink: 0;
    user-select: none;
}

/* 迁移进度区域 */
.st-migrate-progress {
    margin-top: 20px;
    padding: 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

/* 进度头部（状态+取消按钮） */
.st-migrate-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 进度条外框 */
.st-migrate-bar-wrap {
    width: 100%;
    height: 10px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
}

/* 进度条填充 */
.st-migrate-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* 统计数字行 */
.st-migrate-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 错误日志容器 */
.st-migrate-error-log {
    max-height: 160px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 8px;
}

/* 单条错误 */
.st-migrate-error-item {
    font-size: 11px;
    color: var(--danger);
    padding: 3px 0;
    border-bottom: 1px solid var(--border-light);
    word-break: break-all;
}

.st-migrate-error-item:last-child {
    border-bottom: none;
}

/* 响应式：移动端源→目标改为纵向 */
@media (max-width: 640px) {
    .st-migrate-row {
        flex-direction: column;
        align-items: stretch;
    }
    .st-migrate-arrow {
        text-align: center;
        padding: 4px 0;
        transform: rotate(90deg);
    }
    .st-migrate-stats {
        flex-wrap: wrap;
        gap: 10px;
    }
}



/* 隐藏浏览器自带的密码输入框"显示密码"按钮（Edge/Chrome/Safari） */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none !important;
}
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    visibility: hidden !important;
    display: none !important;
    pointer-events: none;
    height: 0;
    width: 0;
    margin: 0;
}
