/* 管理后台样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* 主容器 */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-header i {
    margin-right: 8px;
    color: #ffd700;
}

.sidebar-nav ul {
    list-style: none;
    padding: 20px 0;
}

.nav-item {
    margin: 5px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    border-left-color: #ffd700;
}

.nav-item.active .nav-link {
    background-color: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #ffd700;
}

.nav-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
}

.back-link {
    display: flex;
    align-items: center;
    padding: 10px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.back-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.back-link i {
    margin-right: 8px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
}

/* 顶部栏 */
.top-bar {
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logout-btn {
    color: #718096;
    text-decoration: none;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background-color: #e2e8f0;
    color: #e53e3e;
}

/* 内容区域 */
.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.stat-label {
    color: #718096;
    font-size: 0.9rem;
}

/* 部分头部 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
}

.section-actions {
    display: flex;
    gap: 12px;
}

/* 按钮样式 */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-danger {
    background-color: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background-color: #c53030;
}

.btn-warning {
    background-color: #ed8936;
    color: white;
}

.btn-warning:hover {
    background-color: #dd6b20;
}

/* 过滤栏 */
.filter-bar {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: #4a5568;
    white-space: nowrap;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 表格容器 */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.table-container h3 {
    padding: 16px 20px;
    margin: 0;
    background-color: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #2d3748;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: #f7fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f7fafc;
}

.data-table .loading {
    text-align: center;
    color: #718096;
    padding: 40px;
}

/* 状态标签 */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-active {
    background-color: #c6f6d5;
    color: #22543d;
}

.status-inactive {
    background-color: #fed7d7;
    color: #742a2a;
}

.status-suspended {
    background-color: #fbb6ce;
    color: #702459;
}

.status-deleted {
    background-color: #f5c6cb;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

.status-pending {
    background-color: #fef5e7;
    color: #744210;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn.edit {
    background-color: #4299e1;
    color: white;
}

.action-btn.edit:hover {
    background-color: #3182ce;
}

.action-btn.delete {
    background-color: #e53e3e;
    color: white;
}

.action-btn.delete:hover {
    background-color: #c53030;
}

.action-btn.view {
    background-color: #38a169;
    color: white;
}

.action-btn.view:hover {
    background-color: #2f855a;
}

/* 仪表板小部件 */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.widget {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.widget h3 {
    padding: 16px 20px;
    margin: 0;
    background-color: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #2d3748;
}

.widget .loading {
    padding: 40px;
    text-align: center;
    color: #718096;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #718096;
    transition: color 0.3s ease;
}

.close:hover {
    color: #e53e3e;
}

.modal-body {
    padding: 20px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 加载覆盖层 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 消息容器 */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
}

.message.success {
    background-color: #c6f6d5;
    color: #22543d;
    border-left: 4px solid #38a169;
}

.message.error {
    background-color: #fed7d7;
    color: #742a2a;
    border-left: 4px solid #e53e3e;
}

.message.warning {
    background-color: #fef5e7;
    color: #744210;
    border-left: 4px solid #ed8936;
}

.message.info {
    background-color: #bee3f8;
    color: #2a4365;
    border-left: 4px solid #4299e1;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   用户详情和表单样式
   ======================================== */

/* 用户详情样式 */
.user-detail-view {
    max-width: 800px;
    margin: 0 auto;
}

.detail-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.detail-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.detail-item label {
    font-weight: 600;
    color: #495057;
    margin-right: 10px;
}

.detail-item span {
    color: #6c757d;
    text-align: right;
}

/* 验证状态样式 */
.verification-status {
    font-size: 14px;
}

.verification-badge {
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.verification-badge.verified {
    background: #d4edda;
    color: #155724;
}

.verification-badge.unverified {
    background: #f8d7da;
    color: #721c24;
}

/* 推荐码样式 */
.referral-code {
    font-family: monospace;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* 操作按钮样式增强 */
.action-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.action-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    min-width: 30px;
    text-align: center;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-btn.view {
    background: #17a2b8;
    color: white;
}

.action-btn.edit {
    background: #ffc107;
    color: #212529;
}

.action-btn.distributor {
    background: #28a745;
    color: white;
}

.action-btn.delete {
    background: #dc3545;
    color: white;
}

.action-disabled {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    background: #6c757d;
    color: #fff;
    opacity: 0.5;
    cursor: not-allowed;
}

/* 综合用户表单样式 */
.comprehensive-user-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.form-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.field-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    line-height: 1.3;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    margin-top: 20px;
}

/* 状态徽章增强 */
.status-badge.status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.status-none {
    background: #e2e3e5;
    color: #495057;
    border: 1px solid #ced4da;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
    
    .detail-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .detail-item span {
        text-align: left;
        margin-top: 4px;
    }
}

/* ========================================
   分销管理样式
   ======================================== */

/* 分销商详情样式 */
.distributor-detail-view {
    max-width: 900px;
    margin: 0 auto;
}

/* 统计数字样式 */
.stat-number {
    font-weight: 700;
    color: #007bff;
    font-size: 16px;
}

.stat-money {
    font-weight: 700;
    color: #28a745;
    font-size: 16px;
}

.stat-money.highlight {
    color: #dc3545;
    font-size: 18px;
}

.stat-money.available {
    color: #17a2b8;
}

/* 等级徽章样式 */
.level-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.level-badge.level-bronze {
    background: #cd7f32;
    color: white;
}

.level-badge.level-silver {
    background: #c0c0c0;
    color: #333;
}

.level-badge.level-gold {
    background: #ffd700;
    color: #333;
}

.level-badge.level-diamond {
    background: #b9f2ff;
    color: #333;
}

.level-badge.level-super {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
}

/* 操作按钮扩展样式 */
.action-btn.approve {
    background: #28a745;
    color: white;
}

.action-btn.suspend {
    background: #ffc107;
    color: #212529;
}

.action-btn.activate {
    background: #17a2b8;
    color: white;
}

.action-btn.referrals {
    background: #6f42c1;
    color: white;
}

/* 推荐树样式 */
.referral-tree-view {
    max-width: 800px;
    margin: 0 auto;
}

.tree-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.tree-header h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.tree-header p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.tree-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
}

.tree-node {
    position: relative;
    margin: 10px 0;
}

.tree-node.root .node-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border: 3px solid #5a67d8;
}

.tree-node.level-1 .node-content {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    margin-left: 30px;
}

.tree-node.level-2 .node-content {
    background: #f3e5f5;
    border: 2px solid #9c27b0;
    margin-left: 60px;
}

.tree-node.level-3 .node-content {
    background: #fff3e0;
    border: 2px solid #ff9800;
    margin-left: 90px;
}

.node-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    background: white;
    border: 1px solid #dee2e6;
    margin: 5px 0;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-id {
    font-size: 12px;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
}

.tree-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

/* 树节点连接线 */
.tree-node:not(.root)::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: #6c757d;
}

.tree-node:not(.root):not(:last-child)::after {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    bottom: -50%;
    width: 1px;
    background: #6c757d;
}

/* 佣金管理相关样式 */
.commission-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.commission-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.commission-card h5 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.commission-card .amount {
    font-size: 24px;
    font-weight: 700;
    color: #007bff;
}

.commission-card.total {
    border-left-color: #28a745;
}

.commission-card.total .amount {
    color: #28a745;
}

.commission-card.pending {
    border-left-color: #ffc107;
}

.commission-card.pending .amount {
    color: #ffc107;
}

.commission-card.paid {
    border-left-color: #17a2b8;
}

.commission-card.paid .amount {
    color: #17a2b8;
}

/* ========================================
   推荐关系管理样式
   ======================================== */

/* 推荐关系详情样式 */
.referral-detail-view {
    max-width: 800px;
    margin: 0 auto;
}

/* 用户信息显示 */
.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-info .username {
    font-weight: 600;
    color: #333;
}

.user-info .user-id {
    font-size: 11px;
    color: #6c757d;
    background: #e9ecef;
    padding: 1px 4px;
    border-radius: 8px;
    align-self: flex-start;
}

/* 推荐关系表单样式 */
.referral-form {
    max-width: 500px;
    margin: 0 auto;
}

/* 佣金金额样式 */
.commission-amount {
    font-weight: 600;
    color: #28a745;
}

.commission-amount.zero {
    color: #6c757d;
}

/* 推荐关系树选择器 */
.referral-tree-selector {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.referral-tree-selector h4 {
    margin-bottom: 20px;
    color: #333;
}

.referral-tree-selector .form-group {
    margin-bottom: 20px;
}

.referral-tree-selector input {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 16px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 0;
    border-top: 1px solid #dee2e6;
}

.pagination-info {
    color: #6c757d;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 5px;
}

.pagination-controls .btn {
    min-width: 40px;
    height: 32px;
    padding: 4px 8px;
    font-size: 14px;
}

.pagination-controls .btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* 操作按钮扩展 */
.action-btn.activate {
    background: #28a745;
    color: white;
}

.action-btn.disable {
    background: #dc3545;
    color: white;
}

.action-btn.tree {
    background: #6f42c1;
    color: white;
}

/* 文本样式 */
.text-muted {
    color: #6c757d !important;
    font-style: italic;
}

/* 层级徽章特殊样式 */
.level-badge.level-1 {
    background: #007bff;
    color: white;
}

.level-badge.level-2 {
    background: #6610f2;
    color: white;
}

/* 响应式设计增强 */
@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        gap: 10px;
    }
    
    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .user-info {
        align-items: center;
        text-align: center;
    }
    
    .action-buttons {
        justify-content: center;
    }
}

/* ========================================
   会话管理样式
   ======================================== */

/* 会话统计卡片 */
.session-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    border-left: 4px solid #007bff;
}

.summary-card h5 {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 14px;
    font-weight: 600;
}

.summary-card .count {
    font-size: 32px;
    font-weight: 700;
    color: #007bff;
}

.summary-card .count.expired {
    color: #dc3545;
}

/* 会话详情样式 */
.session-detail-view {
    max-width: 900px;
    margin: 0 auto;
}

/* 会话ID显示 */
.session-id {
    font-family: monospace;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #dee2e6;
}

/* 设备信息样式 */
.device-info .device {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* IP地址和位置信息 */
.ip-address {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ip-address .location {
    color: #6c757d;
    font-size: 11px;
}

/* 最后活动状态 */
.last-activity {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.last-activity.recent {
    color: #28a745;
    font-weight: 600;
}

.last-activity.normal {
    color: #007bff;
}

.last-activity.old {
    color: #6c757d;
}

.last-activity small {
    font-size: 11px;
    color: #6c757d;
}

/* 过期时间状态 */
.expires-at.expired {
    color: #dc3545;
    font-weight: 600;
}

.expires-at.expiring {
    color: #ffc107;
    font-weight: 600;
}

/* 用户代理信息 */
.user-agent {
    font-family: monospace;
    font-size: 12px;
    color: #6c757d;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 操作按钮扩展 */
.action-btn.logout {
    background: #ffc107;
    color: #212529;
}

.action-btn.extend {
    background: #17a2b8;
    color: white;
}

/* 状态徽章扩展 */
.status-badge.status-active {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.status-expired {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 会话管理特殊样式 */
.admin-container .content-section#sessions-section {
    background: #f8f9fa;
}

.admin-container .content-section#sessions-section .data-table {
    background: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .session-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .summary-card .count {
        font-size: 24px;
    }
    
    .ip-address {
        font-size: 12px;
    }
    
    .device-info {
        font-size: 12px;
    }
    
    .last-activity {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .session-summary {
        grid-template-columns: 1fr;
    }
    
    .summary-card {
        padding: 15px;
    }
    
    .session-id {
        font-size: 10px;
    }
    
    .user-agent {
        font-size: 10px;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .sidebar-footer {
        position: static;
        margin-top: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-widgets {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 800px;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: 12px;
    }
    
    .top-bar {
        padding: 12px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

/* 打印样式 */
@media print {
    .sidebar,
    .top-bar,
    .section-actions,
    .filter-bar,
    .action-buttons {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .content-area {
        padding: 0;
    }
    
    .data-table {
        border: 1px solid #000;
    }
    
    .data-table th,
    .data-table td {
        border: 1px solid #000;
        padding: 8px;
    }
}

/* 角色权限管理特定样式 */
.permissions-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    background: #fafafa;
}

.checkbox-item {
    display: flex;
    flex-direction: column;
    padding: 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

.checkbox-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    margin-bottom: 4px;
}

.checkbox-item label {
    font-weight: 500;
    margin-bottom: 2px;
    cursor: pointer;
}

.checkbox-item small {
    color: #666;
    font-size: 0.85em;
    margin-left: 20px;
}

.permissions-display {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.permission-tag {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    white-space: nowrap;
}

.role-details,
.permission-details {
    display: grid;
    gap: 12px;
}

.detail-group {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    align-items: start;
}

.detail-group label {
    font-weight: 600;
    color: #555;
}

.detail-group span {
    color: #333;
}

/* 权限列表的改进样式 */
.permissions-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    background: #f8f9fa;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 8px;
    background: white;
    transition: all 0.2s ease;
}

.checkbox-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.checkbox-item input[type="checkbox"] {
    margin-right: 12px;
    margin-top: 2px;
    transform: scale(1.1);
}

.checkbox-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.checkbox-item small {
    color: #6c757d;
    font-size: 0.82em;
    margin-top: 2px;
    font-style: italic;
}

/* 表单改进 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-group input:disabled,
.form-group textarea:disabled,
.form-group select:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 状态徽章改进 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* 通用徽章样式 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 10px;
    background: #6c757d;
    color: white;
    font-size: 0.75em;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

/* 用户等级信息样式 */
.user-level-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.level-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.level-badge.level-admin {
    background-color: rgba(255, 0, 0, 0.1);
    border-color: rgba(255, 0, 0, 0.3);
    color: #dc2626;
}

.level-badge.level-svip {
    background-color: rgba(147, 51, 234, 0.1);
    border-color: rgba(147, 51, 234, 0.3);
    color: #7c3aed;
}

.level-badge.level-vip {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #d97706;
}

.level-badge.level-normal_user {
    background-color: rgba(107, 114, 128, 0.1);
    border-color: rgba(107, 114, 128, 0.3);
    color: #6b7280;
}

.level-scope {
    font-size: 0.7em;
    color: #6b7280;
    font-style: italic;
}

.user-level-info.no-level,
.user-level-info.no-active-level,
.user-level-info.invalid-level {
    color: #9ca3af;
    font-size: 0.85em;
    font-style: italic;
}
