/* ===== 知识点选择器样式 ===== */

/* ---- 行内标签栏 ---- */

.topic-tree-container {
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.topic-tree-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid #e8eaed;
    background: #fafbfc;
    min-height: 36px;
}

.topic-tree-tags-empty {
    font-size: 0.8rem;
    color: #9aa0a6;
    flex: 1;
}

.topic-tree-tags-label {
    font-size: 0.78rem;
    color: #5f6368;
    font-weight: 500;
    margin-right: 4px;
    flex-shrink: 0;
}

.topic-tree-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.6;
    cursor: default;
    white-space: nowrap;
}
.topic-tree-tag:hover {
    background: #d2e3fc;
}

.topic-tree-tag-remove {
    cursor: pointer;
    font-size: 0.7rem;
    opacity: 0.6;
    transition: opacity 0.1s;
    margin-left: 2px;
}
.topic-tree-tag-remove:hover {
    opacity: 1;
}

.topic-tree-tags-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

/* 行内模式（无弹窗、嵌在页面中时）无边框 */
.topic-tree-container.topic-tree-in-modal {
    border: none;
    border-radius: 0;
}

.topic-tree-add-btn,
.topic-tree-action-btn,
.topic-tree-clear-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.78rem;
    color: #5f6368;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s, color 0.1s;
    user-select: none;
}
.topic-tree-add-btn:hover,
.topic-tree-action-btn:hover {
    background: #e8f0fe;
    color: #1a73e8;
}
.topic-tree-clear-btn:hover {
    background: #fce8e6;
    color: #c5221f;
}

/* ---- 弹窗遮罩 ---- */

.topic-tree-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    animation: topicTreeFadeIn 0.15s ease forwards;
}

@keyframes topicTreeFadeIn {
    to { opacity: 1; }
}

/* ---- 弹窗主体 ---- */

.topic-tree-modal {
    background: #fff;
    border-radius: 12px;
    width: 520px;
    max-width: 90vw;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

@keyframes topicTreePopIn {
    to { transform: scale(1); }
}

.topic-tree-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e8eaed;
    flex-shrink: 0;
}

.topic-tree-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a2332;
}

.topic-tree-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topic-tree-modal-search-btn {
    cursor: pointer;
    font-size: 0.95rem;
    color: #9aa0a6;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.1s, color 0.1s;
}
.topic-tree-modal-search-btn:hover {
    background: #f1f3f4;
    color: #5f6368;
}

.topic-tree-modal-close {
    cursor: pointer;
    font-size: 1.2rem;
    color: #9aa0a6;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.1s, color 0.1s;
}
.topic-tree-modal-close:hover {
    background: #f1f3f4;
    color: #5f6368;
}

/* ---- 弹窗内搜索栏 ---- */

.topic-tree-modal .topic-tree-searchbar {
    flex-shrink: 0;
    border-bottom: 1px solid #e8eaed;
}

.topic-tree-modal .topic-tree-search {
    width: 100%;
    padding: 10px 16px;
    border: none;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    background: #f8f9fa;
}
.topic-tree-modal .topic-tree-search:focus {
    background: #fff;
}

/* ---- 弹窗内面包屑 ---- */

.topic-tree-modal .topic-tree-breadcrumb {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    border-bottom: 1px solid #e8eaed;
    background: #f8f9fa;
    min-height: 32px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.topic-tree-modal .topic-tree-breadcrumb,
.topic-tree-modal .topic-tree-breadcrumb * {
    font-size: 13px !important;
    color: #1a2332 !important;
}


/* ---- 弹窗内节点列表 ---- */

.topic-tree-modal .topic-tree-level {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    max-height: 340px;
}

.topic-tree-modal .topic-tree-level,
.topic-tree-modal .topic-tree-level * {
    visibility: visible !important;
    opacity: 1 !important;
    color: #1a2332 !important;
    font-size: 14px !important;
}

.topic-tree-modal .topic-tree-empty {
    text-align: center;
    padding: 32px 16px;
    color: #9aa0a6;
    font-size: 0.85rem;
}

/* ---- 弹窗底部 ---- */

.topic-tree-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e8eaed;
    flex-shrink: 0;
}

.topic-tree-modal-btn {
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.1s;
}

.topic-tree-modal-btn-cancel {
    background: #f1f3f4;
    color: #5f6368;
}
.topic-tree-modal-btn-cancel:hover {
    background: #e8eaed;
}

.topic-tree-modal-btn-confirm {
    background: #1a73e8;
    color: #fff;
}
.topic-tree-modal-btn-confirm:hover {
    background: #1557b0;
}

.topic-tree-modal-count {
    font-size: 0.8rem;
    color: #5f6368;
    margin-right: auto;
}

/* ---- 面包屑组件样式（弹窗内） ---- */

.topic-tree-back {
    color: #1a73e8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    user-select: none;
}
.topic-tree-back:hover {
    background: #e8f0fe;
}

.topic-tree-sep {
    color: #9aa0a6;
    font-size: 0.75rem;
}

.topic-tree-crumb {
    color: #5f6368;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}
.topic-tree-crumb:hover {
    background: #e8eaed;
    color: #1a2332;
}
.topic-tree-crumb.active {
    color: #1a73e8;
    font-weight: 600;
    cursor: default;
}
.topic-tree-crumb.active:hover {
    background: transparent;
}

/* ---- 节点列表组件 ---- */

.topic-tree-item {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    cursor: default;
    min-height: 34px;
    transition: background 0.1s;
}
.topic-tree-item:hover {
    background: #f0f7ff;
}

.topic-tree-item,
.topic-tree-item * {
    visibility: visible !important;
    opacity: 1 !important;
}

.topic-tree-cb {
    width: 16px;
    height: 16px;
    accent-color: #1a73e8;
    cursor: pointer;
}

.topic-tree-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.55rem;
    color: #5f6368;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s;
}
.topic-tree-expand:hover {
    color: #1a73e8;
}
.topic-tree-expand:empty {
    cursor: default;
    visibility: hidden;
}

.topic-tree-label-text {
    font-size: 14px !important;
    color: #1a2332 !important;
    padding: 0 4px;
    white-space: nowrap;
    cursor: default;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ---- 行内展开树（A 方案） ---- */

.topic-tree-inline {
    padding: 4px 0;
    max-height: 420px;
    overflow-y: auto;
    border-bottom: 1px solid #e8eaed;
}

.topic-tree-inline-item {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 6px;
    padding: 3px 16px;
    min-height: 28px;
    cursor: default;
    transition: background 0.1s;
}
.topic-tree-inline-item:hover {
    background: #f0f7ff;
}

.topic-tree-inline-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.55rem;
    color: #5f6368;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s;
}
.topic-tree-inline-arrow:hover {
    color: #1a73e8;
}
.topic-tree-inline-arrow.expanded {
    color: #1a73e8;
}

.topic-tree-inline-label {
    font-size: 13px;
    color: #1a2332;
    padding: 0 4px;
    white-space: nowrap;
}
