/* =====================================================
   玄矩 - 科技感仪表板样式
   与首页 index.php 风格统一
   ===================================================== */

/* ========== 全局变量 - 与首页统一 ========== */

:root {
    /* 主色调 */
    --primary-blue: #2196F3;
    --primary-cyan: #00BCD4;
    --primary-orange: #ff6b35;
    --primary-purple: #6366f1;

    /* 背景色 */
    --tech-dark: #0a0e27;
    --tech-purple: #1a1f3a;
    --tech-gradient: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);

    /* 玻璃态效果 */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* 文字颜色 */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* 功能色 */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* 兼容性别名 —— 各页面历史上引用但未定义的 token，统一在此补齐，
       避免出现 currentcolor 边框 / 0 圆角 / 透明背景等回退失效问题。 */
    --primary-color: #2196F3;            /* 主品牌色（与 --primary-blue 一致），用于 tab 高亮、分页悬停等强调态 */
    --border-color: rgba(255, 255, 255, 0.1);  /* 细弱描边（等同 --glass-border） */
    --bg-primary: #0a0e27;               /* 页面主背景（等同 --tech-dark） */
    --bg-secondary: rgba(15, 23, 42, 0.6);     /* 卡片/控件表面 */
    --bg-tertiary: rgba(0, 0, 0, 0.3);   /* 嵌套内陷表面（如密钥值展示框） */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ========== 全局重置 ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--tech-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 移动端基础优化 */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 防止移动端横向滚动 */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: rgba(0, 229, 255, 0.2);
    }

    /* 优化按钮点击区域 */
    .btn, .tab, button {
        min-height: 44px;
        min-width: 44px;
    }

    /* 优化链接点击区域 */
    a, .nav-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ========== 侧边栏 ========== */

.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--tech-dark);
}

/* 侧边栏默认展开状态（不添加collapsed类） */
.sidebar {
    width: 280px;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 侧边栏收缩状态 */
.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-logo h1,
.sidebar.collapsed .nav-item span {
    display: none;
}

/* 侧边栏收缩按钮 - 蓝色高亮，默认可见 */
.sidebar-toggle {
    position: absolute;
    top: 20px;
    right: -16px;
    width: 32px;
    height: 32px;
    background: rgba(33, 150, 243, 0.4);
    border: 2px solid rgba(33, 150, 243, 0.7);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-cyan);
    font-size: 16px;
    transition: all 0.3s;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
}

.sidebar-toggle:hover {
    background: rgba(33, 150, 243, 0.6);
    border-color: var(--primary-cyan);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.6);
    transform: scale(1.05);
}

/* 展开状态：显示向左箭头 */
.sidebar:not(.collapsed) .sidebar-toggle i {
    transform: rotate(0deg);
}

/* 收缩状态：显示向右箭头 */
.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-logo {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-logo .logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-cyan) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.4);
    animation: logoFloat 3s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.sidebar-logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.sidebar nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-blue), var(--primary-cyan));
    transition: height 0.3s;
}

.nav-item:hover {
    color: white;
    background: var(--glass-bg);
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

/* 用户手机号显示 */
.sidebar-footer .user-phone {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 退出登录按钮 - 展开状态 */
.sidebar-footer .logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 侧边栏收缩状态 */
.sidebar.collapsed .sidebar-footer {
    padding: 1.5rem 0.75rem;
    text-align: center;
}

/* 收缩时隐藏手机号 */
.sidebar.collapsed .sidebar-footer .user-phone {
    display: none;
}

/* 收缩时退出登录按钮变为圆形图标 */
.sidebar.collapsed .sidebar-footer .logout-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer .logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.sidebar.collapsed .sidebar-footer .logout-btn span {
    display: none;
}

.sidebar.collapsed .sidebar-footer .logout-btn i {
    font-size: 1.2rem;
    margin: 0;
}

/* ========== 主内容区 ========== */

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

/* 侧边栏收缩时，主内容区相应调整 - 使用兄弟选择器确保联动 */
.sidebar.collapsed ~ .main-content {
    margin-left: 80px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1.5rem 2rem;
    background: rgba(10, 14, 39, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.page-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h2 i {
    color: var(--primary-cyan);
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: var(--primary-blue);
    transform: scale(1.05);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* ========== 统计卡片 ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--glass-shadow);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(33, 150, 243, 0.3);
    border-color: rgba(33, 150, 243, 0.3);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== VIP 会员卡片 ========== */

.vip-card {
    background: linear-gradient(135deg,
        rgba(26, 31, 58, 0.95) 0%,
        rgba(15, 23, 42, 0.9) 50%,
        rgba(26, 31, 58, 0.95) 100%);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    border: 2px solid;
    border-image: linear-gradient(135deg,
        rgba(255, 215, 0, 0.5),
        rgba(255, 165, 0, 0.4),
        rgba(255, 215, 0, 0.5)) 1;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 60px rgba(255, 215, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 激光粒子效果 */
.vip-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 215, 0, 0.08) 0%, transparent 30%),
        radial-gradient(circle at 80% 70%, rgba(255, 165, 0, 0.06) 0%, transparent 30%),
        radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.04) 0%, transparent 40%);
    animation: vipLaserParticles 6s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes vipLaserParticles {
    0% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
    100% {
        opacity: 0.5;
        transform: scale(1.02);
    }
}

/* 玻璃光束效果 */
.vip-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 215, 0, 0.03) 50%,
        transparent 70%
    );
    animation: vipGlassBeam 8s linear infinite;
    pointer-events: none;
}

@keyframes vipGlassBeam {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.vip-card-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 2rem;
    color: rgba(255, 255, 255, 0.98);
}

.vip-crown {
    font-size: 4rem;
    background: linear-gradient(135deg,
        rgba(255, 223, 0, 1) 0%,
        rgba(255, 183, 0, 0.95) 50%,
        rgba(255, 215, 0, 1) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.6))
            drop-shadow(0 0 60px rgba(255, 165, 0, 0.4));
    animation: crownFloat 3s ease-in-out infinite;
}

@keyframes crownFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
}

.vip-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg,
        rgba(255, 215, 0, 0.25) 0%,
        rgba(255, 165, 0, 0.2) 100%);
    padding: 0.625rem 1.25rem;
    border-radius: 24px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    backdrop-filter: blur(15px);
    border: 1.5px solid rgba(255, 215, 0, 0.4);
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5),
                 0 0 40px rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.vip-badge i {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

.vip-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: #ffffff;
    text-shadow: 0 2px 20px rgba(255, 215, 0, 0.3),
                 0 0 40px rgba(255, 215, 0, 0.2);
    letter-spacing: 0.5px;
}

.vip-meta {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}

.vip-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg,
        rgba(255, 215, 0, 0.12) 0%,
        rgba(255, 165, 0, 0.08) 100%);
    border-radius: 10px;
    border: 1.5px solid rgba(255, 215, 0, 0.25);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.vip-meta-item i {
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

.vip-restrictions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 215, 0, 0.25);
}

.no-vip-card {
    background: linear-gradient(135deg,
        rgba(26, 31, 58, 0.8) 0%,
        rgba(99, 102, 241, 0.15) 50%,
        rgba(118, 75, 162, 0.1) 100%);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    color: white;
    text-align: center;
    margin-bottom: 2rem;
    border: 2px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.no-vip-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.no-vip-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.no-vip-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.no-vip-card p {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-bottom: 1.5rem;
}

.no-vip-card .btn-primary {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.3),
        rgba(118, 75, 162, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.4);
    backdrop-filter: blur(10px);
}

.no-vip-card .btn-primary:hover {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.4),
        rgba(118, 75, 162, 0.3));
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

/* ========== 标签页 ========== */

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(26, 31, 58, 0.6);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab:hover {
    color: white;
    background: var(--glass-bg);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== API端点样式 ========== */

.api-endpoint-item {
    margin-bottom: 0.5rem;
}

.api-endpoint-box {
    background: linear-gradient(135deg,
        rgba(0, 229, 255, 0.08) 0%,
        rgba(33, 150, 243, 0.06) 100%);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    border: 2px solid rgba(0, 229, 255, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.api-endpoint-box:hover {
    background: linear-gradient(135deg,
        rgba(0, 229, 255, 0.15) 0%,
        rgba(33, 150, 243, 0.1) 100%);
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.3);
    transform: translateY(-2px);
}

.api-endpoint-box:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 229, 255, 0.4);
}

.api-endpoint-box code {
    flex: 1;
    color: #00E5FF;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    letter-spacing: 0.5px;
}

.api-endpoint-box .copy-icon {
    color: rgba(0, 229, 255, 0.7);
    font-size: 1.1rem;
    transition: all 0.3s;
    flex-shrink: 0;
}

.api-endpoint-box:hover .copy-icon {
    color: #00E5FF;
    transform: scale(1.1);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.8);
}

/* ========== 卡片 ========== */

.card {
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--glass-shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h3 i {
    color: var(--primary-cyan);
}

/* ========== 按钮 ========== */

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 表格 ========== */

.table-container {
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(33, 150, 243, 0.1);
    border-bottom: 1px solid var(--glass-border);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--primary-cyan);
    font-size: 0.9rem;
}

tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.2s;
}

tbody tr:hover {
    background: var(--glass-bg);
}

tbody tr:last-child {
    border-bottom: none;
}

td {
    padding: 1rem;
    color: var(--text-secondary);
}

/* ========== API密钥列表 ========== */

.api-key-list {
    display: grid;
    gap: 1rem;
}

.api-key-item {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.api-key-item:hover {
    border-color: rgba(33, 150, 243, 0.3);
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.2);
}

.api-key-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 0.75rem;
    word-break: break-all;
    color: var(--primary-cyan);
}

.api-key-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* ========== 标签 ========== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ========== 模态框 ========== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: rgba(26, 31, 58, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--error);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

/* ========== 表单 ========== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group label i {
    color: var(--primary-cyan);
    margin-right: 0.5rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s;
    outline: none;
}

/* Select 下拉框特殊样式 */
select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-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='%2300BCD4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

select option {
    background: #1a1f3a;
    color: white;
    padding: 0.5rem;
}

select:focus {
    background-color: rgba(15, 23, 42, 0.8);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* ========== 分页 ========== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
}

.pagination button {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination button:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    border-color: transparent;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 空状态 ========== */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    display: block;
}

/* ========== Toast 提示 ========== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 1rem 1.5rem;
    background: rgba(26, 31, 58, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
    min-width: 300px;
}

/* 单元素 toast（#toast）：固定在右上角，置于普通模态框(z-index:2000)之上；默认隐藏，加 .show 才显示。
   之前 .toast 没有 position/z-index，导致弹窗打开时 toast 渲染在静态流里被模态框遮罩盖住，错误提示看不见。 */
#toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
    display: none;
    max-width: 360px;
}
#toast.show {
    display: flex;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.info {
    border-left: 4px solid var(--info);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========== 移动端覆盖层 ========== */

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-overlay.show {
    display: block;
    opacity: 1;
}

/* 移动端侧边栏样式优化 */
@media (max-width: 768px) {
    .sidebar {
        width: 280px !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* 隐藏桌面端的收缩按钮 */
    .sidebar .sidebar-toggle {
        display: none;
    }
}

/* ========== 响应式设计 ========== */

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .vip-card-inner {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .vip-crown {
        margin: 0;
    }

    .vip-meta {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    /* 侧边栏默认隐藏，从左侧滑入 */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px !important;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* 隐藏侧边栏收缩按钮（移动端不需要） */
    .sidebar .sidebar-toggle {
        display: none;
    }

    /* 主内容区占满全屏 */
    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
        width: 100% !important;
    }

    .sidebar.collapsed ~ .main-content {
        margin-left: 0 !important;
    }

    /* 显示汉堡菜单按钮 */
    .mobile-menu-btn {
        display: flex !important;
    }

    /* 显示移动端覆盖层 */
    .mobile-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

    /* 统计卡片单列显示 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* VIP卡片优化 */
    .vip-card-inner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .vip-crown {
        font-size: 3rem;
    }

    .vip-title {
        font-size: 1.4rem;
    }

    .vip-meta {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .vip-meta-item {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* 页面头部优化 */
    .page-header {
        padding: 1rem;
        flex-direction: row;
        gap: 1rem;
        align-items: center;
        justify-content: space-between;
    }

    .page-header h2 {
        font-size: 1.2rem;
        flex: 1;
    }

    /* 标签页优化 */
    .tabs {
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .tab {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 120px;
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    /* 卡片优化 */
    .card {
        padding: 1rem;
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header h3 {
        font-size: 1rem;
    }

    /* API端点优化 */
    .api-endpoint-box {
        padding: 0.875rem;
        font-size: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .api-endpoint-box code {
        font-size: 0.75rem;
        word-break: break-all;
    }

    .api-endpoint-box .copy-icon {
        align-self: flex-end;
        font-size: 1rem;
    }

    /* 表格优化 - 横向滚动 */
    .table-container {
        overflow-x: auto;
        border-radius: 12px;
        margin-left: -1rem;
        margin-right: -1rem;
        width: calc(100% + 2rem);
    }

    table {
        min-width: 600px;
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* API密钥列表优化 */
    .api-key-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .api-key-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* 模态框优化 */
    .modal {
        padding: 1rem;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 12px;
        max-height: calc(100vh - 2rem);
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* Toast优化 */
    .toast {
        min-width: auto;
        max-width: calc(100vw - 40px);
        font-size: 0.875rem;
        padding: 0.875rem 1rem;
        left: 20px !important;
        right: 20px !important;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕优化 */
    .main-content {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-content h3 {
        font-size: 0.85rem;
    }

    .vip-crown {
        font-size: 2.5rem;
    }

    .vip-title {
        font-size: 1.2rem;
    }

    .vip-badge {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }

    .tab {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
        min-width: 100px;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* 表格在小屏幕横向滚动 */
    .table-container {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        border-radius: 0;
    }

    thead {
        position: sticky;
        top: 0;
        z-index: 10;
    }
}

/* ========== AI 聊天样式 ========== */

/* AI 聊天区域 */
.ai-chat-section {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--tech-dark);
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1.5rem 2rem;
    background: rgba(10, 14, 39, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.ai-chat-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-cyan);
    font-size: 1.5rem;
    font-weight: 700;
}

.ai-chat-actions {
    display: flex;
    gap: 0.75rem;
}

.ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.ai-chat-welcome {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
}

.ai-chat-welcome i {
    font-size: 4rem;
    color: var(--primary-cyan);
    margin-bottom: 1rem;
    display: block;
}

.ai-chat-welcome h4 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 0.5rem;
}

.ai-chat-welcome p {
    font-size: 1rem;
    opacity: 0.7;
}

.ai-chat-status {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ai-new-chat-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.ai-new-chat-btn:hover {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}

.ai-chat-input {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 0.75rem;
    background: rgba(26, 31, 58, 0.6);
}

.ai-chat-input textarea {
    flex: 1;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
}

.ai-chat-input textarea:focus {
    border-color: var(--primary-blue);
}

.ai-chat-input textarea::placeholder {
    color: var(--text-muted);
}

.ai-chat-input button {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

.ai-chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* AI 消息样式 */
.ai-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message.user .ai-message-avatar {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
}

.ai-message.assistant .ai-message-avatar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.ai-message-avatar i {
    font-size: 1rem;
    color: white;
}

.ai-message-content {
    max-width: 75%;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    line-height: 1.6;
    color: var(--text-primary);
}

.ai-message.user .ai-message-content {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    border: none;
    color: white;
}

.ai-message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.ai-message-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.ai-message-content p {
    margin: 0.5rem 0;
}

.ai-message-content p:first-child {
    margin-top: 0;
}

.ai-message-content p:last-child {
    margin-bottom: 0;
}

.ai-message-content ul,
.ai-message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.ai-message-content h1,
.ai-message-content h2,
.ai-message-content h3,
.ai-message-content h4,
.ai-message-content h5,
.ai-message-content h6 {
    margin: 1rem 0 0.5rem;
    color: var(--primary-cyan);
}

.ai-message-content h1:first-child,
.ai-message-content h2:first-child,
.ai-message-content h3:first-child {
    margin-top: 0;
}

.ai-message-content blockquote {
    border-left: 3px solid var(--primary-cyan);
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

/* 加载动画 */
.ai-message-loading {
    display: flex;
    gap: 4px;
    padding: 0.5rem;
}

.ai-message-loading span {
    width: 8px;
    height: 8px;
    background: var(--primary-cyan);
    border-radius: 50%;
    animation: loadingBounce 1.4s ease-in-out infinite both;
}

.ai-message-loading span:nth-child(1) { animation-delay: -0.32s; }
.ai-message-loading span:nth-child(2) { animation-delay: -0.16s; }
.ai-message-loading span:nth-child(3) { animation-delay: 0s; }

@keyframes loadingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 全屏模式 */
.ai-fullscreen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--tech-dark);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.ai-fullscreen-container .ai-chat-header {
    padding: 1.5rem 2rem;
    border-radius: 0;
    margin-bottom: 0;
}

.ai-fullscreen-container .ai-chat-messages {
    flex: 1;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.ai-fullscreen-container .ai-message-content {
    max-width: 70%;
}

.ai-fullscreen-container .ai-chat-status {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 2rem;
}

.ai-fullscreen-container .ai-chat-input {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem 2rem;
}

/* 导航栏激活状态 */
.nav-item.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
}

.nav-item.active::before {
    height: 60%;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ai-chat-section {
        margin-left: 0 !important;
        padding: 1rem;
    }

    .ai-chat-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .ai-chat-header h2 {
        font-size: 1.2rem;
    }

    .ai-chat-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .ai-message-content {
        max-width: 85%;
    }

    .ai-fullscreen-container .ai-message-content {
        max-width: 85%;
    }

    .ai-fullscreen-container .ai-chat-messages,
    .ai-fullscreen-container .ai-chat-status,
    .ai-fullscreen-container .ai-chat-input {
        padding: 1rem;
    }
}
