/**
 * 圈子富文本编辑器样式
 * 黑色工具栏 + 白色图标
 */

/* 编辑器容器 */
.po-topic-textarea .tox-tinymce {
    border: none !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #fff !important;
}

/* 工具栏 - 黑色背景 */
.po-topic-textarea .tox .tox-editor-header {
    background: #2c2c2c !important;
    border-bottom: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.po-topic-textarea .tox .tox-toolbar-overlord {
    background: #2c2c2c !important;
    padding: 0 !important;
}

.po-topic-textarea .tox .tox-toolbar__primary {
    background: #2c2c2c !important;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
}

/* 隐藏三点菜单按钮 */
.po-topic-textarea .tox .tox-toolbar__overflow,
.po-topic-textarea .tox .tox-tbtn--more {
    display: none !important;
}

/* 工具栏分组 */
.po-topic-textarea .tox .tox-toolbar__group {
    padding: 0 10px !important;
    border-right: 1px solid #444 !important;
    flex-wrap: nowrap !important;
    margin: 0 !important;
}

.po-topic-textarea .tox .tox-toolbar__group:first-child {
    padding-left: 0 !important;
}

.po-topic-textarea .tox .tox-toolbar__group:last-child {
    border-right: none !important;
    padding-right: 0 !important;
}

/* 工具栏按钮 - 透明背景白色图标 */
.po-topic-textarea .tox .tox-tbtn {
    width: 32px !important;
    height: 32px !important;
    margin: 2px 3px !important;
    border-radius: 4px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: background-color 0.2s ease !important;
}

.po-topic-textarea .tox .tox-tbtn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.po-topic-textarea .tox .tox-tbtn--enabled,
.po-topic-textarea .tox .tox-tbtn:focus {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* 白色图标 */
.po-topic-textarea .tox .tox-tbtn svg {
    fill: #fff !important;
}

.po-topic-textarea .tox .tox-tbtn:hover svg {
    fill: #fff !important;
}

.po-topic-textarea .tox .tox-tbtn--enabled svg {
    fill: #40a9ff !important;
}

/* 下拉按钮（颜色选择等） */
.po-topic-textarea .tox .tox-split-button {
    border-radius: 4px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 2px 3px !important;
}

.po-topic-textarea .tox .tox-split-button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.po-topic-textarea .tox .tox-split-button .tox-tbtn {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.po-topic-textarea .tox .tox-split-button__chevron svg {
    fill: #fff !important;
}

/* 编辑区域 - 白色背景 */
.po-topic-textarea .tox .tox-edit-area {
    background: #fff !important;
    border-top: none !important;
}

.po-topic-textarea .tox .tox-edit-area__iframe {
    background: #fff !important;
}

.po-topic-textarea .tox .tox-sidebar-wrap {
    background: #fff !important;
}

/* 内容样式 */
.po-topic-textarea .tox-edit-area iframe {
    min-height: 150px;
}

/* 表格样式 - 编辑器内 */
.mce-content-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.mce-content-body table td,
.mce-content-body table th {
    border: 1px solid #d9d9d9;
    padding: 8px 12px;
    min-width: 60px;
}

.mce-content-body table th {
    background-color: #fafafa;
    font-weight: 600;
}

.mce-content-body table tr:hover td {
    background-color: #f5f5f5;
}

/* 颜色选择器优化 */
.po-topic-textarea .tox .tox-color-input {
    border-radius: 4px !important;
}

/* 链接弹窗 */
.tox .tox-dialog {
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.tox .tox-dialog__header {
    background: #fafafa !important;
    border-bottom: 1px solid #e8e8e8 !important;
    padding: 12px 16px !important;
}

.tox .tox-dialog__body-content {
    padding: 16px !important;
}

.tox .tox-dialog__footer {
    background: #fafafa !important;
    border-top: 1px solid #e8e8e8 !important;
    padding: 12px 16px !important;
}

.tox .tox-button {
    border-radius: 4px !important;
    padding: 8px 16px !important;
}

.tox .tox-button--primary {
    background-color: #1890ff !important;
    border-color: #1890ff !important;
}

.tox .tox-button--primary:hover {
    background-color: #40a9ff !important;
    border-color: #40a9ff !important;
}

/* 隐藏原始textarea */
.po-topic-textarea textarea.topic-content.feihe-editor-initialized {
    display: none !important;
}

/* 表格菜单优化 */
.tox .tox-menu {
    border-radius: 6px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12) !important;
}

.tox .tox-collection__item {
    border-radius: 4px !important;
}

.tox .tox-collection__item:hover {
    background-color: #e6f7ff !important;
}

/* 颜色选择面板 */
.tox .tox-swatches {
    padding: 8px !important;
}

.tox .tox-swatch {
    width: 24px !important;
    height: 24px !important;
    border-radius: 4px !important;
    margin: 2px !important;
}

/* ==================== 话题显示区域的富文本样式 ==================== */

/* 话题内容中的表格 */
.circle-topic-content table,
.topic-content-box table,
.b2-single-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
    font-size: 14px;
    overflow-x: auto;
    display: block;
}

.circle-topic-content table td,
.circle-topic-content table th,
.topic-content-box table td,
.topic-content-box table th,
.b2-single-content table td,
.b2-single-content table th {
    border: 1px solid #e8e8e8;
    padding: 10px 14px;
    text-align: left;
    min-width: 80px;
}

.circle-topic-content table th,
.topic-content-box table th,
.b2-single-content table th {
    background-color: #f5f7fa;
    font-weight: 600;
    color: #303133;
}

.circle-topic-content table tr:nth-child(even) td,
.topic-content-box table tr:nth-child(even) td {
    background-color: #fafafa;
}

.circle-topic-content table tr:hover td,
.topic-content-box table tr:hover td {
    background-color: #f0f7ff;
}

/* 加粗文字 */
.circle-topic-content strong,
.circle-topic-content b,
.topic-content-box strong,
.topic-content-box b {
    font-weight: 600;
    color: #262626;
}

/* 斜体 */
.circle-topic-content em,
.circle-topic-content i,
.topic-content-box em,
.topic-content-box i {
    font-style: italic;
}

/* 下划线 */
.circle-topic-content u,
.topic-content-box u {
    text-decoration: underline;
}

/* 删除线 */
.circle-topic-content s,
.circle-topic-content strike,
.topic-content-box s,
.topic-content-box strike {
    text-decoration: line-through;
    color: #999;
}

/* 列表 */
.circle-topic-content ul,
.circle-topic-content ol,
.topic-content-box ul,
.topic-content-box ol {
    padding-left: 24px;
    margin: 10px 0;
}

.circle-topic-content li,
.topic-content-box li {
    line-height: 1.8;
    margin: 4px 0;
}

/* 链接 */
.circle-topic-content a,
.topic-content-box a {
    color: #1890ff;
    text-decoration: none;
    transition: color 0.2s;
}

.circle-topic-content a:hover,
.topic-content-box a:hover {
    color: #40a9ff;
    text-decoration: underline;
}

/* 背景色文字 */
.circle-topic-content span[style*="background"],
.topic-content-box span[style*="background"] {
    padding: 2px 4px;
    border-radius: 3px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .po-topic-textarea .tox-tinymce {
        border-radius: 6px !important;
    }
    
    .po-topic-textarea .tox .tox-toolbar__primary {
        flex-wrap: wrap !important;
    }
    
    .po-topic-textarea .tox .tox-tbtn {
        width: 28px !important;
        height: 28px !important;
    }
    
    /* 移动端表格横向滚动 */
    .circle-topic-content table,
    .topic-content-box table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .circle-topic-content table td,
    .circle-topic-content table th,
    .topic-content-box table td,
    .topic-content-box table th {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
    }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .po-topic-textarea .tox-tinymce {
        border-color: #434343 !important;
    }
    
    .po-topic-textarea .tox .tox-toolbar-overlord {
        background: #262626 !important;
        border-bottom-color: #434343 !important;
    }
    
    .po-topic-textarea .tox .tox-toolbar__group {
        border-right-color: #434343 !important;
    }
    
    .po-topic-textarea .tox .tox-tbtn svg {
        fill: #d9d9d9 !important;
    }
}

/* 占位符样式 */
.tox .tox-edit-area__iframe[data-alloy-tooltip] {
    position: relative;
}

/* 编辑器加载状态 */
.feihe-editor-loading {
    position: relative;
    min-height: 150px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feihe-editor-loading::after {
    content: '编辑器加载中...';
    color: #999;
    font-size: 14px;
}

