/* ==== 站点导航编辑器（设置 → 导航数据 → 编辑导航） ====
   DOM 由 shared/js/nav-editor.js 生成，这里只管它的样子；
   首页与关于页共用，原先长在 index_main.css 里。 */

/* ---- 页面页签（首页 / 关于页） ---- */

.nv-editor-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid #e5e5e5;
}

.nv-tab {
    padding: 4px 12px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    line-height: 1.5;
    color: #555;
    cursor: pointer;
}

.nv-tab:hover:not(.active) {
    border-color: #667eea;
    color: #667eea;
}

.nv-tab.active {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
    font-weight: 600;
}

/* 打开时锁住页面滚动，避免背景跟着滚 */
body.nv-editor-open {
    overflow: hidden;
}

.nv-editor {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* display: flex 会盖掉 hidden 自带的 display: none，这里显式补回来 */
.nv-editor[hidden] {
    display: none;
}

.nv-editor-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.nv-editor-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(680px, 100%);
    max-height: min(80vh, 720px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.nv-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e5e5;
}

.nv-editor-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.nv-editor-close {
    border: none;
    background: transparent;
    padding: 4px 8px;
    font-size: 15px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}

.nv-editor-close:hover {
    color: #333;
}

.nv-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
}

.nv-editor-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
}

.nv-editor-tip {
    font-size: 12px;
    line-height: 1.5;
    color: #888;
}

/* ---- 分组 ---- */

.nv-group {
    margin-bottom: 10px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}

.nv-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f5f7fb;
    border-bottom: 1px solid #e5e5e5;
}

.nv-group-head .nv-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.nv-count {
    font-size: 12px;
    color: #999;
}

.nv-badge {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    color: #667eea;
    background: rgba(102, 126, 234, 0.12);
}

.nv-badge.quiet {
    color: #999;
    background: rgba(0, 0, 0, 0.06);
}

/* ---- 链接 ---- */

.nv-links {
    padding: 6px 10px 8px;
}

.nv-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
    font-size: 13px;
}

.nv-link:last-of-type {
    border-bottom: none;
}

.nv-link .nv-name {
    color: #333;
}

.nv-url {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- 操作按钮 ---- */

.nv-ops {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.nv-btn {
    padding: 3px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    line-height: 1.4;
    color: #555;
    cursor: pointer;
}

.nv-btn:hover:not(:disabled) {
    border-color: #667eea;
    color: #667eea;
}

.nv-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nv-btn.danger:hover:not(:disabled) {
    border-color: #e05252;
    color: #e05252;
}

.nv-btn.primary {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
}

.nv-btn.primary:hover:not(:disabled) {
    background: #5a6fd8;
    color: #fff;
}

.nv-add {
    display: block;
    width: 100%;
    padding: 6px;
    border-style: dashed;
    color: #667eea;
}

.nv-empty {
    padding: 20px 4px;
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* ---- 表单 ---- */

.nv-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nv-form-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.nv-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nv-field-label {
    font-size: 13px;
    color: #555;
}

.nv-field input[type="text"] {
    padding: 7px 9px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    outline: none;
}

.nv-field input[type="text"]:focus {
    border-color: #667eea;
}

.nv-field-check {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.nv-field-hint {
    font-size: 12px;
    line-height: 1.5;
    color: #999;
}

.nv-form-ops {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* ---- 深色模式 ---- */

body.dark .nv-editor-card {
    background: #2a2a2a;
}

body.dark .nv-editor-tabs {
    border-color: #3a3a3a;
}

body.dark .nv-tab {
    border-color: #444;
    background: #333;
    color: #ccc;
}

body.dark .nv-tab:hover:not(.active) {
    border-color: #667eea;
    color: #8f9ff0;
}

body.dark .nv-editor-head,
body.dark .nv-editor-foot {
    border-color: #3a3a3a;
}

body.dark .nv-editor-foot {
    background: #242424;
}

body.dark .nv-editor-title,
body.dark .nv-group-head .nv-name,
body.dark .nv-link .nv-name,
body.dark .nv-form-title {
    color: #eee;
}

body.dark .nv-field-label {
    color: #ccc;
}

body.dark .nv-editor-tip,
body.dark .nv-count,
body.dark .nv-url,
body.dark .nv-field-hint,
body.dark .nv-empty {
    color: #999;
}

body.dark .nv-group {
    border-color: #3a3a3a;
}

body.dark .nv-group-head {
    background: #333;
    border-color: #3a3a3a;
}

body.dark .nv-link {
    border-bottom-color: #3a3a3a;
}

body.dark .nv-btn {
    background: #333;
    border-color: #444;
    color: #ccc;
}

body.dark .nv-field input[type="text"] {
    background: #333;
    border-color: #444;
    color: #eee;
}

/* ---- 小屏 ---- */

@media (max-width: 767px) {
    .nv-editor {
        padding: 10px;
    }

    .nv-editor-card {
        max-height: 88vh;
    }

    .nv-url {
        display: none;
    }
}