:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: var(--card-bg);
    padding: 48px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-box h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

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

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

.btn-block {
    width: 100%;
}

.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    /*display: flex;*/
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    display: none;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-logo .icon {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user .avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
}

.main-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-header {
    /*display: flex;*/
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-card .label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.graph-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.graph-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    cursor: pointer;
}

.graph-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.graph-card:hover .card-actions {
    opacity: 1;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.action-btn:hover {
    transform: scale(1.1);
}

.edit-btn:hover {
    background: #3b82f6;
    color: white;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

/* 危险按钮样式 */
.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* 警告文本样式 */
.text-warning {
    color: #f59e0b;
    font-size: 14px;
    margin-top: 8px;
}

/* 模态框内容样式 */
.modal-body {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-body p {
    margin-bottom: 12px;
    line-height: 1.5;
}

.graph-card .type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.type-知识图谱 { background: #e0e7ff; color: #4338ca; }
.type-专业图谱 { background: #dbeafe; color: #1e40af; }
.type-能力图谱 { background: #dcfce7; color: #166534; }
.type-课程图谱 { background: #fef3c7; color: #92400e; }
.type-问题图谱 { background: #fce7f3; color: #9d174d; }

.graph-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.graph-card .description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.graph-card .meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal h3 {
    font-size: 20px;
    margin-bottom: 24px;
}

.modal .form-group {
    margin-bottom: 16px;
}

.modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.modal .modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal .modal-footer button[type="button"]:not(.btn-danger) {
    background: #f3f4f6;
    color: #374151;
}

.modal .modal-footer button[type="button"]:not(.btn-danger):hover {
    background: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal .modal-footer button[type="submit"] {
    background: var(--primary-color);
    color: white;
}

.modal .modal-footer button[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.canvas-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    flex: 1;
    min-height: calc(100vh - 120px);
    position: relative;
    overflow: hidden;
}

#graphSvg {
    width: 100%;
    height: 100%;
    display: block;
}

.level-filter {
    position: absolute;
    top: 16px;
    left: 80px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 16px;
    z-index: 10;
    min-width: 140px;
}

.level-filter-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.level-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.level-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.level-checkbox:hover {
    color: var(--primary-color);
}

.level-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.btn-filter-reset {
    width: 100%;
    margin-top: 12px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter-reset:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.toolbar {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.toolbar button {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toolbar button {
    position: relative;
}

.toolbar button:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* 自定义提示样式 */
.toolbar button::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.toolbar button::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: rgba(0,0,0,0.8);
    margin-top: 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.toolbar button:hover::after,
.toolbar button:hover::before {
    opacity: 1;
    visibility: visible;
}

.properties-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 280px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 20px;
    z-index: 10;
}

.properties-panel h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.sidemenu {
    position: fixed;
    left: 0;
    top: 64px;
    bottom: 0;
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    overflow-y: auto;
}

.sidemenu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    margin-bottom: 4px;
}

.sidemenu-item:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.sidemenu-item.active {
    background: #eff6ff;
    color: var(--primary-color);
}

.sidemenu-item .icon {
    font-size: 18px;
}

.content-area {
    margin-left: 240px;
    padding: 24px;
    min-height: calc(100vh - 64px);
}

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.filter-bar select,
.filter-bar input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    min-width: 160px;
}

.filter-bar input {
    flex: 1;
    min-width: 200px;
}

.button-group {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.view-toggle {
    display: flex;
    gap: 6px;
}

.view-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.view-btn:hover {
    background: var(--border-color);
}

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

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { background: var(--success-color); }
.toast.error { background: var(--danger-color); }
.toast.warning { background: var(--warning-color); }

.node {
    cursor: pointer;
}

.node circle {
    stroke: white;
    stroke-width: 2px;
}

.node text {
    font-size: 12px;
    fill: var(--text-primary);
}

.link {
    stroke: #94a3b8;
    stroke-opacity: 0.6;
}

.link-label {
    font-size: 11px;
    fill: var(--text-secondary);
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .sidemenu {
        display: none;
    }
    .content-area {
        margin-left: 0;
    }
    .graph-grid {
        grid-template-columns: 1fr;
    }
}

/* 标签页样式 */
.panel-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

/* 自定义提示框样式 */
.custom-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 9999;
    display: none;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
}

/* 视图切换按钮样式 */
.button-group {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.view-toggle {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

.view-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.view-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

/* 列表视图样式 */
.graph-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.list-header {
    display: grid;
    grid-template-columns: 2fr 100px 120px 100px 100px 120px 100px;
    gap: 16px;
    padding: 12px 20px;
    background: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: 8px 8px 0 0;
}

.list-item {
    display: grid;
    grid-template-columns: 2fr 100px 120px 100px 100px 120px 100px;
    gap: 16px;
    padding: 16px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.list-item:hover {
    background: #f8fafc;
}

.list-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.list-item .col-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-item .col-name strong {
    font-size: 15px;
    color: var(--text-primary);
}

.list-item .col-name small {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item .col-type .type-badge {
    font-size: 12px;
    padding: 4px 10px;
}

.list-item .col-domain,
.list-item .col-stats,
.list-item .col-creator,
.list-item .col-date {
    font-size: 14px;
    color: var(--text-secondary);
}

.list-item .col-actions {
    display: flex;
    gap: 8px;
}

.list-item .col-actions .action-btn {
    width: 32px;
    height: 32px;
}

/* 排序控制样式 */
.col-sort {
    width: 120px;
    text-align: center;
}

.sort-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.sort-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.sort-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.sort-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sort-input {
    width: 50px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    padding: 0 4px;
    -moz-appearance: textfield;
}

.sort-input::-webkit-outer-spin-button,
.sort-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sort-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* 更新列表视图网格布局，添加排序列（在操作列前面） */
.graph-grid.list-view .list-header,
.graph-grid.list-view .list-item {
    grid-template-columns: 2fr 100px 120px 100px 100px 120px 120px 100px;
}

/* 响应式列表视图 */
@media (max-width: 1200px) {
    .list-header,
    .list-item {
        grid-template-columns: 2fr 100px 100px 100px 100px 100px 100px;
    }
    
    .list-header .col-domain,
    .list-item .col-domain {
        display: none;
    }
}

@media (max-width: 992px) {
    .list-header,
    .list-item {
        grid-template-columns: 2fr 100px 100px 100px 100px 100px;
    }
    
    .list-header .col-domain,
    .list-item .col-domain,
    .list-header .col-stats,
    .list-item .col-stats {
        display: none;
    }
}

@media (max-width: 768px) {
    .view-toggle {
        display: none;
    }
    
    .list-header,
    .list-item {
        grid-template-columns: 1fr 100px 100px 80px;
    }
    
    .list-header .col-domain,
    .list-item .col-domain,
    .list-header .col-stats,
    .list-item .col-stats,
    .list-header .col-creator,
    .list-item .col-creator,
    .list-header .col-date,
    .list-item .col-date {
        display: none;
    }
    
    .sort-controls {
        flex-direction: column;
        gap: 2px;
    }
    
    .sort-btn {
        width: 24px;
        height: 20px;
        font-size: 12px;
    }
    
    .sort-input {
        width: 40px;
        height: 24px;
        font-size: 12px;
    }
}