/* 知识图谱前端样式 */
.kg-frontend-container {
    margin: 25px 0;
    padding: 25px;
    border: 1px solid #e2e2e2;
    background: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-align: center;
}

.kg-frontend-container.admin {
    border: 2px dashed #ffb900;
    background: #fff8e5;
}

.kg-frontend-container h3 {
    margin: 0 0 12px 0;
    color: #2c3338;
    font-size: 1.4em;
    font-weight: 600;
}

.kg-frontend-container p {
    margin: 0 0 16px 0;
    color: #646970;
    line-height: 1.5;
    font-size: 14px;
}

.kg-stats {
    color: #0073aa !important;
    font-weight: 500;
    font-size: 13px !important;
}

.kg-view-button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,115,170,0.3);
}

.kg-view-button:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.4);
}

.kg-generate-button {
    background: #ffb900;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(255,185,0,0.3);
}

.kg-generate-button:hover {
    background: #e5a900;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,185,0,0.4);
}

/* 模态框样式 */
.kg-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
}

.kg-modal-content {
    background: white;
    margin: 2% auto;
    width: 95%;
    height: 90%;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.kg-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e2e2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.kg-modal-header h2 {
    margin: 0;
    color: #2c3338;
    font-size: 1.5em;
    font-weight: 600;
}

.kg-close {
    font-size: 28px;
    cursor: pointer;
    color: #646970;
    line-height: 1;
    transition: color 0.3s ease;
}

.kg-close:hover {
    color: #d63638;
}

.kg-modal-body {
    padding: 0;
    height: calc(100% - 70px);
    position: relative;
}

#kg-graph-container {
    width: 100%;
    height: 100%;
    background: #f9f9f9;
    position: relative;
    overflow: hidden;
}

/* 图谱可视化样式 */
.kg-graph-svg {
    width: 100%;
    height: 100%;
    display: block;
    background: #f9f9f9;
}

.kg-node {
    cursor: pointer;
    stroke: #fff;
    stroke-width: 3px;
    transition: all 0.3s ease;
}

.kg-node:hover {
    stroke: #333;
    stroke-width: 4px;
    r: 14;
}

.kg-link {
    stroke: #999;
    stroke-opacity: 0.8;
    stroke-width: 2px;
}

.kg-node-text {
    font-size: 14px !important;
    pointer-events: none;
    text-anchor: middle;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
    fill: #333;
    text-shadow: 1px 1px 2px white, -1px -1px 2px white, 1px -1px 2px white, -1px 1px 2px white;
}

.kg-link-text {
    font-size: 12px !important;
    pointer-events: none;
    text-anchor: middle;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    fill: #666;
    font-weight: 500;
    background: rgba(255,255,255,0.9);
    padding: 4px 8px;
    border-radius: 4px;
}

.kg-tooltip {
    position: absolute;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    border-radius: 8px;
    pointer-events: none;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 10001;
    max-width: 300px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    line-height: 1.5;
    border: 1px solid #333;
}

.kg-tooltip strong {
    display: block;
    margin-bottom: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.kg-tooltip div {
    color: #e0e0e0;
    font-size: 13px;
}

/* 加载状态 */
.kg-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    background: #f9f9f9;
    flex-direction: column;
    color: #666;
    font-size: 16px;
}

.kg-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: kg-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes kg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误状态 */
.kg-error {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    background: #f9f9f9;
    flex-direction: column;
    text-align: center;
    color: #d63638;
    font-size: 16px;
    padding: 20px;
}

.kg-error p {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.kg-error button {
    margin-top: 15px;
    padding: 12px 24px;
    background: #d63638;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.kg-error button:hover {
    background: #c02c2c;
    transform: translateY(-1px);
}

/* 空状态 */
.kg-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    background: #f9f9f9;
    flex-direction: column;
    text-align: center;
    color: #666;
    font-size: 16px;
    padding: 20px;
}

.kg-empty p {
    margin: 0 0 10px 0;
    font-size: 16px;
}

/* 控制按钮 */
.kg-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.kg-control-button {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 80px;
}

.kg-control-button:hover {
    background: #f5f5f5;
    border-color: #0073aa;
    color: #0073aa;
}

/* 图例 */
.kg-legend {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 100;
    background: rgba(255,255,255,0.9);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    font-size: 12px;
}

.kg-legend h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.kg-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.kg-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid #ddd;
}

/* 布局选择器样式 */
.kg-layout-selector {
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.kg-layout-item {
    border: 1px solid transparent;
}

.kg-layout-item:hover {
    border-color: #0073aa;
    background: #f8f9fa !important;
}

.kg-layout-radio {
    transition: all 0.3s ease;
}

.kg-layout-item:hover .kg-layout-radio {
    border-color: #0056b3;
}

/* 控制按钮组样式调整 */
.kg-controls {
    top: 15px;
    right: 15px;
    gap: 6px;
}

.kg-control-button {
    min-width: 70px;
    font-size: 11px;
    padding: 6px 10px;
}

/* 图例样式调整 */
.kg-legend {
    bottom: 15px;
    left: 15px;
    min-width: 120px;
}