/* FDE Frontend Document Editor */
:root{
	--color-primary: #327A68;
}
.fde-doc-content-view li>ul, .fde-doc-content-view li>ol {
    margin-bottom: 1.5rem !important;
}
li p{
	margin-bottom:0.2rem !important;
}
.fde-app {
    display: flex;
    min-height: 80vh;
	font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Segoe UI Emoji","Segoe UI Symbol";
}

.state_mobiles .fde-app{
	display:block;
}
.div.mce-edit-area,
div.mce-panel,
#fde-doc-editor_ifr #tinymce{
	background:transparent !important;
}
/* Sidebar (tree) */
.fde-sidebar {
    width: 30%;
    min-width: 240px;
    max-width: 360px;
    background: transparent;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100vh;
}

.fde-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #c3c4c7;
} 

.fde-btn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}

.fde-btn:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

.fde-btn-outline {
    background: transparent;
    color: var(--color-primary);
}
.fde-btn-outline:hover {
    background: #f0f6fc;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.fde-btn-new {
    width: 100%;
    text-align: center;
}

.fde-tree-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.fde-tree,
.fde-tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fde-tree-node {
    margin: 0;
    padding: 0;
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
	font-size:14px;
	line-height:1.4;
}

.fde-tree-node > .fde-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    color: #50575e;
    transform-origin: center center;
    transition: transform 0.15s ease;
}
.fde-tree-node > .fde-tree-toggle:hover {
    color: #1d2327;
}
.fde-tree-node > .fde-tree-toggle .fde-tree-btn-icon svg {
    display: block;
    width: 8px;
    height: 8px;
}

.fde-tree-node > .fde-tree-toggle-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    pointer-events: none;
}

.fde-tree-node > .fde-tree-label {
    cursor: pointer;
    padding: 5px 8px;
    line-height: 1.4;
    display: inline-block;
    border-radius: 2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fde-app:not(.fde-view-mode) .fde-tree-node > .fde-tree-label {
    cursor: grab;
}
.fde-app:not(.fde-view-mode) .fde-tree-node > .fde-tree-label:active {
    cursor: grabbing;
}

.fde-tree-node > .fde-tree-control {
    min-width: 80px;
    display: inline-block;
    margin-left: auto;
    flex-shrink: 0;
}

.fde-tree-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.fde-tree-btn-icon svg {
    display: block;
}
.fde-tree-control .fde-tree-btn-icon svg {
    width: 8px;
    height: 8px;
}

.fde-tree-control .fde-tree-add,
.fde-tree-control .fde-tree-draft,
.fde-tree-control .fde-tree-outdent,
.fde-tree-control .fde-tree-indent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    padding: 0;
    margin-left: 2px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, filter 0.15s ease;
    flex-shrink: 0;
}
.fde-tree-control .fde-tree-add {
    background: #34c759;
    color: #fff;
}
.fde-tree-node:hover .fde-tree-control .fde-tree-add {
    opacity: 1;
}
.fde-tree-control .fde-tree-add:hover {
    filter: brightness(1.1);
}

.fde-tree-control .fde-tree-draft {
    background: #ff3b30;
    color: #fff;
}
.fde-tree-node:hover .fde-tree-control .fde-tree-draft {
    opacity: 1;
}
.fde-tree-control .fde-tree-draft:hover {
    filter: brightness(1.1);
}
.fde-view-mode .fde-tree-control .fde-tree-draft {
    display: none !important;
}

.fde-tree-control .fde-tree-outdent,
.fde-tree-control .fde-tree-indent {
    background: #ffcc00;
    color: #fff;
}
.fde-tree-node:hover .fde-tree-control .fde-tree-outdent,
.fde-tree-node:hover .fde-tree-control .fde-tree-indent {
    opacity: 1;
}
.fde-tree-control .fde-tree-outdent:hover,
.fde-tree-control .fde-tree-indent:hover {
    filter: brightness(0.95);
}
.fde-tree-control .fde-tree-outdent .fde-tree-btn-icon svg,
.fde-tree-control .fde-tree-indent .fde-tree-btn-icon svg {
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.25));
}
.fde-view-mode .fde-tree-control .fde-tree-outdent,
.fde-view-mode .fde-tree-control .fde-tree-indent {
    display: none !important;
}
.fde-view-mode .fde-tree-control .fde-tree-add {
    display: none !important;
}

.fde-tree-node.selected > .fde-tree-label {
color:#000000e6;
}

.fde-tree-children {
    margin-left: 7px;
    flex: 0 0 100%;
    width: 100%;
}
ul li::marker {
    color: var(--color-header-transparent-text-hover);
}
.fde-app:not(.fde-view-mode) .fde-tree-children {
    min-height: 8px;
}
.fde-tree-node.collapsed > .fde-tree-children {
    display: none;
}

/* 有选中项时保持展开，优先级高于上面的 display:none（同源且更具体） */
.fde-tree-node > .fde-tree-children:has(li.fde-tree-node.selected) {
    display: block !important;
}

.fde-tree-node.collapsed > .fde-tree-toggle {
    transform: rotate(0deg);
}

.fde-tree-node:not(.collapsed) > .fde-tree-toggle {
    transform: rotate(90deg);
}

/* Sortable drag */
.fde-tree-node.sortable-ghost {
    opacity: 0.4;
}

.fde-tree-node.sortable-drag {
    opacity: 0.8;
}

/* Editor area */
.fde-editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #fff;
}

.fde-editor-empty {
    color: #646970;
    padding: 40px 20px;
    text-align: center;
}

.fde-editor-panel {
    display: flex;
    flex-direction: column;
    max-width: 800px;
}

.fde-panel-top {
    margin-bottom: 16px;
}
.fde-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.fde-search-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}
.fde-search-input:focus {
    border-color:var(--color-primary);
}
.fde-last-read {
    font-size: 13px;
    color: var(--color-primary);
}
.fde-last-read-title {
    margin-right: 6px;
}
.fde-last-read-link {
    color: var(--color-primary);
    text-decoration: none;
}
.fde-last-read-link:hover {
    text-decoration: underline;
}

.fde-search-highlight {
    background: #fff59d;
    padding: 0 1px;
    border-radius: 2px;
}

.fde-doc-title {
    width: 100%;
    font-size: 24px;
    font-weight: 600;
    border: 0;
    border-bottom: 1px solid #c3c4c7;
    padding: 8px 0;
    margin-bottom: 16px;
    outline: none;
}

.fde-doc-title:focus {
    border-bottom-color: var(--color-primary);
}

.fde-doc-editor-wrap {
    min-height: 300px;
    margin-bottom: 16px;
}

.fde-doc-editor-wrap .wp-editor-container {
    border: 1px solid #c3c4c7;
    border-radius: 3px;
}

.fde-doc-editor-wrap .mce-toolbar-grp {
    border-bottom: 1px solid #c3c4c7;
}

.fde-doc-children {
    margin-top: 24px;
    margin-bottom: 16px;
}
.fde-doc-children-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d2327;
}
.fde-doc-children-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.fde-doc-children-list li {
    margin: 4px 0;
}
.fde-doc-children-link {
    color: var(--color-primary);
    text-decoration: none;
}
.fde-doc-children-link:hover {
    text-decoration: underline;
}

.fde-doc-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 1px solid #c3c4c7;
    gap: 16px;
}
.fde-doc-nav-prev {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fde-doc-nav-next {
    flex: 1;
    min-width: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fde-doc-nav-link {
    color: var(--color-primary);
    text-decoration: none;
}
.fde-doc-nav-link:hover {
    text-decoration: underline;
}

.fde-editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fde-btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.fde-save-status {
    font-size: 13px;
    color: #646970;
}

.fde-save-status.success {
    color: #00a32a;
}

.fde-save-status.error {
    color: #d63638;
}

/* View mode (guests): no new/save/drag, read-only content */
.fde-view-mode .fde-sidebar-header {
    display: none;
}
.fde-view-mode .fde-editor-actions {
    display: none;
}
.fde-view-mode #fde-doc-title,
.fde-view-mode #fde-doc-editor-wrap {
    display: none !important;
}
.fde-doc-title-view {
    font-size: 34px;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding: 0;
    border: 0;
}
.fde-doc-content-view {
    min-height: 200px;
	    line-height: 1.75;
    font-size: 15px;
    color: #000000ba;
}
.fde-doc-content-view p{
	margin-top:1rem;
	margin-bottom:0.6rem;
}
.fde-doc-content-view img {
    max-width: 100%;
    height: auto;
}
