/* ========================================
   自托管富文本编辑器 - 纯JS实现，无外部依赖
   ======================================== */

.re-wrapper {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s;
}
.re-wrapper:focus-within {
    border-color: #c4a35a;
    box-shadow: 0 0 0 2px rgba(196,163,90,0.15);
}

/* 工具栏 */
.re-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    user-select: none;
}
.re-toolbar .re-group {
    display: flex;
    gap: 2px;
    padding-right: 6px;
    margin-right: 4px;
    border-right: 1px solid #e0e0e0;
}
.re-toolbar .re-group:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.re-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #444;
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
}
.re-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}
.re-btn.active {
    background: #c4a35a;
    color: #fff;
    border-color: #b39345;
}
.re-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* 下拉选择 */
.re-select {
    height: 30px;
    padding: 0 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    color: #444;
    background: #fff;
    cursor: pointer;
    outline: none;
}
.re-select:focus {
    border-color: #c4a35a;
}

/* 颜色选择器 */
.re-color-input {
    width: 28px;
    height: 26px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    padding: 1px;
    background: #fff;
}

/* 编辑区域 */
.re-content {
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
    padding: 16px 20px;
    font-family: "Noto Sans SC", sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    outline: none;
    background: #fff;
}
.re-content:empty::before {
    content: attr(data-placeholder);
    color: #aaa;
    pointer-events: none;
}
.re-content img {
    max-width: 100%;
    height: auto;
}
.re-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}
.re-content table td,
.re-content table th {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
}
.re-content a {
    color: #c4a35a;
    text-decoration: underline;
}
.re-content blockquote {
    margin: 8px 0;
    padding: 8px 16px;
    border-left: 4px solid #c4a35a;
    background: #f9f7f0;
    color: #555;
}
.re-content ul, .re-content ol {
    padding-left: 24px;
    margin: 8px 0;
}
.re-content p {
    margin: 6px 0;
}

/* 源码模式 */
.re-content.source-mode {
    font-family: "Courier New", monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    color: #1a1a2e;
    background: #fafafa;
}

/* 状态栏 */
.re-status {
    padding: 4px 12px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    font-size: 11px;
    color: #999;
    display: flex;
    justify-content: space-between;
}

/* 插入链接弹窗 */
.re-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.re-modal {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.re-modal h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #1a1a2e;
}
.re-modal label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #666;
}
.re-modal input[type="text"],
.re-modal input[type="url"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
}
.re-modal input:focus {
    border-color: #c4a35a;
}
.re-modal-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}
.re-modal-btns button {
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid #d1d5db;
}
.re-modal-btns .btn-confirm {
    background: #c4a35a;
    color: #fff;
    border-color: #b39345;
}
.re-modal-btns .btn-cancel {
    background: #fff;
    color: #666;
}
