/* ========== 字体颜色选择器 ========== */
.color-picker-wrap {
    position: relative;
    display: inline-block;
}

.color-picker-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.color-picker-btn:hover {
    color: var(--primary-color);
    background: var(--primary-bg);
}

.color-picker-btn.active {
    color: var(--primary-color);
    background: var(--primary-bg);
}

.color-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 12px;
    width: 220px;
}

.color-panel.show {
    display: block;
    animation: colorFadeIn 0.2s ease;
}

@keyframes colorFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.color-panel-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    position: relative;
}

.color-dot:hover {
    transform: scale(1.25);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 编辑器工具栏中的颜色按钮 */
.write-editor-toolbar .color-picker-wrap {
    display: inline-flex;
}

.write-editor-toolbar .color-picker-btn {
    padding: 6px 8px;
}

.write-editor-toolbar .color-panel {
    bottom: auto;
    top: 100%;
    margin-top: 8px;
    margin-bottom: 0;
}

/* 响应式 */
@media (max-width: 768px) {
    .color-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-height: 50vh;
        margin-bottom: 0;
        border-radius: 12px 12px 0 0;
        transform: none;
    }

    .color-panel.show {
        transform: none;
    }
}
