/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部 */
.header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* 标签页 */
.tabs {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #ecf0f1;
}

.tab-btn.active {
    background: #3498db;
    color: white;
}

.tab-content {
    display: none;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tab-content.active {
    display: block;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.data-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
}

.status-info {
    background: #3498db;
    color: white;
}

.status-success {
    background: #27ae60;
    color: white;
}

.status-warning {
    background: #f39c12;
    color: white;
}

.status-danger {
    background: #e74c3c;
    color: white;
}

/* 分页 */
.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.pagination button {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.pagination button:hover {
    background: #ecf0f1;
}

.pagination button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    min-width: 400px;
    max-width: 90%;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 消息提示 */
.message {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 登录页面 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}


/* 备案信息样式 */
.beian-info {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px 20px;
    z-index: 1000;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.beian-info a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-block;
}

.beian-info a:hover {
    color: rgba(255, 255, 255, 1);
    background: rgba(0, 0, 0, 0.3);
    text-decoration: none;
}

/* 主页备案信息 */
.beian-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 15px 0;
    text-align: center;
    z-index: 100;
}

.beian-footer p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.beian-footer a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.beian-footer a:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* 为主容器添加底部内边距，避免内容被备案信息遮挡 */
body {
    padding-bottom: 60px;
}

.login-page {
    padding-bottom: 80px;
}

/* 客户端管理样式 */
.client-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
    text-align: center;
    min-width: 50px;
}

.client-status-badge.status-online {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.client-status-badge.status-offline {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 客户端管理工具栏统计信息 */
.stats-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #555;
}

.stats-info strong {
    color: #2c3e50;
    font-size: 16px;
}

/* 在线时长列样式 */
.online-duration {
    color: #3498db;
    font-weight: 500;
}

/* 最后心跳时间样式 */
.last-heartbeat-time {
    color: #7f8c8d;
    font-size: 13px;
}

/* 客户端表格特殊样式 */
#clientsTableBody code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #e74c3c;
}

/* 刷新按钮动画 */
#clientsRefreshIcon {
    transition: opacity 0.3s;
}

.btn:active #clientsRefreshIcon {
    animation: rotate 0.5s ease-in-out;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
