/* ============================================================
   edit.css · 所有编辑页
   ------------------------------------------------------------
   Agent / 角色 / Tool / 日程 / 看法 / 数值 / 记忆 / Agent类型 / 地图编辑页
   ============================================================ */

/* ===== Agent 编辑页面 ===== */
.agent-edit-page {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 4px;
    position: relative;
}
.agent-edit-page.active {
    display: flex;
}
.agent-edit-header {
    display: flex;
    align-items: center;
    padding: 12px 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.agent-edit-back {
    font-size: 24px;
    cursor: pointer;
    padding-right: 12px;
    color: var(--primary);
}
.agent-edit-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(192, 132, 252, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    margin-right: 12px;
}
.agent-edit-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

/* ===== 角色编辑页面 ===== */
.character-edit-page {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 4px;
    position: relative;
}
.character-edit-page.active {
    display: flex;
}
.character-edit-header {
    display: flex;
    align-items: center;
    padding: 12px 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.character-edit-back {
    font-size: 24px;
    cursor: pointer;
    padding-right: 12px;
    color: var(--primary);
}
.character-edit-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(192, 132, 252, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    margin-right: 12px;
}
.character-edit-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

/* ===== 编辑项列表（Agent / Character 共用）===== */
.agent-edit-list,
.character-edit-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.agent-edit-item,
.character-edit-item {
    display: flex;
    align-items: center;
    padding: 14px 8px;
    cursor: pointer;
    background: transparent;
    transition: background .15s;
    border-bottom: 1px solid var(--border);
    user-select: none;
    -webkit-user-select: none;
}
.agent-edit-item:last-child,
.character-edit-item:last-child {
    border-bottom: none;
}
.agent-edit-item:hover,
.character-edit-item:hover {
    background: rgba(192, 132, 252, 0.06);
}
.agent-edit-item .icon,
.character-edit-item .icon {
    font-size: 22px;
    width: 36px;
    text-align: center;
    margin-right: 14px;
    opacity: .85;
}
.agent-edit-item .label,
.character-edit-item .label {
    flex: 1;
    font-size: 16px;
    color: var(--text);
}
.agent-edit-item .arrow,
.character-edit-item .arrow {
    color: var(--text-dim);
    font-size: 18px;
}
.agent-edit-item .value,
.character-edit-item .value {
    color: var(--text-dim);
    font-size: 14px;
    margin-right: 8px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Tool 编辑页面 ===== */
.tool-edit-page {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 4px;
    position: relative;
}
.tool-edit-page.active {
    display: flex;
}
.tool-edit-header {
    display: flex;
    align-items: center;
    padding: 12px 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.tool-edit-back {
    font-size: 24px;
    cursor: pointer;
    padding-right: 12px;
    color: var(--primary);
}
.tool-edit-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.tool-edit-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 4px;
}
.tool-edit-body .field {
    margin-bottom: 16px;
}
.tool-edit-body .field label {
    display: block;
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 4px;
    font-weight: 500;
}
.tool-edit-body .field input,
.tool-edit-body .field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(192, 132, 252, 0.22);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    outline: none;
    font-family: monospace;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}
.tool-edit-body .field input:focus,
.tool-edit-body .field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.18);
}
.tool-edit-body .field textarea {
    resize: vertical;
    min-height: 120px;
}
.tool-edit-actions {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    padding: 12px 0 18px;
    border-top: 1px solid var(--border);
}
.tool-edit-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.tool-edit-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.tool-edit-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.14);
}
.tool-edit-actions .btn-save {
    background: linear-gradient(135deg, #c084fc, #ec4899);
    color: #fff;
    box-shadow: 0 4px 16px rgba(192, 132, 252, 0.35);
}
.tool-edit-actions .btn-save:hover {
    box-shadow: 0 4px 22px rgba(236, 72, 153, 0.55);
    transform: translateY(-1px);
}

/* ============================================================
   日程表编辑页
   ============================================================ */
.schedule-tabs {
    display: flex;
    overflow-x: auto;
    padding: 12px 0 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 4px;
}
.schedule-tabs::-webkit-scrollbar {
    display: none;
}
.schedule-tab {
    padding: 6px 14px;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 16px;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
    transition: 0.15s;
}
.schedule-tab.active {
    color: var(--primary);
    background: rgba(192, 132, 252, 0.12);
    font-weight: 500;
}
.schedule-item .schedule-time {
    color: var(--primary);
    font-weight: 600;
    min-width: 105px;
    flex-shrink: 0;
}
.schedule-item .schedule-location {
    color: var(--text);
    min-width: 65px;
    flex-shrink: 0;
}
.schedule-save-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    font-family: inherit;
}
.schedule-item .schedule-activity {
    color: var(--text-dim);
    flex: 1;
    text-align: right;
}

/* ============================================================
   人际看法编辑页
   ============================================================ */
.perception-section-title {
    font-size: 13px;
    color: var(--text-dim);
    padding: 16px 8px 6px;
    font-weight: 500;
}
.perception-view {
    flex: 1;
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
}
.perception-other {
    flex: 1;
    min-width: 0;
}
.perception-other-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.perception-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    padding: 12px 0;
}
.perception-add-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    border: 1px dashed rgba(192, 132, 252, 0.5);
    border-radius: 12px;
    background: none;
    color: var(--primary);
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
    transition: 0.15s;
}
.perception-add-btn:hover {
    background: rgba(192, 132, 252, 0.08);
    border-color: var(--primary);
}

/* ============================================================
   数值页
   ============================================================ */
.stats-info {
    flex: 1;
    min-width: 0;
}
.stats-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.stats-value {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 2px;
}
.stats-desc {
    font-size: 13px;
    color: var(--text-dim);
}
.stats-empty-hint {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    padding: 12px 0;
}

/* ============================================================
   角色记忆页
   ============================================================ */
.memory-bottom {
    padding: 12px 0;
    flex-shrink: 0;
}
.memory-toolbar {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.memory-toolbar-row {
    display: flex;
    gap: 8px;
}
.memory-tool-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}
.memory-tool-btn:hover { background: rgba(255, 255, 255, 0.12); }
.memory-tool-btn.primary {
    background: rgba(192, 132, 252, 0.2);
    border-color: rgba(192, 132, 252, 0.4);
    color: var(--primary);
}
.memory-tool-btn.primary:hover { background: rgba(192, 132, 252, 0.32); }
.memory-tool-btn.danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}
.memory-tool-btn.danger:hover { background: rgba(239, 68, 68, 0.28); }
.memory-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}
.memory-item:last-child { border-bottom: none; }
.memory-item.multiselect { cursor: pointer; }
.memory-item.selected { background: rgba(192, 132, 252, 0.1); }
.memory-item:hover { background: rgba(192, 132, 252, 0.05); }
.memory-checkbox {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.memory-item-body { flex: 1; min-width: 0; }
.memory-item-prefix {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.memory-item-content {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.memory-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 0;
    font-size: 14px;
}
.memory-merge-section { margin-bottom: 12px; }
.memory-merge-label {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.memory-merge-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================================
   Agent 类型
   ============================================================ */
.agent-type-badge {
    display: inline-block;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 500;
    vertical-align: middle;
}
.agent-type-system {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.agent-type-actor {
    background: rgba(192, 132, 252, 0.15);
    color: var(--primary);
    border: 1px solid rgba(192, 132, 252, 0.3);
}
.agent-type-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0 16px;
}
.agent-type-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text);
    margin: 0;
    transition: all .15s;
}
.agent-type-option:hover {
    background: rgba(192, 132, 252, 0.1);
    border-color: rgba(192, 132, 252, 0.3);
}
.agent-type-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}



.schedule-tab-sep {
    width: 1px;
    background: rgba(0,0,0,.1);
    margin: 0 4px;
    flex-shrink: 0;
}

.schedule-tab-add {
    color: #007aff;
    font-size: 18px;
    padding: 4px 12px;
    font-weight: 600;
}



.schedule-add-slot-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: 1px dashed #bbb;
    border-radius: 10px;
    background: none;
    color: #007aff;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.schedule-add-slot-btn:hover {
    background: rgba(0, 122, 255, .05);
    border-color: #007aff;
}


/* ============================================================
   地图编辑页
   ============================================================ */
.map-edit-page {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 4px;
    position: relative;
}
.map-edit-page.active {
    display: flex;
}
.map-edit-header {
    display: flex;
    align-items: center;
    padding: 12px 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.map-edit-back {
    font-size: 24px;
    cursor: pointer;
    padding-right: 12px;
    color: var(--primary);
}
.map-edit-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.map-edit-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.map-loc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
    user-select: none;
    -webkit-user-select: none;
}
.map-loc-item:hover {
    background: rgba(192, 132, 252, 0.06);
}
.map-loc-item.invisible {
    opacity: 0.55;
}
.map-loc-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(192, 132, 252, 0.2);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
}
.map-loc-thumb.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-dim);
}
.map-loc-info {
    flex: 1;
    min-width: 0;
}
.map-loc-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.map-loc-meta {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.map-loc-arrow {
    color: var(--text-dim);
    font-size: 18px;
    flex-shrink: 0;
}
/* ===== 看法历史列表 ===== */
.perception-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 12px;
}
.perception-history-item {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(192, 132, 252, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
}
.perception-history-item:hover {
    background: rgba(192, 132, 252, 0.1);
    border-color: rgba(192, 132, 252, 0.4);
}
.perception-history-time {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.perception-history-view {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}
.perception-history-reason {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
    font-style: italic;
}
.perception-history-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 20px 0;
    font-size: 14px;
}
/* 最新标签 */
.perception-latest-tag {
    display: inline-block;
    padding: 1px 8px;
    margin-right: 6px;
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.3), rgba(236, 72, 153, 0.3));
    border: 1px solid rgba(192, 132, 252, 0.5);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    vertical-align: middle;
}
.perception-history-item.is-latest {
    border-color: rgba(236, 72, 153, 0.5);
    background: rgba(192, 132, 252, 0.08);
}