/* ==========================================================================
   Senflare 公共主题样式库

   本文件包含所有页面通用的样式组件:
   - CSS 变量 (浅色/深色主题)
   - 字体定义
   - 全局基础样式
   - 动态背景
   - 通用工具类
   - 卡片组件
   - 表单组件
   - 按钮组件
   - 弹窗组件
   - Toast 提示
   - 复选框组件
   - 标签组件
   ========================================================================== */

/* CSS 变量 - 主题配色 */
:root {
    /* ==================== 基础色彩 ==================== */
    --color-primary: #ff6901;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* ==================== 灰色系统 ==================== */
    --gray-50: #f7fafc;
    --gray-100: #f0f0f0;
    --gray-200: #e0e0e0;
    --gray-300: #bdbdbd;
    --gray-400: #9e9e9e;
    --gray-500: #666;
    --gray-600: #595959;
    --gray-700: #333;
    --gray-800: #1a1a1a;
    --gray-900: #050505;

    /* ==================== 扩展色彩 ==================== */
    --color-purple: #8b5cf6;
    --color-pink: #ec4899;
    --color-orange: #ff9800;
    --color-yellow: #eab308;
    --color-indigo: #6366f1;
    --color-red: #ff0000;
    --color-lime: #84cc16;
    --color-amber: #f59e0b;
    --color-rose: #dc2626;
    --color-yellow-bright: rgb(255, 196, 0);
    --color-yellow-bright-bg: rgba(255, 214, 0, 0.2);
    --color-yellow-bright-border: rgba(255, 214, 0, 0.35);

    /* ==================== 透明度变体 ==================== */
    /* Primary */
    --color-primary-bg-2: rgba(255, 105, 1, 0.02);
    --color-primary-bg-5: rgba(255, 105, 1, 0.05);
    --color-primary-bg-10: rgba(255, 105, 1, 0.1);
    --color-primary-bg-15: rgba(255, 105, 1, 0.15);
    --color-primary-bg-20: rgba(255, 105, 1, 0.2);
    --color-primary-border: rgba(255, 105, 1, 0.3);
    --color-primary-shadow: rgba(255, 105, 1, 0.25);
    /* ==================== 文本颜色 ==================== */
    --color-success-bg-10: rgba(44, 199, 106, 0.1);
    --color-success-bg-15: rgba(34, 197, 94, 0.15);
    --color-success-border: rgba(44, 199, 106, 0.3);
    --color-success-border-20: rgba(34, 197, 94, 0.2);
    --color-success-shadow: rgba(34, 197, 94, 0.5);
    
    /* Danger */
    --color-danger-bg-8: rgba(239, 68, 68, 0.08);
    --color-danger-bg-10: rgba(239, 68, 68, 0.1);
    --color-danger-bg-15: rgba(239, 68, 68, 0.15);
    --color-danger-bg-20: rgba(220, 38, 38, 0.2);
    --color-danger-border: rgba(239, 68, 68, 0.3);
    --color-danger-border-20: rgba(239, 68, 68, 0.2);
    
    /* Warning */
    --color-warning-bg-8: rgba(245, 158, 11, 0.08);
    --color-warning-bg-15: rgba(245, 158, 11, 0.15);
    --color-warning-bg-40: rgba(250, 171, 65, 0.4);
    --color-warning-border: rgba(245, 158, 11, 0.3);
    
    /* Info */
    --color-info-bg-8: rgba(59, 130, 246, 0.08);
    --color-info-bg-10: rgba(59, 130, 246, 0.1);
    --color-info-bg-15: rgba(59, 130, 246, 0.15);
    --color-info-border: rgba(59, 130, 246, 0.3);
    
    /* Lime */
    --color-lime-bg-15: rgba(132, 204, 22, 0.15);
    
    /* Amber */
    --color-amber-bg-15: rgba(234, 179, 8, 0.15);
    
    /* Orange */
    --color-orange-bg-15: rgba(249, 115, 22, 0.15);
    
    /* Purple */
    --color-purple-bg-15: rgba(139, 92, 246, 0.15);
    --color-purple-border: rgba(139, 92, 246, 0.3);
    
    /* Pink */
    --color-pink-bg-15: rgba(236, 72, 153, 0.15);
    --color-pink-border: rgba(236, 72, 153, 0.3);
    
    /* Red */
    --color-red-bg-15: rgba(255, 0, 0, 0.15);
    --color-red-border: rgba(255, 0, 0, 0.3);
    
    /* Gray */
    --color-gray-bg-15: rgba(156, 163, 175, 0.15);
    --color-gray-border: rgba(156, 163, 175, 0.3);
    --color-gray-text: #9ca3af;
    
    /* Black/White */
    --color-black-10: rgba(0, 0, 0, 0.1);
    --color-black-15: rgba(0, 0, 0, 0.15);
    --color-black-30: rgba(0, 0, 0, 0.3);
    --color-black-50: rgba(0, 0, 0, 0.5);
    --color-white: #fff;
    
    /* Gradient colors */
    --color-primary-light: #ff9a44;
    --color-orange-dark: #ff8c00;
    --color-orange-light: #ffb347;
    --color-primary-dark: #ff6b35;
    
    /* Gradient variables */
    --gradient-primary: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    --gradient-primary-horizontal: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    
    /* Special colors */
    --color-orange-bg: #ffecdb;
    --color-orange-divider: rgba(255, 150, 100, 0.3);
    --color-light-bg: #f8f9fa;

    /* ==================== 文本颜色 ==================== */
    --text-1: #333;
    --text-2: #444;
    --text-3: #666;
    --text-4: #999;

    /* ==================== 背景颜色 ==================== */
    --bg-1: #fcfcfc;
    --bg-2: rgba(0, 0, 0, 0.03);
    --bg-3: rgba(0, 0, 0, 0.05);

    /* ==================== 边框颜色 ==================== */
    --border-1: rgba(0, 0, 0, 0.05);
    --border-2: rgba(0, 0, 0, 0.1);

    /* ==================== 组件颜色 ==================== */
    --card-bg: rgba(255, 255, 255, 0.6);
    --sidebar-bg: rgba(255, 255, 255, 0.8);
    --sidebar-text: #555;
    
    /* ==================== 其他颜色 ==================== */
    --color-light-gray: #ccc;
    --color-dark-bg: #2a2a2a;

    /* ==================== 尺寸变量 ==================== */
    --sidebar-width: 64px;
    --sidebar-expanded-width: 200px;
    --header-height: 64px;

    /* ==================== 动态背景 ==================== */
    --orb-1: #ffe5e6;
    --orb-2: #fff0e0;
    --orb-3: #ffeadd;
}

/* 深色模式 */
[data-theme="dark"] {
    /* 文本颜色 */
    --text-1: #f7fafc;
    --text-2: rgba(255, 255, 255, 0.7);
    --text-3: rgba(255, 255, 255, 0.6);
    --text-4: rgba(255, 255, 255, 0.4);

    /* 背景颜色 */
    --bg-1: #050505;
    --bg-2: rgba(255, 255, 255, 0.05);
    --bg-3: rgba(255, 255, 255, 0.08);

    /* 边框颜色 */
    --border-1: rgba(255, 255, 255, 0.05);
    --border-2: rgba(255, 255, 255, 0.1);

    /* 组件颜色 */
    --card-bg: rgba(30, 30, 30, 0.3);
    --sidebar-bg: rgba(20, 20, 20, 0.6);
    --sidebar-text: rgba(255, 255, 255, 0.8);
    
    /* 其他颜色 */
    --color-dark-bg: #2a2a2a;

    /* 动态背景 */
    --orb-1: #4a1c03;
    --orb-2: #2c1e0b;
    --orb-3: #662200;
}

/* 字体定义 */
@font-face {
    font-family: 'Alibaba PuHuiTi';
    src: url('../assets/fonts/AlibabaPuHuiTi-3-55-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 全局基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Alibaba PuHuiTi", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

html {
    font-size: 14px;
}

body {
    background-color: var(--bg-1);
    color: var(--text-1);
    transition: color 0.3s, background-color 0.3s;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* 通用工具类 */
.hidden {
    display: none !important;
}

.text-sm {
    font-size: 0.85rem !important;
}

.text-xs {
    font-size: 0.75rem !important;
}

.font-normal {
    font-weight: 400 !important;
}

.desc {
    font-size: 0.9rem;
    color: var(--text-3);
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-3);
}

/* 动态背景 */
.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-1);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--orb-1);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--orb-2);
    top: 50%;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: var(--orb-3);
    bottom: -50px;
    left: 30%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.05);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }
    75% {
        transform: translate(20px, 10px) scale(1.02);
    }
}

/* 卡片组件 */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 16px;
    margin: 8px 8px 16px 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.04);
}

.card-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    stroke: var(--color-primary);
    flex-shrink: 0;
}

.card-body {
    padding: 1.5rem;
    overflow-x: auto;
    transition: all 0.3s ease;
}

/* 卡片折叠按钮 */
.card-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: 1.2rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.card-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-primary);
}

/* 表单组件 */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    color: var(--text-3);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--text-1);
    background-color: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-1);
    border-radius: 8px;
    transition: all 0.3s;
    height: 36px;
}
/* 订阅格式按钮组 */
.sub-format-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

/* 订阅结果容器 */
.sub-result-container {
    display: flex;
    gap: 10px;
}

.sub-result-container button {
    white-space: nowrap;
    flex-shrink: 0;
}

.sub-result-container input {
    flex: 1;
    min-width: 0;
}

/* 二维码容器 */
.qrcode-container {
    display: none;
    justify-content: center;
    margin-top: 16px;
}

/* 提示框通用样式 */
.hint-box {
    padding: 12px 16px;
    background: var(--color-primary-bg-5);
    border-radius: 8px;
    margin-top: 16px;
}

.hint-box p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 警告框通用样式 */
.warning-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-primary-bg-5);
    border-radius: 8px;
    margin-top: 12px;
}

.warning-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.warning-text {
    flex: 1;
}

.warning-desc {
    font-size: 0.85rem;
    color: var(--text-3);
    line-height: 1.5;
    margin: 0;
}

.warning-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.warning-item {
    font-size: 0.85rem;
    color: var(--text-3);
    padding-left: 16px;
    position: relative;
    line-height: 1.5;
}

.warning-item::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
}

/* 按钮组件 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 0 1.25rem;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.3s;
    letter-spacing: 0.5px;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white !important;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    color: white !important;
    box-shadow: 0 4px 12px var(--color-primary-shadow);
}

.btn-outline {
    background: var(--color-primary-bg-10);
    border: 1px solid var(--color-primary-border);
    color: var(--color-primary);
    backdrop-filter: blur(5px);
    box-shadow: 0 0 10px var(--color-primary-bg-10), inset 0 0 5px var(--color-primary-bg-10);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--color-primary-shadow);
}

.btn-outline.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    border-color: var(--color-primary);
}

.btn-outline.active:hover {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--color-primary-shadow);
}

.btn-sm {
    padding: 0 1rem;
    font-size: 0.85rem;
    min-width: 40px;
}

.btn-xs {
    height: 30px;
    padding: 0 0.75rem;
    font-size: 0.8rem;
    min-width: 30px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: var(--bg-2);
    color: var(--text-2);
    border: 1px solid var(--border-1);
}

.btn-secondary:hover {
    background: var(--bg-3);
    border-color: var(--border-2);
}

.btn-danger:hover {
    background: rgba(220, 53, 69, .2);
}

.btn-danger-solid {
    background: var(--color-danger);
    color: white;
    border: 1px solid var(--color-danger);
}

.btn-danger-solid:hover {
    background: #c82333;
}

/* ==================== 弹窗组件 (Modal) ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    inset: 0;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex !important;
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    inset: 0;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
}

.modal-content > .modal-body {
    overflow-y: auto;
    flex: 1;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.modal-header h3 svg {
    color: var(--color-primary);
}

.modal-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 1.4rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-3);
}

/* 弹窗深色模式 */
[data-theme="dark"] .modal-content {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

.modal-body {
    padding: 1.5rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-1);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Cloudflare 认证 Tab */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-1);
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-3);
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.auth-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* 密码输入框样式 */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 40px;
}

.eye-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-btn svg {
    width: 18px;
    height: 18px;
}

.eye-btn:hover {
    opacity: 1;
}

.eye-btn:hover svg {
    stroke: var(--color-info);
}

.help-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--color-primary);
    margin-top: 6px;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.help-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* 确保弹窗中的取消按钮有 hover 效果 */
.modal .btn-outline:hover,
.modal-content .btn-outline:hover {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
}

/* 公告类型按钮 - 统一样式 */
.announcement-type-btn.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-color: var(--color-primary);
    color: white;
}

.announcement-type-btn:hover {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-color: var(--color-primary);
    color: white;
}

/* 弹窗移动端适配 */
@media (max-width: 600px) {
    .modal-content {
        width: 100%;
        max-width: calc(100vw - 32px);
        border-radius: 12px;
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
    }

    /* 移动端禁用 hover 效果 */
    .auth-tab:hover {
        background: transparent;
        color: var(--text-3);
    }

    .auth-tab.active:hover {
        color: var(--color-primary);
    }
}

/* 表单组件 */

select.form-control {
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

textarea.form-control {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

.form-control:focus {
    outline: 0;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg-10);
    background-color: white;
}

/* 表单 - 深色模式 */
[data-theme="dark"] .form-control {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

[data-theme="dark"] .form-control:focus {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-shadow);
}

/* 下拉菜单 - 深色模式 */
[data-theme="dark"] select.form-control,
[data-theme="dark"] select.filter-select {
    color-scheme: dark;
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] select.form-control option,
[data-theme="dark"] select.filter-select option {
    background: var(--gray-800) !important;
    color: var(--color-white) !important;
}

[data-theme="dark"] select.form-control option:checked,
[data-theme="dark"] select.filter-select option:checked {
    background: #2d2d2d !important;
    color: var(--color-white) !important;
}
/* 复选框组件 */
.checkmark {
    width: 18px;
    height: 18px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid var(--border-1);
    border-radius: 4px;
    background: var(--bg-2);
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label:hover .checkmark {
    border-color: var(--color-primary);
}

.checkbox-label input:checked~.checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input:checked~.checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* 带 label 的复选框容器 */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    color: var(--text-1);
    margin-right: 20px;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-label .checkmark {
    position: absolute;
    top: 0;
    left: 0;
}

/* 通用标签样式 */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 0.5px solid;
}

.tag-xs {
    padding: 2px 6px;
    font-size: 0.7rem;
}

/* 会员类型标签 */
.tag-member-permanent { background: rgba(255, 105, 1, 0.15); color: #ff6901; border-color: rgba(255, 105, 1, 0.3); }
.tag-member-yearly { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border-color: rgba(139, 92, 246, 0.3); }
.tag-member-quarterly { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); }
.tag-member-monthly { background: rgba(255, 0, 0, 0.15); color: #ff0000; border-color: rgba(255, 0, 0, 0.3); }
.tag-member-weekly { background: rgba(34, 197, 94, 0.15); color: #22c55e; border-color: rgba(34, 197, 94, 0.3); }
.tag-member-daily { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); }
.tag-member-temp { background: rgba(236, 72, 153, 0.15); color: #ec4899; border-color: rgba(236, 72, 153, 0.3); }
.tag-member-trafficpack { background: rgba(121, 80, 242, 0.15); color: #7950f2; border-color: rgba(121, 80, 242, 0.3); }

/* 支付方式标签 */
.tag-pay-alipay { background: rgba(22, 119, 255, 0.15); color: #1677ff; border-color: rgba(22, 119, 255, 0.3); }
.tag-pay-wechat { background: rgba(7, 193, 96, 0.15); color: #07c160; border-color: rgba(7, 193, 96, 0.3); }
.tag-pay-qqpay { background: rgba(18, 183, 245, 0.15); color: #12b7f5; border-color: rgba(18, 183, 245, 0.3); }

/* 状态标签 */
.tag-green { background: rgba(34, 197, 94, 0.15); color: #22c55e; border-color: rgba(34, 197, 94, 0.3); }
.tag-yellow { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); }
.tag-red { background: rgba(239, 68, 68, 0.15); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.tag-gray { background: rgba(156, 163, 175, 0.15); color: #9ca3af; border-color: rgba(156, 163, 175, 0.3); }
.tag-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); }
.tag-orange { background: rgba(255, 105, 1, 0.15); color: #ff6901; border-color: rgba(255, 105, 1, 0.3); }
.tag-purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border-color: rgba(139, 92, 246, 0.3); }
.tag-teal { background: rgba(20, 184, 166, 0.15); color: #14b8a6; border-color: rgba(20, 184, 166, 0.3); }
.tag-lime { background: rgba(132, 204, 22, 0.15); color: #84cc16; border-color: rgba(132, 204, 22, 0.3); }
.tag-indigo { background: rgba(99, 102, 241, 0.15); color: #6366f1; border-color: rgba(99, 102, 241, 0.3); }
.tag-pink { background: rgba(236, 72, 153, 0.15); color: #ec4899; border-color: rgba(236, 72, 153, 0.3); }
.tag-cyan { background: rgba(6, 182, 212, 0.15); color: #06b6d4; border-color: rgba(6, 182, 212, 0.3); }

/* 状态徽章 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background: var(--color-success-bg-15);
    color: var(--color-success);
}

.status-expired {
    background: var(--color-danger-bg-15);
    color: var(--color-danger);
}

/* 文本颜色辅助类 */
.text-success {
    color: var(--color-success);
}

.text-warning {
    color: var(--color-warning);
}

.text-danger {
    color: var(--color-danger);
}

.text-primary {
    color: var(--color-primary) !important;
}

/* 下拉菜单组件 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
    user-select: none;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    min-width: 80px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-1);
    border-radius: 8px;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu.dropdown-up {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 5px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    color: var(--text-1);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--bg-2);
}

/* 批量操作组件 */
.table-batch-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 0.85rem;
}

.batch-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--color-primary);
    user-select: none;
}

.batch-dropdown-toggle svg {
    transition: transform 0.2s;
}

.batch-dropdown-toggle:hover {
    opacity: 0.8;
}

/* ==================== 表格组件系统 ==================== */

/* 容器 */
.table-container {
    overflow-x: auto;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-auto {
    width: auto;
    min-width: 100%;
}

/* 单元格 */
.table th,
.table td {
    padding: 8px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-1);
    vertical-align: middle;
    line-height: 1.5;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
}

.table td {
    padding: 4px 16px;
}

.table th:first-child,
.table td:first-child {
    padding-left: 20px;
}

.table th:last-child,
.table td:last-child {
    padding-right: 20px;
}

/* 表头 */
.table-header {
    background: white;
    font-weight: 400;
    color: var(--gray-700);
    font-size: 0.8rem;
    white-space: nowrap;
}

[data-theme="dark"] .table-header {
    background: rgba(30, 30, 30, 1);
}

/* 行 */
.table-row {
    transition: background 0.15s;
    color: var(--text-3);
}

.table-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .table-row {
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .table-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* 排序 */
.table-sortable {
    cursor: pointer;
    user-select: none;
}

.table-sortable:hover {
    background: var(--bg-2);
}

.table-sort-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0.3;
    transition: all 0.2s;
}

.table-sortable:hover .table-sort-icon {
    opacity: 0.6;
}

.table-sort-asc .table-sort-icon {
    opacity: 1;
    transform: rotate(180deg);
}

.table-sort-desc .table-sort-icon {
    opacity: 1;
}

/* 空状态 */
.table-empty {
    text-align: center !important;
    color: var(--text-3);
    padding: 60px 20px !important;
    font-size: 0.9rem;
}

/* 工具栏 */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-1);
    background: var(--bg-2);
}

.table-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 选择信息 */
.table-selection {
    font-size: 0.85rem;
    color: var(--text-3);
}

.table-selection-count {
    color: var(--color-primary);
    font-weight: 600;
}

/* 底部 */
.table-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-1);
}

/* 操作按钮组 */
.table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-actions .btn {
    height: 32px;
    width: 32px;
    padding: 0;
    font-size: 0;
    min-width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.table-actions .btn svg {
    width: 16px;
    height: 16px;
}

/* 图标按钮变体 */
.btn-icon-blue {
    background: rgba(59, 130, 246, 0.1);
    border: 1.5px solid rgba(59, 130, 246, 0.3);
    color: var(--color-info);
}

.btn-icon-blue:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--color-info);
}

.btn-icon-orange {
    background: rgba(236, 72, 153, 0.1);
    border: 1.5px solid rgba(236, 72, 153, 0.3);
    color: var(--color-pink);
}

.btn-icon-orange:hover {
    background: rgba(236, 72, 153, 0.15);
    border-color: var(--color-pink);
}

.btn-icon-yellow {
    background: rgba(255, 193, 7, 0.1);
    border: 1.5px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.btn-icon-yellow:hover {
    background: rgba(255, 193, 7, 0.15);
    border-color: #ffc107;
}

.btn-icon-red {
    background: rgba(239, 68, 68, 0.1);
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    color: var(--color-danger);
}

.btn-icon-red:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--color-danger);
}

/* 内容类型 */
.table-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.table-badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
}

.table-badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-info);
}

/* 状态颜色 */
.table-status-good {
    color: var(--color-success);
}

.table-status-medium {
    color: var(--color-warning);
    font-weight: 600;
}

.table-status-bad {
    color: var(--color-danger);
}

.table-status-muted {
    color: var(--text-3);
}

[data-theme="dark"] .table-status-muted {
    color: rgba(255, 255, 255, 0.6);
}

.table-status-info {
    color: var(--color-info);
}

/* 兼容旧类名 - 复用表格组件样式 */
.node-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.node-table th,
.node-table td {
    padding: 8px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-1);
    vertical-align: middle;
    line-height: 1.5;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
}

.node-table th:first-child,
.node-table td:first-child {
    padding-left: 20px;
}

.node-table th:last-child,
.node-table td:last-child {
    padding-right: 20px;
}

.node-table th {
    background: white;
    font-weight: 400;
    color: var(--gray-700);
    font-size: 0.8rem;
    white-space: nowrap;
    border-top: 1px solid var(--border-1);
    padding: 12px 16px;
}

/* 禁用表格顶部边框（用于与卡片头部重叠的场景） */
.table-no-top-border .node-table th {
    border-top: none;
}

/* 禁用表格第一行的上边框（用于 padding: 0 的 card-body，但排除 node-list-container） */
.card-body:has(.table-container) .node-table thead tr:first-child th {
    border-top: none;
}

[data-theme="dark"] .node-table th {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
}

.node-table tbody tr {
    transition: background 0.15s;
    color: var(--text-3);
}

.node-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .node-table tbody tr {
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .node-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.node-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.node-table th.sortable:hover {
    background: var(--bg-2);
}

.node-table th .sort-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0.3;
    transition: all 0.2s;
}

.node-table th.sortable:hover .sort-icon {
    opacity: 0.6;
}

.node-table th.sort-asc .sort-icon {
    opacity: 1;
    transform: rotate(180deg);
}

.node-table th.sort-desc .sort-icon {
    opacity: 1;
}

.node-table .node-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.node-table .node-type.node {
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
}

.node-table .node-type.proxy {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-info);
}

.node-table .ping-good {
    color: var(--color-success);
    font-weight: 400;
}

.node-table .ping-medium {
    color: var(--color-warning);
    font-weight: 400;
}

.node-table .ping-bad {
    color: var(--color-danger);
    font-weight: 400;
}

.node-table .ping-fail {
    color: var(--text-3);
}

[data-theme="dark"] .node-table .ping-fail {
    color: rgba(255, 255, 255, 0.6);
}

.node-table .ping-testing {
    color: var(--color-info);
}

.table-selection-info {
    font-size: 0.85rem;
    color: var(--text-3);
}

.table-selection-info span {
    color: var(--color-primary);
    font-weight: 600;
}

/* 表格复选框 */
.styled-checkbox,
.cdk-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid var(--border-1);
    border-radius: 4px;
    background: var(--bg-2);
    position: relative;
    transition: all 0.2s ease;
}

.styled-checkbox:hover,
.cdk-checkbox:hover {
    border-color: var(--color-primary);
}

.styled-checkbox:checked,
.cdk-checkbox:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.styled-checkbox:checked::after,
.cdk-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ==================== 表格组件系统结束 ==================== */

/* 原子工具类 */
/* Flex */
.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.flex-center {
    display: flex;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-end {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

/* Gap */
.gap-5 {
    gap: 5px;
}

.gap-8 {
    gap: 8px;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.gap-20 {
    gap: 20px;
}

/* Margin */
.m-0 {
    margin: 0;
}

.ml-auto {
    margin-left: auto;
}

.mr-auto {
    margin-right: auto;
}

.mt-5 {
    margin-top: 5px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-15 {
    margin-top: 15px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-5 {
    margin-bottom: 5px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Padding */
.p-0 {
    padding: 0;
}

.p-10 {
    padding: 10px;
}

.p-15 {
    padding: 15px;
}

.p-20 {
    padding: 20px;
}

/* Width/Height */
.w-auto {
    width: auto;
}

.w-full {
    width: 100%;
}

/* Text */
.text-center {
    text-align: center;
}

.font-medium {
    font-weight: 500;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Border Radius */
.rounded {
    border-radius: 8px;
}

.rounded-lg {
    border-radius: 12px;
}

.rounded-full {
    border-radius: 9999px;
}

/* Display */
.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.inline-flex {
    display: inline-flex;
}

/* Position */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

/* Cursor */
.cursor-pointer {
    cursor: pointer;
}

/* 警告提示框 */
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 0 8px 15px 8px;
    border-radius: 8px;
}

.alert svg {
    flex-shrink: 0;
}

.alert-warning {
    background: var(--color-primary-bg-5);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-border-20);
}

.alert-warning svg {
    color: var(--color-primary);
}

/* 危险卡片 */
.card-danger .card-header {
    background: rgba(220, 53, 69, .1);
    border-radius: 16px 16px 0 0;
}

/* 网络检测卡片 */
.latency-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.latency-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border-1);
    transition: all 0.3s;
}

.latency-card:hover {
    box-shadow: 0 8px 24px rgba(255, 105, 1, 0.1);
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.latency-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.latency-card-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.latency-card-icon svg {
    width: 100%;
    height: 100%;
}

.latency-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-1);
}

.latency-value {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
}

.latency-card-region {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.latency-card-region-domestic {
    background: rgba(255, 105, 1, 0.1);
    color: var(--color-primary);
}

.latency-card-region-international {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.latency-card-content {
    margin-top: 1rem;
}

.latency-bars {
    display: flex;
    gap: 3px;
    height: 6px;
    align-items: flex-end;
}

.latency-bar {
    flex: 1;
    height: 100%;
    border-radius: 2px;
    background: var(--border-1);
    transition: background-color 0.3s;
}

.latency-bar.loading {
    animation: latencyPulse 1s ease-in-out infinite;
    background: rgba(250, 171, 65, 0.4);
}

@keyframes latencyPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* 响应式适配 - 网络检测卡片 */
@media (max-width: 900px) {
    .latency-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .latency-card {
        padding: 0.85rem;
    }

    .latency-card-title {
        gap: 0.4rem;
        margin-bottom: 0.5rem;
    }

    .latency-card-icon {
        width: 18px;
        height: 18px;
    }

    .latency-card-name {
        font-size: 0.8rem;
    }

    .latency-value {
        font-size: 0.7rem;
    }

    .latency-card-region {
        font-size: 0.6rem;
        padding: 1px 5px;
    }
}

@media (max-width: 600px) {
    .latency-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .latency-card {
        padding: 0.65rem;
        border-radius: 8px;
    }

    .latency-card-title {
        gap: 0.35rem;
        margin-bottom: 0.4rem;
    }

    .latency-card-icon {
        width: 16px;
        height: 16px;
    }

    .latency-card-name {
        font-size: 0.72rem;
    }

    .latency-value {
        font-size: 0.65rem;
    }

    .latency-card-region {
        font-size: 0.55rem;
        padding: 1px 4px;
    }

    .latency-card-content {
        margin-top: 0.35rem;
    }

    .latency-bars {
        height: 4px;
        gap: 2px;
    }
}

@media (max-width: 400px) {
    .latency-cards {
        gap: 0.5rem;
    }

    .latency-card {
        padding: 0.5rem;
    }

    .latency-card-icon {
        width: 14px;
        height: 14px;
    }

    .latency-card-name {
        font-size: 0.65rem;
    }

    .latency-value {
        font-size: 0.6rem;
    }

    .latency-card-region {
        font-size: 0.5rem;
    }
}

/* 密码输入框组件 */

/* 搜索框组件 */
.search-box {
    flex: 1;
    min-width: 200px;
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
    height: 38px;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-1);
    background: var(--bg-2);
    color: var(--text-1);
    font-size: 0.85rem;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: 0;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 105, 1, .15);
}

[data-theme="dark"] .search-box input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

/* 筛选下拉框 */
.filter-select {
    height: 38px;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-1);
    background: var(--bg-2);
    color: var(--text-1);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-select:focus {
    outline: 0;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 105, 1, .15);
}

[data-theme="dark"] .filter-select {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

[data-theme="dark"] .filter-select option {
    background-color: var(--gray-800);
    color: var(--color-white);
}

[data-theme="dark"] .filter-select option:checked {
    background-color: #2d2d2d;
    color: var(--color-white);
}

/* 加载动画 - Spinner */
.loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 滚动进入动画 */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* 延迟动画 */
.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}

.delay-4 {
    transition-delay: 0.4s;
}

.delay-5 {
    transition-delay: 0.5s;
}

/* 操作反馈动画 */
@keyframes count-up {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-count {
    animation: count-up 0.4s ease-out;
}

/* 二维码容器 */
#qrcode-container,
#guest-qrcode-container,
#user-qrcode-container {
    background: var(--color-white);
    padding: 12px;
    border-radius: 12px;
    width: fit-content;
    margin: 0 auto;
}

#qrcode-container canvas,
#guest-qrcode-container canvas,
#user-qrcode-container canvas,
#qrcode-container img {
    display: block;
}

/* ==================== 登录页面组件 ==================== */

/* 全屏背景容器 */
.login-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background: url('../assets/images/Login-background.jpg') center/cover no-repeat;
    position: relative;
    overflow: hidden;
}

/* 左上角品牌标识 */
.brand-header {
    position: absolute;
    top: 4rem;
    left: 4rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    z-index: 10;
}

.brand-logo {
    display: flex;
    align-items: center;
}

.brand-logo img {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-text h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.brand-text p {
    font-size: 0.85rem;
    color: var(--color-primary);
    margin: 0.3rem 0 0 0;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 登录区域 */
.login-section {
    width: 100%;
    max-width: 480px;
    margin-right: 8%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.login-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    padding: 2.5rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.50);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

.login-box h1 {
    font-size: 1.6rem;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-box .subtitle {
    color: #0a0a0a;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

/* 登录/注册切换 Tab */
.login-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-100);
}

.login-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
}

.login-tab:hover {
    color: var(--color-primary);
}

.login-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* 表单面板切换 */
.form-panel {
    display: none;
}

.form-panel.active {
    display: block;
}

/* 登录页输入框样式 */
.login-box .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-box .input-icon {
    position: absolute;
    left: 1.2rem;
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    pointer-events: none;
    z-index: 1;
}

.login-box .form-group input {
    width: 100%;
    height: 40px;
    padding: 0 1rem 0 3.2rem;
    background: var(--color-white);
    border: 1px solid var(--gray-200);
    border-radius: 50px;
    color: #1f1f1f;
    font-size: 1rem;
    line-height: 38px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.login-box .form-group input::placeholder {
    color: var(--gray-400);
}

.login-box .form-group input:focus {
    outline: none;
    background: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg-10);
}

.login-box .input-wrapper:focus-within .input-icon {
    color: var(--color-primary);
}

/* 登录页按钮样式 */
.login-box .btn {
    width: 100%;
    height: 40px;
    padding: 0 1rem;
    margin-top: 2rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border: none;
    color: white;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--color-primary-shadow);
    box-sizing: border-box;
}

.login-box .btn:hover {
    background: linear-gradient(135deg, #ff7a1a, #ffab5d);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 105, 1, 0.4);
}

.login-box .btn:active {
    transform: translateY(0);
}

.login-box .btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Turnstile 验证 */
.cf-turnstile,
#loginTurnstileWidget,
#registerTurnstileWidget,
#adminTurnstileWidget {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

.form-group:has(.cf-turnstile),
.form-group:has(#loginTurnstileWidget),
.form-group:has(#registerTurnstileWidget),
.form-group:has(#adminTurnstileWidget) {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* 登录页响应式适配 */
@media (max-width: 968px) {
    .login-container {
        justify-content: center;
    }

    .brand-header {
        display: none;
    }

    .login-section {
        max-width: 100%;
        margin-right: 0;
    }
}

@media (max-width: 420px) {
    .login-section {
        padding: 1.5rem;
    }

    .login-box {
        padding: 2rem 1.5rem;
    }

    .login-box h1 {
        font-size: 1.5rem;
    }
}

/* ==================== 侧边栏组件 (Sidebar) ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid var(--border-1);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    white-space: nowrap;
    height: 100%;
}

.sidebar.expanded {
    width: var(--sidebar-expanded-width);
}

[data-theme="dark"] .sidebar {
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
}

/* 侧边栏头部 Logo */
.sidebar-header {
    padding: 0 16px;
    border-bottom: 1px solid var(--border-1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--header-height);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.logo-text {
    display: none;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.sidebar.expanded .logo-text {
    display: block;
}

.logo-senflare {
    color: var(--text-1);
}

.logo-link {
    color: var(--color-primary);
}

/* 导航菜单 */
.nav-menu {
    flex: 1;
    padding: 12px 12px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar:not(.expanded) .nav-menu {
    padding: 12px 0;
}

.sidebar:not(.expanded) .nav-item {
    margin: 2px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 44px;
    margin: 2px 0;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-3);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.sidebar.expanded .nav-item {
    justify-content: flex-start;
}

.nav-item i,
.nav-item svg {
    width: 20px;
    height: 20px;
    font-style: normal;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.nav-item svg {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-text {
    display: none;
    margin-left: 12px;
    white-space: nowrap;
}

.sidebar.expanded .nav-text {
    display: inline;
}

.nav-item:hover {
    background: var(--color-primary-bg-10);
    color: var(--color-primary);
}

.nav-item:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

.sidebar:not(.expanded) .nav-item:hover::before {
    display: none;
}

.nav-item.active {
    background: var(--color-primary-bg-10);
    color: var(--color-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

.sidebar:not(.expanded) .nav-item.active::before {
    display: none;
}

/* 二级菜单 */
.nav-group {
    margin: 2px 0;
    position: relative;
}

.nav-group-title {
    position: relative;
    cursor: pointer;
}

.nav-group-title .nav-arrow {
    position: absolute;
    right: 12px;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.sidebar:not(.expanded) .nav-group-title .nav-arrow {
    display: none;
}

.nav-group.expanded .nav-group-title .nav-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: transparent;
}

.sidebar.expanded .nav-group.expanded .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    font-size: 0.9rem;
    height: 44px;
}

/* 收起状态下的二级菜单 - 悬浮弹出 */
.sidebar:not(.expanded) .nav-group {
    position: relative;
}

.sidebar:not(.expanded) .nav-group-title {
    justify-content: center;
}

.sidebar:not(.expanded) .nav-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 180px;
    max-height: none;
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    margin-left: 8px;
    z-index: 1000;
}

/* 悬浮菜单的小三角 */
.sidebar:not(.expanded) .nav-submenu::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 6px 0;
    border-color: transparent var(--border-1) transparent transparent;
}

.sidebar:not(.expanded) .nav-submenu::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 12px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 6px 0;
    border-color: transparent var(--bg-1) transparent transparent;
}

.sidebar:not(.expanded) .nav-group:hover .nav-submenu {
    display: block;
}

.sidebar:not(.expanded) .nav-submenu .nav-subitem {
    padding: 0 16px !important;
    height: 44px;
    border-radius: 0;
}

.sidebar:not(.expanded) .nav-submenu .nav-subitem:hover {
    background: var(--color-primary-bg-10);
}

/* 深色模式下的悬浮菜单 */
[data-theme="dark"] .sidebar:not(.expanded) .nav-submenu {
    background: var(--bg-2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sidebar:not(.expanded) .nav-submenu::after {
    border-color: transparent var(--bg-2) transparent transparent;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 12px;
    min-height: var(--header-height);
    border-top: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.sidebar.expanded .sidebar-footer {
    align-items: stretch;
    min-height: var(--header-height);
}

.sidebar:not(.expanded) .sidebar-footer {
    min-height: auto;
    padding: 8px 0 0 0;
    gap: 0;
}

/* 底部操作栏 */
.footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.sidebar:not(.expanded) .footer-actions {
    flex-direction: column;
}

/* 用户信息区域 */
.user-info {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--text-3);
    border-radius: 10px;
    transition: all 0.2s;
    flex: 1;
    min-width: 0;
}

.user-info:hover {
    background: var(--bg-2);
    color: var(--color-primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 105, 1, 0.3);
}

.user-details {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}

.sidebar.expanded .user-details {
    display: block;
}

.sidebar.expanded .user-avatar {
    display: none;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-1);
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.user-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-right: 6px;
}

[data-theme="dark"] .user-name {
    color: rgba(255, 255, 255, 0.85);
}

.sidebar:not(.expanded) .user-info {
    padding: 2px 0;
    justify-content: center;
    height: 36px;
    border-radius: 0;
    margin-bottom: 8px;
}

/* 底部右侧按钮组 */
.footer-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sidebar:not(.expanded) .footer-right {
    flex-direction: column;
    gap: 0;
    width: 100%;
}

/* 侧边栏底部按钮（主题切换、折叠按钮） */
.sidebar .theme-toggle,
.sidebar .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    color: var(--text-3);
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.sidebar .theme-toggle:hover,
.sidebar .menu-toggle:hover {
    background: var(--bg-2);
    color: var(--color-primary);
}

.sidebar .theme-toggle #theme-icon,
.sidebar .theme-toggle svg,
.sidebar .menu-toggle svg {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar:not(.expanded) .theme-toggle,
.sidebar:not(.expanded) .menu-toggle {
    width: 100%;
    height: 32px;
    border-radius: 0;
}

.sidebar-overlay {
    display: none;
}

/* ==================== 顶部导航栏 (Header) ==================== */
.header {
    height: var(--header-height);
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 200;
    flex-shrink: 0;
    position: relative;
    gap: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    color: var(--text-3);
    border-radius: 8px;
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    color: var(--color-primary);
    background: var(--bg-2);
}

/* 移动端品牌 */
.mobile-brand {
    display: none;
}

/* 面包屑导航 */
.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.breadcrumb-item {
    color: var(--text-3);
    transition: color 0.2s;
}

.breadcrumb-item.active {
    color: var(--text-3);
}

.breadcrumb-separator {
    color: var(--text-3);
    opacity: 0.4;
}

/* 搜索框 */
.header-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-2);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: all 0.2s;
    min-width: 240px;
    max-width: 400px;
}

.header-search:focus-within {
    border-color: var(--color-primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(255, 105, 1, 0.08);
}

.header-search svg {
    color: var(--text-3);
    flex-shrink: 0;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    color: var(--text-1);
    width: 100%;
}

.header-search input::placeholder {
    color: var(--text-3);
}

/* 头部按钮 */
.header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-3);
    transition: all 0.2s;
}

.header-btn:hover {
    background: var(--bg-2);
    color: var(--color-primary);
}

/* 通知图标 */
.header-alert {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-3);
    transition: all 0.2s;
}

.header-alert:hover {
    background: var(--bg-2);
    color: var(--color-primary);
}

.alert-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 通知下拉菜单 */
.alert-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-1);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    overflow: hidden;
}

.alert-dropdown.show {
    display: block;
}

.alert-dropdown-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-1);
    font-weight: 600;
    font-size: 0.9rem;
}

.alert-dropdown-list {
    max-height: 400px;
    overflow-y: auto;
}

.alert-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 0.875rem;
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--sidebar-expanded-width);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s;
    gap: 6px;
}

.header-title .title-senflare {
    color: var(--text-1);
}

.header-title .title-admin {
    color: var(--color-primary);
}

/* ==================== 主体布局 (App Body) ==================== */
.app-body {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

/* 主内容包装器 */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ==================== 主内容区域 (Main Content) ==================== */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    position: relative;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
}

#view-dashboard,
#view-config,
#view-speedtest,
#view-backendconfig,
#view-subscription,
#view-cdkmgmt,
#view-packages,
#view-orders,
#view-coupons,
#view-payment,
#view-announcementmgmt,
#view-usermgmt,
#view-tickets,
#view-logs,
#view-advanced {
    overflow-x: hidden;
}

/* ==================== 页面标题 ==================== */
.page-header {
    margin-bottom: 24px;
}

.page-header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-1);
    margin: 0;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-3);
    margin: 0;
}

/* ==================== 快速统计卡片 ==================== */
.stats-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
}

.stat-card {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-white);
    border-radius: 10px;
    border: 1px solid var(--border-1);
    transition: all 0.2s ease;
}

[data-theme="dark"] .stat-card {
    background: var(--card-bg);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card.total .stat-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
}

.stat-card.total .stat-icon svg {
    stroke: var(--color-indigo);
}

.stat-card.total .stat-value {
    color: var(--color-indigo);
}

.stat-card.unused .stat-icon,
.stat-card.active .stat-icon {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
}

.stat-card.unused .stat-icon svg,
.stat-card.active .stat-icon svg {
    stroke: var(--color-success);
}

.stat-card.unused .stat-value,
.stat-card.active .stat-value {
    color: var(--color-success);
}

.stat-card.inactive .stat-icon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
}

.stat-card.inactive .stat-icon svg {
    stroke: var(--color-danger);
}

.stat-card.inactive .stat-value {
    color: var(--color-danger);
}

.stat-card.expired .stat-icon {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.05));
}

.stat-card.expired .stat-icon svg {
    stroke: var(--color-orange);
}

.stat-card.expired .stat-value {
    color: var(--color-orange);
}

.stat-card.used .stat-icon {
    background: linear-gradient(135deg, var(--gray-bg-15), rgba(156, 163, 175, 0.05));
}

.stat-card.used .stat-icon svg {
    stroke: var(--gray-300);
}

.stat-card.used .stat-value {
    color: var(--text-3);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-3);
    font-weight: 500;
}

.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 4px;
}

.stat-trend.positive {
    color: var(--color-success);
}

.stat-trend.negative {
    color: var(--color-danger);
}

.stat-trend.neutral {
    color: var(--text-3);
}

.stat-trend svg {
    flex-shrink: 0;
}

/* 响应式 */
@media (max-width: 768px) {
    .stats-grid {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ==================== Toast 提示框 ==================== */
.toast {
    backdrop-filter: blur(10px);
    background: rgba(34, 197, 94, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-200%);
    padding: 10px 30px;
    border-radius: 50px;
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10001;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    color: var(--color-white);
    justify-content: center;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.toast.error {
    background: rgba(239, 68, 68, 0.95);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* ==================== 节点列表组件 ==================== */
.node-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    transition: all 0.2s;
}

.node-item.is-current {
    background: var(--color-primary-bg-10);
    border-color: var(--color-primary);
}

.node-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-1);
    flex-shrink: 0;
}

.node-status.active {
    background: var(--color-success);
}

.node-info {
    flex: 1;
    min-width: 0;
}

.node-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    min-height: 22px;
    flex-wrap: wrap;
}

.node-name {
    font-weight: 600;
    color: var(--text-1);
}

.node-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-white);
}

.tag-master {
    background: var(--color-primary);
}

.tag-current {
    background: var(--color-success);
}

.node-url {
    font-size: 0.75rem;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-danger-light {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-light:hover {
    background: rgba(239, 68, 68, 0.2);
}

.node-list-scroll {
    max-height: 400px;
    overflow-y: auto;
}

/* 节点列表移动端适配 */
@media (max-width: 480px) {
    .node-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .node-info {
        flex: 1 1 calc(100% - 30px);
    }

    .node-title {
        font-size: 0.9rem;
    }

    .node-url {
        font-size: 0.75rem;
    }

    .node-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }

    .node-actions .btn {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
}

/* ==================== 移动端响应式 - 侧边栏和导航栏 ==================== */
@media (max-width: 768px) {
    /* 移动端 Header 布局 */
    .header {
        justify-content: flex-start;
        padding: 0 12px;
        z-index: 1000;
        gap: 8px;
    }

    .header-left {
        gap: 8px;
    }

    .header-title {
        display: flex;
        font-weight: bold;
        font-size: 1rem;
        position: static;
        width: auto;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 移动端品牌文字显示在导航栏 */
    .mobile-brand {
        display: flex;
        align-items: baseline;
        gap: 2px;
        font-size: 1.1rem;
        font-weight: 700;
    }

    .mobile-brand .logo-senflare {
        color: var(--text-1);
    }

    .mobile-brand .logo-link {
        color: var(--color-primary);
    }

    /* 移动端隐藏搜索框和面包屑 */
    .header-search,
    .page-breadcrumb {
        display: none;
    }

    .header-right {
        margin-left: auto;
    }

    /* 移动端侧边栏 */
    .sidebar {
        position: fixed;
        top: var(--header-height);
        bottom: 0;
        left: 0;
        height: calc(100vh - var(--header-height));
        width: 250px;
        z-index: 999;
        background: var(--sidebar-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-right: none;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* 移动端隐藏侧边栏 logo */
    .sidebar .sidebar-header {
        display: none;
    }

    /* 移动端侧边栏始终显示文字 */
    .sidebar .nav-text,
    .sidebar .logo-text {
        display: block;
    }

    .sidebar .nav-item {
        justify-content: flex-start;
    }

    .sidebar .footer-actions {
        flex-direction: row;
    }

    .sidebar .footer-right {
        flex-direction: row;
    }

    .sidebar-footer {
        align-items: stretch;
    }

    .sidebar .user-details {
        display: block;
    }

    .sidebar .user-avatar {
        display: none;
    }

    /* 遮罩层 */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* 主内容区域移动端适配 */
    .content {
        padding: 15px;
    }

    /* 移动端表格适配 */
    .table-auto {
        min-width: auto;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .node-list-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .node-table {
        min-width: 600px;
    }
}

/* 弹窗内的卡片样式 */
.modal .card,
.modal-content .card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .modal .card,
[data-theme="dark"] .modal-content .card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 价格跳动动画 */
@keyframes priceJump {
    75% { transform: scale(1.05); }
}

.price-jump {
    animation: priceJump 0.5s ease;
}

/* ==================== 主题设置弹窗 ==================== */
.theme-modal {
    max-width: 400px;
}

.color-picker {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 渐变色板 */
.color-gradient {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    position: relative;
    cursor: crosshair;
    background: linear-gradient(to bottom, transparent, black),
                linear-gradient(to right, white, hsl(0, 100%, 50%));
}

.gradient-cursor {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* 控制区 */
.color-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.color-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-1);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.color-sliders {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.slider-wrapper {
    position: relative;
}

/* 色相滑块 */
.hue-slider {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right,
        #ff0000 0%, #ffff00 17%, #00ff00 33%,
        #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    position: relative;
    cursor: pointer;
}

/* 透明度滑块 */
.alpha-slider {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    background: linear-gradient(to right, transparent, #ff6901),
                repeating-conic-gradient(#ddd 0% 25%, white 0% 50%) 50% / 10px 10px;
}

.slider-thumb {
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--border-1);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    pointer-events: none;
}

/* 颜色输入 */
.color-input-wrapper {
    display: flex;
    justify-content: center;
}

.color-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-2);
    color: var(--text-1);
    font-size: 0.95rem;
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.color-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--card-bg);
}

/* 预设颜色 */
.preset-colors {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
}

.preset-color {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.preset-color:hover {
    border-color: var(--color-primary);
    transform: scale(1.1);
}

/* ==================== 邀请返利和财务管理样式 ==================== */

/* 周期标签页 */
.period-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.period-tab:hover {
    color: var(--text-1);
}

.period-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

/* 价格跳动动画 */
@keyframes priceJump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.price-jump {
    animation: priceJump 0.5s ease;
}

/* ==================== 统计卡片网格（用户端和管理端通用）==================== */

/* 四个统计卡片网格 */
.usage-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.usage-stat-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-white);
    border: 1px solid var(--border-1);
    border-radius: 12px;
    transition: all 0.2s;
}

.usage-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--bg-3);
}

.usage-stat-icon {
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.usage-stat-icon.blue {
    background: var(--info-bg-15);
    color: var(--color-info);
}

.usage-stat-icon.green {
    background: var(--success-bg-15);
    color: var(--color-success);
}

.usage-stat-icon.orange {
    background: var(--warning-bg-15);
    color: var(--color-warning);
}

.usage-stat-icon.purple {
    background: var(--purple-bg-15);
    color: var(--color-purple);
}

.usage-stat-icon.red {
    background: var(--danger-bg-15);
    color: var(--color-danger);
}

.usage-stat-icon.yellow {
    background: var(--yellow-bg-15);
    color: var(--color-yellow);
}

.usage-stat-info {
    display: flex;
    flex-direction: column;
}

.usage-stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.2;
}

.usage-stat-value.blue {
    color: var(--color-info);
}

.usage-stat-value.green {
    color: var(--color-success);
}

.usage-stat-value.orange {
    color: var(--color-warning);
}

.usage-stat-value.purple {
    color: var(--color-purple);
}

.usage-stat-value.red {
    color: var(--color-danger);
}

.usage-stat-value.yellow {
    color: var(--color-yellow);
}

.usage-stat-label {
    font-size: 0.75rem;
    color: var(--text-3);
    margin-top: 2px;
}

/* 深色模式适配 */
[data-theme="dark"] .usage-stat-card {
    background: var(--card-bg);
    border-color: var(--bg-3);
}

[data-theme="dark"] .usage-stat-card:hover {
    box-shadow: 0 4px 12px var(--color-black-30);
}

/* 响应式适配 */
@media (max-width: 1024px) {
    .usage-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .usage-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .usage-stat-card {
        padding: 12px 14px;
    }
}

/* 提示信息框 */
.info-box {
    padding: 12px;
    background: var(--color-primary-bg-10);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--color-primary);
}

.info-box svg {
    vertical-align: middle;
    margin-right: 6px;
}

/* ==================== 交易记录组件 ==================== */

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-1);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.transaction-item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.transaction-info {
    flex: 1;
    text-align: center;
}

.transaction-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
}

.transaction-desc {
    font-size: 0.9rem;
    color: var(--text-1);
}

.transaction-time {
    font-size: 0.8rem;
    color: var(--text-3);
}

.transaction-amount {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.transaction-amount.positive {
    color: var(--color-success);
}

.transaction-amount.negative {
    color: var(--color-danger);
}


/* ==================== 分页组件样式 ==================== */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1rem 1rem 0;
    flex-wrap: wrap;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-3);
}

.pagination-size {
    padding: 0 0.5rem;
    border: 1px solid var(--border-1);
    border-radius: 4px;
    background: var(--bg-1);
    color: var(--text-1);
    cursor: pointer;
    font-size: 0.85rem;
    height: 26px;
    transition: border-color 0.2s;
}

.pagination-size:hover {
    border-color: var(--color-primary);
}

.pagination-size:focus {
    outline: none;
    border-color: var(--color-primary);
}

.pagination-total {
    color: var(--color-primary);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0 0.6rem;
    border: 1.5px solid var(--border-1);
    border-radius: 4px;
    background: var(--bg-1);
    color: var(--text-1);
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1;
    transition: all 0.2s;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-current {
    font-size: 0.85rem;
    color: var(--text-3);
    white-space: nowrap;
    text-align: center;
}

.pagination-current::before {
    content: '第 ';
}

.pagination-current::after {
    content: ' 页';
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-3);
}

.pagination-input {
    width: 50px;
    padding: 0 0.4rem;
    border: 1px solid var(--border-1);
    border-radius: 4px;
    background: var(--bg-1);
    color: var(--text-1);
    text-align: center;
    font-size: 0.85rem;
    height: 26px;
    transition: border-color 0.2s;
}

/* 隐藏 number 输入框的上下箭头 */
.pagination-input::-webkit-outer-spin-button,
.pagination-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.pagination-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.pagination-input:hover {
    border-color: var(--color-primary);
}

.pagination-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.pagination-btn.pagination-go {
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary-border);
    background: var(--color-primary-bg-10);
    padding: 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 400;
}

.pagination-btn.pagination-go:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* 响应式 */
@media (max-width: 768px) {
    .pagination-wrapper {
        justify-content: center;
    }
}
