/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #EEF2FF;
    --success: #10B981;
    --success-light: #ECFDF5;
    --warning: #F59E0B;
    --warning-light: #FFFBEB;
    --error: #EF4444;
    --error-light: #FEF2F2;
    --info: #3B82F6;
    --bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --border: #E5E7EB;
    --sidebar-bg: #1E1B4B;
    --sidebar-hover: #312E81;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
                 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

/* ==================== 认证页面 ==================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.auth-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-form {
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ==================== 表单组件 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.textarea-input,
.input-full {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.textarea-input:focus,
.input-full:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.textarea-input {
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.error-msg {
    background: var(--error-light);
    color: var(--error);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

/* ==================== 按钮组件 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: #D1D5DB;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #DC2626;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ==================== 加载动画 ==================== */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

.btn-secondary .spinner {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: var(--text);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 仪表盘布局 ==================== */
.dashboard-page {
    min-height: 100vh;
}

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text);
}

.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    padding: 16px 0;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
}

.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-blue { background: var(--primary-light); color: var(--primary); }
.stat-icon-green { background: var(--success-light); color: var(--success); }
.stat-icon-purple { background: #FAF5FF; color: #8B5CF6; }
.stat-icon-orange { background: var(--warning-light); color: var(--warning); }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== 区块标题 ==================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* ==================== 账号列表 ==================== */
.account-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.account-card:hover {
    box-shadow: var(--shadow-md);
}

.account-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.account-info {
    display: flex;
    align-items: start;
    gap: 12px;
}

.account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.account-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.account-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.account-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 状态徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-idle { background: #F3F4F6; color: #6B7280; }
.badge-running { background: var(--primary-light); color: var(--primary); }
.badge-completed { background: var(--success-light); color: var(--success); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-stopped { background: var(--warning-light); color: var(--warning); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-running .badge-dot {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* 进度条 */
.progress-section {
    margin-top: 14px;
}

.progress-bar-container {
    background: var(--border);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818CF8);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar.completed {
    background: var(--success);
}

.progress-bar.error {
    background: var(--error);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-current {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text);
}

.progress-current-label {
    color: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 16px;
    color: var(--text-light);
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text);
}

.empty-state p {
    font-size: 14px;
}

/* ==================== 标签页 ==================== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== 使用指南 ==================== */
.guide-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.guide-card h2 {
    font-size: 20px;
    margin-bottom: 24px;
}

.guide-section {
    margin-bottom: 28px;
}

.guide-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--primary);
}

.guide-section ol,
.guide-section ul {
    padding-left: 20px;
    font-size: 14px;
    line-height: 2;
    color: var(--text);
}

.guide-section code {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: var(--primary);
}

.guide-section kbd {
    background: var(--text);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

.guide-section a {
    color: var(--primary);
}

/* ==================== 弹窗 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.2s ease;
}

.modal-large {
    max-width: 720px;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--bg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.verify-result {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-top: 8px;
}

.verify-result.success {
    background: var(--success-light);
    color: var(--success);
}

.verify-result.error {
    background: var(--error-light);
    color: var(--error);
}

/* ==================== 日志内容 ==================== */
.log-content {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
    max-height: 500px;
    overflow-y: auto;
    background: #1E1B4B;
    border-radius: var(--radius-sm);
    padding: 16px;
    color: #E0E7FF;
}

.log-entry {
    padding: 2px 0;
    word-break: break-all;
}

.log-time {
    color: #818CF8;
    margin-right: 8px;
}

.log-level-INFO { color: #93C5FD; }
.log-level-WARNING { color: #FCD34D; }
.log-level-ERROR { color: #FCA5A5; }
.log-level-DEBUG { color: #6EE7B7; }

.log-level-badge {
    display: inline-block;
    min-width: 60px;
    text-align: center;
    margin-right: 8px;
    font-weight: 600;
}

/* ==================== Toast通知 ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
    animation: toastSlideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* ==================== 积分徽章 ==================== */
.points-badge-topbar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--warning-light);
    color: var(--warning);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.points-badge-topbar:hover {
    background: #FDE68A;
}

/* ==================== 数据表格 ==================== */
.admin-table-wrap {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table thead {
    background: var(--bg);
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.admin-table tbody tr:hover {
    background: #F9FAFB;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* 积分显示 */
.points-display {
    font-weight: 700;
    color: var(--primary);
}

.points-display.negative {
    color: var(--error);
}

/* 交易类型徽章 */
.tx-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.tx-type-recharge { background: var(--success-light); color: var(--success); }
.tx-type-spend { background: var(--error-light); color: var(--error); }
.tx-type-adjust { background: var(--warning-light); color: var(--warning); }
.tx-type-register { background: var(--primary-light); color: var(--primary); }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .auth-card {
        padding: 28px 20px;
    }

    .account-card-header {
        flex-direction: column;
        gap: 12px;
    }

    .account-actions {
        flex-wrap: wrap;
    }

    .modal-content {
        width: 95%;
    }
}

/* ==================== 设置页面 ==================== */
.settings-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    max-width: 600px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.settings-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.settings-section .form-group {
    margin-bottom: 18px;
}

.settings-section .form-group:last-of-type {
    margin-bottom: 20px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ==================== VIP徽章与卡片 ==================== */
.vip-badge-topbar {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-left: 8px;
    border: 1px solid #F59E0B;
}

.vip-badge-admin {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #FEE2E2;
    color: #DC2626;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 4px;
}

.vip-badge-user {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 4px;
    border: 1px solid #F59E0B;
}

.vip-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.vip-card .vip-active,
.vip-card .vip-inactive {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
}

.vip-card .vip-active {
    background: linear-gradient(135deg, #FEF3C7, #FFFBEB);
    border: 1px solid #F59E0B;
}

.vip-card .vip-inactive {
    background: var(--card-bg);
    border: 1px solid var(--border);
}

.vip-card .vip-icon {
    font-size: 40px;
    line-height: 1;
}

.vip-card .vip-info {
    flex: 1;
}

.vip-card .vip-info h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
}

.vip-card .vip-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.vip-card .vip-info strong {
    color: var(--warning);
    font-size: 16px;
}

/* ==================== 积分充值说明 ==================== */
.recharge-card {
    display: flex;
    gap: 24px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.recharge-icon {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light, #EEF2FF);
    border-radius: 16px;
    color: var(--primary);
}

.recharge-body h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.recharge-body > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.recharge-contact {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.contact-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 24px;
    background: var(--bg-secondary, #F8FAFC);
    border-radius: 10px;
    min-width: 220px;
}

.contact-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.contact-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
}

.contact-value:hover {
    opacity: 0.7;
}

.recharge-tips h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.recharge-tips ol {
    padding-left: 20px;
    line-height: 2;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .recharge-card {
        flex-direction: column;
        padding: 20px;
    }
    .recharge-contact {
        flex-direction: column;
    }
}
