/* 语义网络页面样式 */

:root {
    --bg-primary: #0f0a1f;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-color: #a78bfa;

    /* 语义关系颜色 */
    --color-center: #a78bfa;
    --color-synonym: #34d399;
    --color-antonym: #f87171;
    --color-hypernym: #fbbf24;
    --color-hyponym: #60a5fa;

    /* Sidebar 所需的 CSS 变量 */
    --color-bg: #0f0a1f;
    --color-surface: #1a1030;
    --color-surface-hover: #251840;
    --color-border: rgba(255, 255, 255, 0.1);
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-hard: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
}

/* ==================== 导航条样式 ==================== */
.navbar {
    background-color: var(--bg-primary);
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    margin: 10px auto;
    align-items: center;
    transform: rotate(-4deg);
}

.navbar-brand a {
    display: flex;
    align-items: center;
    width: 100%;
    height: 80px;
}

.navbar-brand a img {
    width: 250px;
    filter: drop-shadow(2px 2px 1px rgba(255, 255, 255, 0.1));
}

/* ECharts 容器 - 全屏背景 */
.semantic-chart {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 返回按钮 - PC端隐藏，移动端使用mobile-top-bar返回 */
.back-btn {
    display: none;
}

/* word-popup 挂载点 - 左上角定位 */
#wordPopupMount {
    position: fixed;
    top: 70px;
    left: 20px;
    z-index: 100;
    max-width: 360px;
    max-height: calc(100vh - 100px);
    overflow: visible;
}

/* 调整 word-popup 在此页面的样式 */
#wordPopupMount .word-popup {
    position: relative !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: rgba(30, 20, 50, 0.95) !important;
    backdrop-filter: blur(20px);
}

#wordPopupMount .word-popup-handle {
    display: none;
}

/* word-popup 内部文字颜色适配深色背景 */
#wordPopupMount .word-popup-word {
    color: var(--text-primary) !important;
}

#wordPopupMount .word-popup-content {
    color: var(--text-secondary) !important;
}

#wordPopupMount .definition-text {
    color: var(--text-primary) !important;
}

#wordPopupMount .extend-label {
    color: var(--text-secondary) !important;
}

/* 图例面板 */
.legend-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(30, 20, 50, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    min-width: 160px;
}

.legend-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.center {
    background: var(--color-center);
    box-shadow: 0 0 8px var(--color-center);
}

.legend-dot.pos {
    background: #8b5cf6;
}

.legend-dot.synonym {
    background: var(--color-synonym);
}

.legend-dot.antonym {
    background: var(--color-antonym);
}

.legend-dot.hypernym {
    background: var(--color-hypernym);
}

.legend-dot.hyponym {
    background: var(--color-hyponym);
}

.legend-dot.derivation {
    background: #f472b6;
}

.legend-tips {
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-tips p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.legend-tips p:last-child {
    margin-bottom: 0;
}

/* 节点详情弹窗 */
.node-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: rgba(30, 20, 50, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-word {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-relation {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(167, 139, 250, 0.2);
    color: var(--accent-color);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-phonetic {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.modal-definition {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
}

.pos-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: lowercase;
    flex-shrink: 0;
    background: rgba(167, 139, 250, 0.2);
    color: var(--accent-color);
}

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

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

.modal-btn.primary:hover {
    background: #9575e8;
}

/* 加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 16px;
    margin-top: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 隐藏 PC 端导航栏 */
    .navbar {
        display: none;
    }

    /* 隐藏返回按钮（移动端使用 mobile-top-bar 返回） */
    .back-btn {
        display: none;
    }

    #wordPopupMount {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: none;
        max-height: 50vh;
    }

    #wordPopupMount .word-popup {
        max-height: 50vh;
        border-radius: 20px 20px 0 0 !important;
    }

    .legend-panel {
        display: none;
    }
}

/* 大屏幕优化 */
@media (min-width: 769px) {
    /* 隐藏 mobile-top-bar */
    #mobile-top-bar {
        display: none !important;
    }
}
