:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4CAF50;
    --info-color: #2196F3;
    --sidebar-width: 250px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f6fa;
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
}

.logo {
    padding: 0 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    font-size: 24px;
    color: var(--primary-color);
}

.logo i {
    margin-right: 10px;
}

.sidebar nav {
    padding: 0 10px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.sidebar nav a i {
    margin-right: 10px;
    font-size: 20px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: var(--primary-color);
    color: white;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
}

header {
    background: #fff;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card i {
    font-size: 40px;
    color: var(--primary-color);
}

.stat-info h3 {
    color: #666;
    font-size: 16px;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

/* 按钮样式 */
.action-panel {
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn i {
    font-size: 18px;
}

.btn.primary {
    background: var(--primary-color);
    color: white;
}

.btn.success {
    background: var(--success-color);
    color: white;
}

.btn.info {
    background: var(--info-color);
    color: white;
}

.btn.warning {
    background: var(--warning-color);
    color: white;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* 表格样式 */
.node-table-container {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #666;
}

tr:hover {
    background-color: #f8f9fa;
}

/* 修改模态框相关样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    margin: 20px auto;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
    font-weight: 600;
}

.modal-body {
    padding: 25px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* 表单组样式优化 */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #fff;
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--primary-color);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* 输入组样式优化 */
.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

.input-group button {
    padding: 8px 16px;
    white-space: nowrap;
    border-radius: 8px;
}

/* 表单操作区样式 */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.form-actions button {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-actions button:hover {
    transform: translateY(-1px);
}

/* 关闭按钮样式 */
.close {
    cursor: pointer;
    font-size: 24px;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--danger-color);
}

/* 添加模态框动画 */
@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 添加滚动条样式 */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 字段分组 */
.form-section {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

/* 表格中的操作按钮样式优化 */
.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-start;
    align-items: center;
    padding: 4px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
}

.btn-icon {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0);
    transition: transform 0.2s ease;
    border-radius: 8px;
}

.btn-icon:hover::before {
    transform: scale(1);
}

.btn-icon i {
    font-size: 18px;
    position: relative;
    z-index: 1;
}

.btn-icon.info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.2);
}

.btn-icon.primary {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

.btn-icon.warning {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.2);
}

.btn-icon.danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.2);
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-icon:active {
    transform: translateY(0);
}

/* 工具提示样式优化 */
.btn-icon:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: tooltipSlideIn 0.2s ease-out;
}

.btn-icon:hover::before {
    content: '';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    margin-bottom: -12px;
    z-index: 1000;
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, 5px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 表格行悬停时的按钮效果 */
tr:hover .action-buttons {
    background: rgba(0, 0, 0, 0.04);
}

/* 按钮禁用状态 */
.btn-icon:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .action-buttons {
        padding: 3px;
        gap: 4px;
    }
    
    .btn-icon {
        width: 30px;
        height: 30px;
    }
    
    .btn-icon i {
        font-size: 16px;
    }
}

/* 表格列宽控制 */
table th,
table td {
    white-space: nowrap; /* 防止文本换行 */
}

/* 名称列宽度限制 */
table th:nth-child(2),
table td:nth-child(2) {
    max-width: 200px; /* 从 120px 改为 100px */
    min-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 地址列宽度限制 */
table th:nth-child(4),
table td:nth-child(4) {
    max-width: 160px; /* 从 180px 改为 150px */
    min-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 操作列固定宽度 */
table th:last-child,
table td:last-child {
    width: 200px; /* 从 180px 改为 200px */
    min-width: 200px; /* 从 120px 改为 200px */
}

/* 复选框列固定宽度 */
table th:first-child,
table td:first-child {
    width: 40px;
    min-width: 40px;
}

/* 类型列固定宽度 */
table th:nth-child(3),
table td:nth-child(3) {
    width: 120px;
    min-width: 80px;
}

/* 端口列固定宽度 */
table th:nth-child(5),
table td:nth-child(5) {
    width: 100px;
    min-width: 80px;
}

/* 国家/地区列固定宽度 */
table th:nth-child(6),
table td:nth-child(6) {
    width: 150px;
    min-width: 100px;
}

/* 延迟列固定宽度 */
table th:nth-child(7),
table td:nth-child(7) {
    width: 150px;
    min-width: 80px;
}

/* 添加鼠标悬停时显示完整内容的提示 */
table td {
    position: relative;
}

table td[title] {
    cursor: help;
}

/* 节点详情样式 */
.details-modal .modal-content {
    max-width: 800px;
}

.node-details {
    padding: 20px;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.details-header h2 {
    margin: 0;
    color: #333;
}

.node-type {
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
}

.node-type.vmess {
    background-color: #2196F3;
}

.node-type.vless {
    background-color: #4CAF50;
}

.node-type.trojan {
    background-color: #9C27B0;
}

.node-type.ss {
    background-color: #FF9800;
}

.details-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.details-section h3 {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 1.1rem;
}

.detail-item {
    display: flex;
    margin-bottom: 12px;
    font-size: 14px;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-item .label {
    width: 100px;
    color: #666;
    font-weight: 500;
}

.detail-item .value {
    flex: 1;
    color: #333;
}

.details-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.details-actions .btn {
    padding: 8px 16px;
}

/* 表格行悬停效果 */
#nodeTableBody tr:hover {
    background-color: #f5f5f5;
}

/* 测试中状态样式 */
.testing {
    display: inline-flex;
    align-items: center;
    color: #2196F3;
    font-weight: 500;
    animation: pulse 1.5s infinite;
}

.testing::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    background-color: #2196F3;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

@keyframes blink {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(0.8); }
}

/* 延迟显示的颜色样式 */
.latency-good {
    color: #4CAF50;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(76, 175, 80, 0.1);
}

.latency-normal {
    color: #FF9800;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(255, 152, 0, 0.1);
}

.latency-bad {
    color: #f44336;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(244, 67, 54, 0.1);
}

.latency-timeout {
    color: #9e9e9e;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(158, 158, 158, 0.1);
}

.latency-unknown {
    color: #757575;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(117, 117, 117, 0.1);
}

/* 在节点详情中也使用相同的颜色 */
.detail-item .value .latency-good,
.detail-item .value .latency-normal,
.detail-item .value .latency-bad,
.detail-item .value .latency-timeout,
.detail-item .value .latency-unknown {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: rgba(0,0,0,0.05);
}

/* 确认对话框样式 */
.confirm-content {
    max-width: 400px !important;
    text-align: center;
}

.confirm-header {
    padding: 30px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.confirm-header i {
    font-size: 48px;
    color: var(--danger-color);
}

.confirm-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.confirm-body {
    padding: 0 30px 20px;
}

.confirm-body p {
    margin: 0;
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
}

.confirm-actions {
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    border-top: 1px solid #eee;
}

.confirm-actions button {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.confirm-actions button i {
    font-size: 18px;
}

.confirm-actions button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 添加删除按钮动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mdi-spin {
    animation: spin 1s linear infinite;
}

/* 模态框标题栏样式 */
.modal-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-title h2 {
    margin: 0;
}

.import-btn {
    padding: 6px 12px;
    font-size: 14px;
    height: 32px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 6px;
    background: rgba(33, 150, 243, 0.1);
    color: var(--info-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.import-btn:hover {
    background: var(--info-color);
    color: white;
}

.import-btn i {
    font-size: 16px;
}

/* 导入链接对话框样式 */
.import-content {
    max-width: 600px !important;
}

.import-content textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s ease;
}

.import-content textarea:focus {
    outline: none;
    border-color: var(--info-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.input-with-tip {
    position: relative;
    margin-bottom: 10px;
}

.input-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: #666;
    font-size: 13px;
}

.input-tip i {
    color: var(--info-color);
    font-size: 16px;
}

.protocol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.protocol-card {
    padding: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.protocol-card:hover {
    background: #e3f2fd;
    transform: translateY(-2px);
}

.protocol-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.protocol-icon i {
    color: var(--info-color);
    font-size: 18px;
}

.protocol-info {
    text-align: center;
}

.protocol-info code {
    display: block;
    margin-bottom: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: #333;
}

.protocol-info span {
    font-size: 12px;
    color: #666;
}

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

.form-actions button {
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.form-actions button i {
    font-size: 18px;
}

/* 添加动画效果 */
.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}